How can I find out what permissions I need to add to the manifest for my applications?
Permissions are sometimes documented, for example, in JavaDocs for classes and methods that need those permissions.
Sometimes permissions are not documented. You will find out that you need them by testing or looking at notes about them elsewhere, such as questions and answers about stack overflows.
In some cases, an IDE (e.g. Android Studio) or a build process (e.g. Gradle with Lint checks) will complain at compile time about the missing permission. They are usually intended for already registered permit requirements. However, running a manual Lint check ("Inspect Code" in Android Studio) is a good idea before submitting the application.
How do I know how my application really needs to add some permissions to the manifest before installing it on the device?
Testing.
Can I find permissions from an imported package?
Permissions are usually not tied to Java packages.
for example, is there a way to find out that we need to add permissions "uses-permission android: name =" com.android.alarm.permission.SET_ALARM to the manifest because we add "import android.app.AlarmManager;" in code?
You do not need to use SET_ALARM because you are importing AlarmManager . The import statement requires permission.
but when users update their phones to the new android, my applications do not work
Test your apps quickly with new versions of Android, as these versions are released. When you are given access to developer previews - since the developers were before Android 5.0 and 6.0 - the test for developer previews.
CommonsWare
source share