Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions for the e-mission-phone app on Android 11 does not incite to allow background location #608

Closed
PatGendre opened this issue Jan 28, 2021 · 6 comments · Fixed by e-mission/e-mission-data-collection#192

Comments

@PatGendre
Copy link
Contributor

Hi @shankari
This is not a bug but for FYI
I forward an issue made by Maël of Fabrique des Mobilités when he installed our tracemob e-mission app : When he first went through the setup screen, he didn't see the green link to enable permanent access to the location API (via the app parameters).
This way of presenting the permissions seems new on Android11 (my permissions screen show equally the authorization for background location than for foreground)
permission-screen

"This is Android 11 on a Samsung S10e. As you can see, a user that is impatient to test the app will click on the most obvious link "only when the application is open", which makes the whole app unusable without any message. I had to reset the app data, remove, reinstall, and set the permssion correctly to make it work again.

This may have been explained in the text, but I didn't care to read it (too much) and I believe it might be the case for most people."

@shankari
Copy link
Contributor

shankari commented Jan 28, 2021

@PatGendre Let me test on android 11, at least on the emulator. I believe that if we don't have the "always" permission on android, the app will generate a prompt periodically (~ 1 hour) asking to turn on the always permission. Can Maël reinstall with "only while using the app", see if he gets the notification and see if it works to turn on the "always" permission?

Just want to know the extent of the problem for setting parameters correctly....

@PatGendre
Copy link
Contributor Author

@shankari thanks, I asked Mael to test. The app was not working well when with the "only while using the app" permission, and worked with the background location on, but I cannot tell you the exact behavior wrt notifications.

@laem
Copy link

laem commented Feb 3, 2021

Yes, I first tested with the "only while in use" option, and it resulted in a blank screen, the app was not usable.

@shankari
Copy link
Contributor

shankari commented Jun 4, 2021

@laem @ericafenyo @PatGendre I plan to fix this soon - it was reported by another tester, and one who is not an early adopter. I will test on the emulator, of course, but would you be able to test on a real phone?

@shankari
Copy link
Contributor

shankari commented Jun 5, 2021

So in android 11, it is apparently possible to go to the location permissions screen directly, but if the user does not accept it, then you can never use it again.
https://stackoverflow.com/a/64282458/4040267

I will explore that in greater detail once I switch to API 30. For now, if the android version is > 29, I will just bring up the app permission screen instead of prompting the user. That seems like a fairly simple change to make and will not require me to migrate to API 30 and deal with any regressions.

https://stackoverflow.com/a/32983128/4040267

shankari added a commit to shankari/e-mission-data-collection that referenced this issue Jun 5, 2021
…tion permission

This makes it easier to set the permissions instead of having people select
"when in use" first and then have to go to the app settings later to fix it.
This fixes e-mission/e-mission-docs#608
at least for now
@shankari
Copy link
Contributor

shankari commented Jun 5, 2021

Alas, this is not quite as simple. Simply launching the app settings does not fix the issue of having to know when the settings have been changed, and kicking the FSM to detect that.

So the behavior was:

  • launch the settings, user selects "always", come back to app, still in start state
  • launch the settings, user selects "while using", come back to app, still in start state, no error notifications

Fixed this by using startActivityForResult. This took a while to get working because I didn't call cordova.setActivityResultCallback first. Doh!

After setting the callback, we are now notified when the user returns from the settings screen. We then cancel any notifications that are no longer relevant, and re-run the checks.

New behavior:

  • launch the settings, user doesn't change anything, come back to app, error about location permission, click
  • launch the settings again, user switches to "when in use", come back to app, error about background permission, click
  • launch the settings again, user switches to "always", come back to app, no additional errors, now in waiting_for_trip_start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants