0

I am implementing runtime permissions in my app. I have few questions though to understand them clearly.

Situation:

  • My application B is a child app of application A
  • That being said my application resides inside application A as part of it and, whenever needed I can launch it.

Question:

  1. If a user has already granted all the necessary runtime permissions to application A (the parent app), then can the child app i.e. application B carry the same permission grant or it has to ask them again?

  2. Do I need to ask the permissions again if I install a newer version of an app on top of the old? Let's say version 2 to 3.

Kashif Rafique
  • 1,273
  • 1
  • 12
  • 25
003
  • 197
  • 1
  • 12
  • 2
    What does "My application(B) is a child app of application (A)" mean? What does "my application resides in side application A as part of it and whenever needed I can launch it" mean? – CommonsWare Jan 25 '19 at 20:14
  • @CommonsWare there is a button inside parent app call 'Axis' if you click that it will open up a child app named 'Axis' with few data to move forward with the job – 003 Jan 25 '19 at 20:18
  • So app(B) is really just a whole other app that gets some kinda intent/data from app(A)? – TWL Jan 25 '19 at 22:16
  • @TWL yes you got it right. – 003 Jan 26 '19 at 20:14

1 Answers1

0

Technically, yes. If app-A and app-B are two separate apps, they each need their own set of permissions and permission requests.

And no, if a permission was previously allowed, then an installation of a newer version does not reset that permission's state.

However, if you want app-B to retain the same permission states as app-A, you should look into something called android:sharedUserId. If app-A has the same sharedUserId as app-B, then app-B will have the same permission states as app-A, and vice versa.

I couldn't find any posts talking sufficiently about the shared permission states between apps with the same, but you can check out some of these posts for extra notes:

I did a quick test myself and can confirm that two apps with the same sharedUserId do share permission states, so go try it yourself. Just setup a sample project/app that checks and requests a permission, clone it, give them the same sharedUserId, install both of them, allow the permission on one, and you'll see it's already in the allowed-state on the other.

TWL
  • 6,228
  • 29
  • 65