Reputation: 577
I'm trying to create a method that will execute or run every 24 hours. What I exactly want to do is to delete the data from my database table "history" every day at 9am. I searched how to make this and I found an alarm manager but it works with PendingIntent. Is there any way to use alarm manager that handle a method instead of pending intent?
Upvotes: 0
Views: 521
Reputation: 3925
A PendingIntent is a token that you give to a foreign application (e.g. NotificationManager, AlarmManager, Home Screen AppWidgetManager, or other 3rd party applications), which allows the foreign application to use your application's permissions to execute a predefined piece of code.
If you give the foreign application an Intent, and that application sends/broadcasts the Intent you gave, they will execute the Intent with their own permissions. But if you instead give the foreign application a PendingIntent you created using your own permission, that application will execute the contained Intent using your application's permission.
So you can't use the AlaramManager without using the PendingIntent.
Upvotes: 1