You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.
This is a fantastic code lab - and even as a beginner Android developer I have been able to understand the guide very well.
But - as I am about to 'hit the switch' on setting my application as the device owner, something inside me yells out, "Oh no! What happens if I have made a mistake! How do I set my device back to normal?! Especially if my function that sets the COSU policy to false never runs!".
Assuming that the developer just wants to create a nice Android kiosk, and still allow developers full access to change things how they wish, how do we alleviate the novices' concerns?
The text was updated successfully, but these errors were encountered:
So, as I am living this experience, maybe my personal journey could help!
I set the device administrator to my application.
However - unlike the default application, my application has only one activity (the one I want pinned).
During some testing, when the COSU settings were unset, my applications launch Intents were no longer registered, and I could not relaunch my application through Android Studio.
I also could not remove the application (as expected), because it is a device administrator.
Now, I assume I could have relaunched my specific Activity some other way, but skipping this, I performed a factory reset on my device, because I know that will take me back to square one.
So, just so other beginners are aware - once you set a device owner, you cannot set a different administrator over adb. You must factory reset.
In this respect, if you are only testing your application, in the setDefaultCosuPolicies function, make sure you change setUserRestriction(UserManager.DISALLOW_FACTORY_RESET, active);
to setUserRestriction(UserManager.DISALLOW_FACTORY_RESET, false); // ALWAYS ALLOW FACTORY RESET
Then, when you are certain that your application works as desired, you set it back to active.
You can use mDevicePolicyManager.clearDeviceOwnerApp("com.example.yourapplication"); somewhere in your code that will unset the device owner. You should then be able to re-debug or develop your application, without going through the full factory reset.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there.
This is a fantastic code lab - and even as a beginner Android developer I have been able to understand the guide very well.
But - as I am about to 'hit the switch' on setting my application as the device owner, something inside me yells out, "Oh no! What happens if I have made a mistake! How do I set my device back to normal?! Especially if my function that sets the COSU policy to false never runs!".
Assuming that the developer just wants to create a nice Android kiosk, and still allow developers full access to change things how they wish, how do we alleviate the novices' concerns?
The text was updated successfully, but these errors were encountered: