PanicInitiative / PanicButton

Panic Button turns your mobile phone into a secret alarm for when you're in trouble
https://panicbutton.io
GNU General Public License v3.0
200 stars 99 forks source link

Implement android 6.0 permissions API #203

Open niccs opened 8 years ago

niccs commented 8 years ago

Requesting permissions at runtime

niccs commented 8 years ago

@jmatsushita ,

Now as per android 6.0, we need to implement runtime permissions. So we need to identify, when to ask for permission.

We are using two permissions SEND_SMS and location services in PB. Please let me know at what point do we ask user for permission. 1) After the install, as the user starts doing set-up, before adding the contact ? 2) and we need text, which should be displayed to ask for permission.(Explain why the app needs permissions)

I will prioritize this to work into, as soon as you reply,

niccs commented 8 years ago

Hi @jmatsushita As per android standards, we must check whether we have all permissions every time user performs an operation that requires that permission. The user is always free to revoke the permission from settings, so even if the app used the send alert yesterday, it can't assume it still has that permission today.

So here us the proposed flow:--

A) First time configuring the app 1) User click setup and goes to next warning screen , if permissions are already on. 2)If not , it asks sms and location permissions 3) if granted, goes to next warning screen 3) If not granted -- ?? (what will be the flow)

since in android 6 user can manually disable the permissions from setting,so after setup, when we start the app, there also we need to ask for permissions.

1)User opens app(calculator screen) 2) after long press goes to login screen. 3) after password approval, checks for permissions. 4) if already present-- normal flow 5)if not present, asks for permission--if granted normal flows 6)if not granted --??

Also, One more use case is:--in case permissions are disabled manually.... In panic situation, we can not ask user's intervention to give permissions,when he tries to activate alert from disguise screen(without unlocking). as per earlier versions, we assume that location services are on and permission are given.

niccs commented 8 years ago

@jmatsushita,

Further to this, I am following below steps :--

During Setup Flow:--

1)SMS and location services should be asked in continuation. If both permissions are granted then only setup process is continued.

2)In case any one of the permissions is not granted by user,setup process is not continued.

3) if first time, user denies permission, next time a (asynchronous)toast message is shown "SMS & Location services permissions are required to send the alert message with your location coordinates, in case of emergency" and with that permission is requested again.

niccs commented 8 years ago

Hi @jmatsushita ,

Here is the detailed permission implementation flow, as per android design guild lines.Please give your inputs, so that I can work on this further.

FYI-- The following work flow is during the first time setup of the app.

image

Step 1:-- We are checking for permissions (two permissions) as soon as user clicks SETUP Step 2: Does the user have both permissions?? Step 2 (YES)—both the permissions are already granted goes to step 6...(normal flow continues). Step 2-No –go to Step 3 for another check Step 3:- User has been asked permission before?? Step 4:-- (No from Step 3), we display permission dialog for the permissions which are not granted. . (Generic android message dialog will come--( Allow calculate! to access the device’s SMS messages) and (( Allow calculate! to access the device’s location). Step 5: (Yes from Step 3), Further check more--“Dont ask again”--has been checked ?? If Step 5 is “No”— In this case, user is confused or not clear as of why he is denying permission. So we need to give detailed message to user, to tell, why these permissions are important for the app. Go to step -4 and keep asking again permissions which are not granted . This is covered in this link-- Explain why the app needs permissions

If Step 5 is “Yes”—since the “Dont ask again” checkbox is clicked, we cannot ask permissions again as per android design guidelines. So either we quit the app, or install the app, stating user that “he needs to go to Settings to activate the permissions, for the app to function properly)

I need your inputs here:--

**So for Step 5 (Yes case, and no case), we need messages to display to users.

  1. A detailed message showing why this permission is important and then request again.
  2. If user selects “Dont ask again”, we need a message to show, “Please go to Settings and grant the permissions”
  3. In case use denies permission, what should be flow?? Do we quit or install the app??**

Assumption:--

  1. Both the permissions are considered equally important. So both the permissions should be given for (Step-5-Yes case) and if any one permission is not given, it comes in (STEP 5-No case)

These can be toast messages or my preference is for using snackBar messages

Also, Even after the installation of app, user can revoke the permissions manually from settings. So we need to consider the flow, of asking permissions from Login screen too.