Skip to content

Enable Android 6 way for requesting permissions #1451

Closed

Description

@atanasovg

Quoting from the official Android guides:

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.

Activity

  1. added this to the milestone on Jan 28, 2016
  2. vjoao commented on Feb 11, 2016

    @vjoao
    Contributor

    +1

  3. gopi-ar commented on Feb 17, 2016

    @gopi-ar

    +1

  4. gopi-ar commented on Feb 17, 2016

    @gopi-ar

    Essentially NativeScript doesn't fully support Android 6.0 then?

  5. aderbas commented on Feb 18, 2016

    @aderbas

    +1

  6. modified the milestones: 1.7.0, on Feb 24, 2016
  7. bradmartin commented on Mar 10, 2016

    @bradmartin
    Contributor

    @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.

  8. modified the milestones: , 1.7.0 on Mar 11, 2016
  9. EddyVerbruggen commented on Mar 12, 2016

    @EddyVerbruggen
    Contributor

    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.

  10. bradmartin commented on Mar 12, 2016

    @bradmartin
    Contributor

    @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 :)

  11. EddyVerbruggen commented on Mar 13, 2016

    @EddyVerbruggen
    Contributor

    @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.

    Note that you need to include the support v4 lib.

  12. Daxito commented on Mar 16, 2016

    @Daxito

    +1

  13. NathanaelA commented on Mar 17, 2016

    @NathanaelA
  14. aderbas commented on Mar 24, 2016

    @aderbas

    Any update about this? =/

  15. vjoao commented on Mar 24, 2016

    @vjoao
    Contributor

    The PR is merged.
    You can go here and download a build from master if you are not willing to wait for the release.

  16. NathanaelA commented on Mar 24, 2016

    @NathanaelA
  17. NathanaelA commented on Mar 26, 2016

    @NathanaelA
  18. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Mar 28, 2016
  19. added and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Apr 12, 2016
  20. lock commented on Aug 30, 2019

    @lock

    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.

  21. locked and limited conversation to collaborators on Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions