Sorry, no this is a current limitation of permissions, they need to be
known at install time to be granted.

On Tue, Feb 21, 2012 at 11:52 AM, Kevin TeslaCoil Software <
[email protected]> wrote:

> I'm trying to implement a custom permission to be used between two of
> my apps.
> In AppA I declare:
>
>    <uses-permission android:name="com.teslacoilsw.TEST_PERMISSION" />
>
> And in AppB I declare:
>    <permission android:name="com.teslacoilsw.TEST_PERMISSION"
>        android:label="TeslaCoil Test"
>        android:protectionLevel="normal" />
> ...
>        <service android:name=".TestService"
>            android:exported="true"
>            android:permission="com.teslacoilsw.TEST_PERMISSION"
>        />
>
> If I install AppB and then install AppA, it work as expected (AppA can
> bind to AppB's service). However if I install AppA and then install
> AppB, I get a SecurityException when trying to bind to the service as
> the permission is not granted. (Tested on Android 4.0.3)
>
> I've investigated adding the <permission> declaration to both
> manifests and this does seem to work, I assume because the permission
> now always exists at install time. However this feels wrong to me.
>
> Is there a correct way for an app to declare a permission in an
> environment like the Market where installation order is not
> guaranteed?
>
> Thanks,
> -Kevin
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to