¿Alguien ha creado alguna vez una forma de proporcionar a un usuario la capacidad de alternar permisos dentro de una aplicación de Android?

I am creating an Android app that has many newtorking capabilites, I want to provide them with the option to toggle these permissions on and off. So far in the manfest I have these permissions:

 <uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

I want to create a preferences activity where the users can select a check box to allow each permission, is this possible? I know that the permissions once added, they are set, but I would really like a way for the user to have control whether a permission can be added or not added at any time.

preguntado el 09 de marzo de 12 a las 15:03

Yeah, I wish I could +1 this a dozen times. I'd like the ability for the user to be able to grant (or deny) a permission after the app is installed, when the app first asks for it. Any well-written app would of course be required to press on if permission is denied. -

For example, an app that uses the camera, but can function without it could still be installed on a device with no camera. -

I planned to do this while designing my application, I didn't expect it to be troublesome, but apparently it is. I don't see why when adding in permissions they can't be active or not active depending on a user selection, building this into an app should be available to developers. If a user wants to access the internet, but afterwards changes their mind they are stuck with the permission unless they uninstall, not good. -

3 Respuestas

I would really like a way for the user to have control whether a permission can be added or not added at any time.

Implement the code that requires the additional permissions as plugins, distributed as separate APK files. That way, the user can install or uninstall the plugin to, in effect, toggle on or off that permission. The plugins can interact with the host application in any number of ways: ContentProvider, Service (command pattern or remote binding pattern), broadcasts, RemoteViews for UI, etc.

respondido 09 mar '12, 16:03

This seems like a great idea, I will look into it now! Thanks - deucalion0

CyanogenMod 7 has this. But there is nothing an application can do to it.

respondido 09 mar '12, 15:03

you can look at the cyanogenmod project!! in the code of their rooms they added an option to personalize the permission for the apps.

respondido 09 mar '12, 15:03

I did research this and never came across the cyanogenmod, I will look for it now. Thanks. - deucalion0

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.