Answer the question
In order to leave comments, you need to log in
How to start AlarmManager from foreground service?
I am writing an application in which the service constantly works in the background. There is an activity, but it is assumed that the user closes it for a long time. The essence of the problem: at some time, information comes from the server, which is processed by the background service. Having processed, it is necessary with the help of AlarmManager'a to put the task to be executed after some time. For example, an hour later, display an alert. I can't figure out how to do this, please help. I've known android for a week.
Answer the question
In order to leave comments, you need to log in
The AlarmManager can just be a local variable. You only need it to "start" the alarm clock.
AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question