3
ich diesen seltsamen Absturz zu bekommen. Es scheint wie AlarmManager.set() Ursache , aber ich verstehe nicht, wie und warum.Security: Holen Anwendung Info: Weder Benutzer 1.010.069 noch laufender Prozess hat android.permission.INTERACT_ACROSS_USERS
Stapelüberwachung:
Fatal Exception: java.lang.RuntimeException: Unable to create application com.rotem.appmanager.app.MainApplication: java.lang.SecurityException: get application info: Neither user 1010069 nor current process has android.permission.INTERACT_ACROSS_USERS.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4560)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5258)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:974)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
Caused by java.lang.SecurityException: get application info: Neither user 1010069 nor current process has android.permission.INTERACT_ACROSS_USERS.
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:215)
at android.app.AlarmManager.setImpl(AlarmManager.java:409)
at android.app.AlarmManager.set(AlarmManager.java:208)
at com.rotem.appmanager.app.DailyAppTasksHelper.scheduleNextDailyAlarm(SourceFile:81)
Der Code:
Context context = MainApplication.getAppContext();
Intent intent = new Intent(context, PrepareAppService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, CommonConfig.PendingIntentRequestCodes.ALARM_SCHEDULE_SELF_UPDATE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// cancel any existing alarms
alarmManager.cancel(pendingIntent);
// Set the alarm to start at approx. 14:00
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 14);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
`
Ich möchte nicht auf das Add diese Berechtigung.
Wie kann dies verursacht/reproduziert werden?
Es ist Signaturniveau Erlaubnis helfen. Sie sollten also 'android: protectionLevel =" signature "' in der Manifest-Datei hinzufügen und wenn Ihre Ziel-API '23' ist, sollten Sie die Laufzeit-Berechtigung verwenden. – Piyush
Ihr Code sieht ziemlich harmlos aus. Vielleicht verursacht etwas anderes in Ihrem Projekt das Problem. Check out [this post] (http://stackoverflow.com/questions/20578474/permission-denial-this-requires-android-permission-interact-across-users-full): einige andere Entwickler hatten dieses Verhalten aus sehr unterschiedlichen Gründen und schaffte es, es auf die eine oder andere Weise zu reparieren. – 0X0nosugar