What permissions need to be requested at runtime?

Asked

Viewed 66 times

0

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

These are my permissions, I’m doubtful if I need to notify the user to allow or not, I was seeing that from API 23 you need to do this If I need to, how do I do it?

2 answers

0

Follow the code to request permissions from version 23:

String [] permissions = {"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_FINE_LOCATION","android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_PHONE_STATE", "android.permission.SYSTEM_ALERT_WINDOW","android.permission.CAMERA"};
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
    int requestCode = 200;
    requestPermissions(permissions, requestCode);
}

In the variable Permissions I put some random permissions, change and put whatever you need

0


Permissions that need to be requested at runtime are those considered as "dangerous"(Dangerous Permissions).

Within the list he submitted, READ_CALENDAR and WRITE_CALENDAR are in the group of "dangerous".

Look at this reply to know how to deal with them.

  • Can you tell me when I should use READ_CALENDAR or WRITE_CALENDAR? I’m using it as a precaution because I use Calendar.getInstance();

  • Permissions READ_CALENDAR and WRITE_CALENDAR are only required when the user’s calendar data is accessed/modified. The Calendar class has nothing to do with it, it serves to manipulate "instants in time", so it does not need these permissions.

  • Thank you very much!!! Now I understand perfectly!

  • Thank you very much!!! Now I understand perfectly!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.