2

I am getting:

java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.TIME_SET from pid=xxxxx, uid=xxxxx

for:

Intent timeChanged = new Intent(Intent.ACTION_TIME_CHANGED);
sendBroadcast(timeChanged);

even when I have put my app in /system/app folder. Please help me out to know why this is happening?

Rohit
  • 475
  • 4
  • 18
  • You need to be signed with a system cert don't you? rather than just be in the folder – Blundell Mar 04 '20 at 09:22
  • @Blundell Is there any way to obtain system certi file? Or, if you know of any way around? – Rohit Mar 04 '20 at 13:24
  • 1
    If you are included in the /system/app folder, then you must be building the rom? or know the team builing the rom? They have the certs – Blundell Mar 04 '20 at 16:08
  • I included the certi. Still facing exact same problem both on debug and release. – Rohit Mar 04 '20 at 22:55

2 Answers2

0

Try putting the app in the priv-app folder in the system partition, and adding the app to the privapp-permissions.xml file on the same partition, with the TIME_SET permission.

Vitaliy
  • 291
  • 1
  • 14
0

Please come here: Permission Denial of android.intent.action.REBOOT for APP in /system/priv-app. To get the most recent version of the code, just replace "android-5.1.1_r20" with "master").

It seems the app must be a persistent app, which can be done by setting the persistent flag to true on the Application tag of the Manifest. Either that, or have a UserId whitelisted, which is also on the code (though, sharedUserId is deprecated as of API 29, so might not be a good idea to use that way).

Edw590
  • 447
  • 1
  • 6
  • 23