androidfluttergoogle-account

Flutter App - Preventing Google Prompts from Taking Over The Screen


I have a flutter app that is designed to be placed as a fixed camera and based on what it sees give commands for IOT purposes.

To prevent it from sleeping, I am using a library called wakelock. (https://pub.dev/packages/wakelock)

Unfortunately, this doesn't prevent another issue, Google Prompts. When I log into my developer account on my laptop, the development phone is taken over by the prompt asking "Are you trying to sign in?"

I don't really want to have the solution be to log out of google on the phone, since the app is downloaded and updated via the play store.

I also don't want to disable 2F authentication, just don't want it to take over this developer phone, it's fine if it does so on my personal phone.

So a google settings solution, or a flutter code solution would be really helpful, have been able to find neither.

TLDR: I tried having the android phone as a 24/7 IOT camera with my flutter app, and was expecting it to stay on, but it was interrupted by the Google Prompt.


Solution

  • The easiest solution seem to me to set up a separate google account; this way the app could continue to be updated from the Play Store without being tied to your personal account, so you shouldn't receive 2fa prompts.

    Another thing that might help is "Pinning" the app, which doesn't allow the app to be exited without authentication.

    If neither of those work, a more advanced option could be to set up the phone with device management and use the lock task mode, but the work involved with setting that up is probably prohibitive for your use-case.