After I Press Home Button Scheduledexecutorservice Does Not Run In The Background
I have created this in onCreate() and after I press home button ; ScheduledExecutorService does not run every 10 mins in the background.Why ? Where is the mistake. Please help
Solution 1:
I think that AlarmManager is more well suited to repeating a task every 10 minutes than Executor is.
I would suggest setting up an AlarmManager and using a BroadCast receiver to "catch" the trigger that it fires, and inside your onReceive() method you can do whatever you like, including start your mp3. I think this way will work better for you, especially if you are intending for you sound to play even if your application is not currently the Active app on the device.
Post a Comment for "After I Press Home Button Scheduledexecutorservice Does Not Run In The Background"