Commit Graph

2 Commits

Author SHA1 Message Date
Nick Kralevich
97e5ad6387 OptionalPermissions: fix call to buildPermissionRequestIntent
There's no need to call getApplication().

Change-Id: I56e8a6a4ab230275c70e240e53a893e05400f2f9
2013-03-28 15:14:28 -07:00
Nick Kralevich
2ad812d4aa Initial checkin: optional permissions sample code
This is an initial checkin of a small demonstration program
which demonstrates how optional permissions can be used.
This app can do three things, which require permissions:

* Vibrate the device (android.permission.VIBRATE)
* Access the internet (android.permission.INTERNET)
* Get the phone number (android.permission.READ_PHONE_STATE)

At install time, this app has zero permissions.  However, the app can
request that the user grant permissions, based on pressing the "Prompt"
button. The user can then choose to allow or deny the permissions.

Known bugs and limitations:
* Once a permission is granted, it currently cannot be revoked by the
application nor the user.
* Due to the way it's implemented, the INTERNET permission requires a
restart of the application. That isn't in the sample code.
* Getting the device phone number doesn't make sense for a tablet.

This code was mostly written by klyubin@google.com with heavy
modification by myself.

Change-Id: I620db52c4a1f10ac7aa604ba34f77f7ec03af023
2013-03-27 16:54:04 -07:00