0

I am developing a device owner app. In the app I'm trying to gain the SET_TIME permission by using:

DeviceOwnerHelper.getInstance().getDevicePolicyManager().setPermissionGrantState(new ComponentName(this, DeviceOwnerReceiver.class), getApplicationContext().getPackageName(), Manifest.permission.SET_TIME, DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED);

But this method does not work? Please help!

Antonio Vlasic
  • 337
  • 3
  • 15

1 Answers1

2

You need to run your app as system/app in order to achieve that. In short a short way to say it you have to run your app under the folder /system/ or system/priv-app in some devices.

I am setting the time in my app using the shell with this command: (I have root access)

adb shell su 0 date -u [timethatyouwant]

edit: I typically use this commands to run my app as system/app

Don't know if I helped :p just look for it ;)

Tomás Rodrigues
  • 519
  • 2
  • 17