We recently integrated with Crashlytics in Firebase and found that our app was facing this crash:
Fatal Exception: java.lang.SecurityException
get application info: Neither user 1010170 nor current process has
android.permission.INTERACT_ACROSS_USERS.
android.os.Parcel.readException (Parcel.java:1540)
android.os.Parcel.readException (Parcel.java:1493)
android.app.IAlarmManager$Stub$Proxy.set (IAlarmManager.java:214)
android.app.AlarmManager.setImpl (AlarmManager.java:414)
android.app.AlarmManager.set (AlarmManager.java:213)
The code that is causing this is:
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
if (pendingIntent != null) {
AlarmManager alarmManager = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+triggerAfterMillis,
pendingIntent);
I have tried searching for this in various different places and forums but couldn't get anything fruitful yet.
Could anybody help me establish a relation between AlarmManager and INTERACT_ACROSS_USERS permission and how to solve this?
Note: This is happening majorly on devices running Android 5 and above.