Search code examples
androidkotlinadb

Old Android phones have developer mode activated by default


I need a bit of help with Android devices that are very old. What I am trying to do ( programmatically ) a factory reset, and ask user after the factory reset finishes to activate developer mode. ( The user need's to go throw all the steps required by the phone ). Once the developer mode is enabled I can install an app on the smartphone.

Here I am making an infinite loop (because I don't know how much time the user need's to activate developer mode (again) after the factory reset) that will do an "adb devices" and based on the return value I can decide if to install the mobile app or not.

For devices that are above 6.0.1, everything is good. But for devices that are below this version. After the factory reset, on the mobile screen, I am seeing this:

After factory reset I see this pop-up:

enter image description here

When I expect only this: enter image description here

On the Android devices above 6.0.1 that pop-up I am seeing it only after developer mode was activated. Can someone tell me how can I check for these old devices if the user had

I had tried to disable developer mode:

adb shell settings put global development_settings_enabled 0
adb shell pm clear com.android.settings
adb shell am force-stop com.android.settings

But nothing worked. Please help.


Solution

  • Damn, even in this state ( the first picture ). I can install my app on the phone and launch it. I am totally mesmerized.