I used the AlarmManager as such ,
Intent intent = new Intent(G.context, ActivityAlarm.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(G.context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
I don't want to open an Activity just execute a static/non-static method during this time interval.
Intent intent = new Intent(G.context, **my method**);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(G.context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Is it possible to achieve this using the AlarmManager?
There are other ways to do this task:
1) Simple Thread
2) Timer or Timertask
3) ScheduledExecutorService
For more details see here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.