Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20144] Android 6.0: allow native modules to get notified about runtime permission granting results

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2016-04-21T04:33:14.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid
ReporterOlivier Morandi
AssigneeEric Merriman
Created2015-12-14T15:26:42.000+0000
Updated2017-03-22T20:49:40.000+0000

Description

With the new Android 6 permissions mechanism, native modules should be able to request runtime permissions outside of the ones exposed by the Ti API (camera, calendar, location and contacts). For example, a native module for sending SMS messages would need to request the SEND_SMS permission at runtime, however it would have no means to get notified about the result of the operation. I would propose to extend the TiBaseActivity class with a mechanism allowing native modules to register a listener, in order to be notified when the onRequestPermissionsResult method of the current activity is called (see https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiBaseActivity.java#L447)

Comments

  1. Fokke Zandbergen 2015-12-14

    Maybe we can think of a way which would also allow us to dump the createActivityWorker() we currently [require for our Android FB module](https://github.com/appcelerator-modules/ti.facebook#proxy-required-per-android-activity) as well? Since I think both our related to being able to hook into the current activity?
  2. Fokke Zandbergen 2016-01-26

    [~cng] related to TIMOB-20235, I thought we also had a ticket requesting a generic method (Ti.Android.requestPermission) to request any permission that we resolved as _Invalid_ / _Won't Fix_ because we thought any module that needed additional permission should provide ways to request this via the module, which is what this ticket is about. Anyway, I think it might be better to have that generic method after all. That way, modules only need to list what permission you should request and we won't end up with modules that have different method names/ways to request these. Also, you would prevent situations where 2 modules overlap in the permissions they need and if they don't properly handle the case where only some of the permissions were already granted (which we had ourselves with camera on android) it can get ugly. What do you think?
  3. Fokke Zandbergen 2016-02-03

    I've created TIMOB-20320 to request a generic method.
  4. Ashraf Abu 2016-04-21

    I resolved this as duplicate as TIMOB-20320 has addressed this.
  5. Lee Morris 2017-03-22

    Closing ticket as duplicate of the ticket that is mentioned above and has since been closed.

JSON Source