You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable Android 6 way for requesting permissions #1451
Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app.
Once we integrate the new functionality from the Android Runtime (NativeScript/android#283) we need to base our Activity on AppCompatActivity and provide an implementation of the OnRequestPermissionsResultCallback interface. Then we need to design some JavaScript-friendly API to allow people to enable permissions more elegantly than calling native APIs.
@gopi-ar - just wanted to point out that it does support 6.0, this issue is to create a nice javascript API for devs to use and not deal with the native code dealing with permissions, it can be a bit tricky without any Android knowledge.
Just wanted to add that @bradmartin is right and if you wonder what you can do now, then here is an example. If you request permission before using the thing that requires the permission then all is fine.
Only in case you want to defer requesting permission until the thing that requires the permission is called and have it invoked immediately after the user has granted the permission - then you need the OnRequestPermissionsResultCallback API @atanasovg refers to.
Which I eagerly await by the way since I'm using this in 3 plugins now and want the developer to choose whether or not he wants to defer requesting permission or ask it upfront. Either way you want to check the user granted permission every time before triggering the code that may need the permission.
@EddyVerbruggen does that really work? I tried hacking that together in a hurry the other night for RECORD_AUDIO and I failed miserably but I was hurried to just check if it was possible :)
@bradmartin Yes I have that in 4 NS plugins and use the same approach for about 10 Cordova plugins as well as they started to support OnRequestPermissionsResultCallback only in a recent version of the fwk and I didn't want to force users to not use SDK 23.
Activity
vjoao commentedon Feb 11, 2016
+1
gopi-ar commentedon Feb 17, 2016
+1
gopi-ar commentedon Feb 17, 2016
Essentially NativeScript doesn't fully support Android 6.0 then?
aderbas commentedon Feb 18, 2016
+1
bradmartin commentedon Mar 10, 2016
@gopi-ar - just wanted to point out that it does support 6.0, this issue is to create a nice javascript API for devs to use and not deal with the native code dealing with permissions, it can be a bit tricky without any Android knowledge.
EddyVerbruggen commentedon Mar 12, 2016
Just wanted to add that @bradmartin is right and if you wonder what you can do now, then here is an example. If you request permission before using the thing that requires the permission then all is fine.
Only in case you want to defer requesting permission until the thing that requires the permission is called and have it invoked immediately after the user has granted the permission - then you need the
OnRequestPermissionsResultCallbackAPI @atanasovg refers to.Which I eagerly await by the way since I'm using this in 3 plugins now and want the developer to choose whether or not he wants to defer requesting permission or ask it upfront. Either way you want to check the user granted permission every time before triggering the code that may need the permission.
bradmartin commentedon Mar 12, 2016
@EddyVerbruggen does that really work? I tried hacking that together in a hurry the other night for RECORD_AUDIO and I failed miserably but I was hurried to just check if it was possible :)
EddyVerbruggen commentedon Mar 13, 2016
@bradmartin Yes I have that in 4 NS plugins and use the same approach for about 10 Cordova plugins as well as they started to support
OnRequestPermissionsResultCallbackonly in a recent version of the fwk and I didn't want to force users to not use SDK 23.Note that you need to include the support v4 lib.
Daxito commentedon Mar 16, 2016
+1
NathanaelA commentedon Mar 17, 2016
aderbas commentedon Mar 24, 2016
Any update about this? =/
vjoao commentedon Mar 24, 2016
The PR is merged.
You can go here and download a build from master if you are not willing to wait for the release.
NathanaelA commentedon Mar 24, 2016
NathanaelA commentedon Mar 26, 2016
lock commentedon Aug 30, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.