Menu

dpm set-device-owner Launches the App Before prefs Is Set
📰

dpm set-device-owner Launches the App Before prefs Is Set

DEV Community: android·cometa-kaito·about 5 hours ago
#u42ejJC1
#devtoandroid#devto#dev#device#owner
Reading 0:00
15s threshold

Bottom line

dpm set-device-owner is not a command that merely grants a privilege. The instant it succeeds, it launches the target app. If that launch happens before the app's config file (prefs) holds the real device_id , the app sees nothing but an empty config and mints and saves a new id for itself. Worse, once the app is device owner, the usual fix — force-stop — no longer reliably kills it.

Symptom

The provisioning script that turns a factory-reset Google TV into a kiosk unit ran in this order:

Install the kiosk app

Grant device ownership with dpm set-device-owner

am force-stop the app

Write a prefs file containing the correct device_id , delivery URL, and so on

Read prefs back with run-as right after writing, to confirm the value landed

Step 5's read-back always succeeded — reading a value right after writing it is supposed to show what you just wrote.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.