Domanda

We have a AutoCompleteTextView which is able to read from the users-contact-data as a convenience. However some users complain about the "READ_CONTACT" Permission the App is enforcing at installation. Is there any Way to let the user Choose to grant this permission and use this feature, or deny it and loose the feature? If it is not possible at Runtime, maybe there is some other way? Building two Apps, one with that permission and one without is not an option!

È stato utile?

Soluzione

Is there any Way to let the user Choose to grant this permission and use this feature, or deny it and loose the feature?

Unfortunately, no.

If it is not possible at Runtime, maybe there is some other way? Building two Apps, one with that permission and one without is not an option!

You can build a main app without that permission, then create a plugin that holds the permission and securely interacts with the main app. This is a bit of an advanced technique. I cover it in one of my books, and here is the directory with sample projects demonstrating the host and the plugin. In my case, I am using CallLog instead of ContactsContract, though the permission (READ_CONTACTS) is the same.

Altri suggerimenti

I'm not too sure about this, but you could build a separate app, that requires this permission. This extra app provides a content provider. Your main app now checks if your extension app is installed and gets that data from the content provider.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top