Android Things: How To Exit Android Settings Screen?
I succeed to show Android Date Settings by calling : startActivityForResult(new Intent(android.provider.Settings.ACTION_DATE_SETTINGS), 0); but I don't know how to exit, there is
Solution 1:
In order to close Android's settings app you can either send a back button press event
adb shell input keyevent 4
or force close the settings app
adb shell am force-stop com.android.settings
Or send an input event programmatically
Runtime.getRuntime().exec("input keyevent 4");
Just keep in mind that your app goes to background when the Android settings app gets started "hiding" your app's UI. You'll need to figure out how to trigger the programmatic solution.
Solution 2:
In your code just start some activity and it will overtake the settings screen.
For example, if u open settings screen to enable Location, u set a broadcast listener to On Location status change. The moment user enables location, you'll receive broadcast and there u start your activity. The settings screen will automatically close.
Post a Comment for "Android Things: How To Exit Android Settings Screen?"