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

Auto Start app after the restart of the device or can you help me with the process of setting up the app as device owner #3

Open
Arpit980jai opened this issue Dec 12, 2024 · 2 comments

Comments

@Arpit980jai
Copy link

Hello trying to autostart the app after the restart but unable to do it , this package is completely working for pining the app once pinned it works fine but as soon as i restart the device it gets unpinned.

boot receiver.kt
boot Reciver kt

Android Manifest Xml file
manifest1
manifest2

Main Activity.kt
mainActivityKt

@Arpit980jai
Copy link
Author

Also is there any way to disable the popup when user pin the application

@georgihad
Copy link

"Pinning" is only used if normal kiosk mode is not possible. To get kiosk mode (lock task) properly working, you'll have to do the things explained here:
https://pub.dev/packages/flutter_lock_task

You will have to add some stuff to "yourProject/android/app/src/main/AndroidManifest.xml" and you will have to create a file "yourProject/android/app/src/main/res/xml/policies.xml". It's explained in the page I linked.

To set up device owner, you have to:
First, delete any accounts on the device. Then download adb and run it like this:

./adb shell dpm set-device-owner com.example.your_app/flutter.lock.task.flutter_lock_task.DeviceAdmin

Where "com.example.your_app" is your app name.

Remember, once you do this, you will not be able to undo it without factory reset of the device. You will not be able to set a different app as owner. You can only install newer versions of the same app, compiled using the same keys. I recommend working in an android emulator first until you get everything ready, because you can easily set up a new emulator if things go wrong.

If you do everything correctly, you will no longer be asked to "pin" the app.

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

No branches or pull requests

2 participants