Update: I've replaced with the native Java timer/timer task or ScheduledExecutorService and it works well. Both of them spins off a new thread which survives onHandleIntent termination unlike handlers which is attached to the thread that created it. So if you create a new handler in the intent service onHandleIntent, the handler dies when onHandleIntent finishes executing.
Update: Alternatively, as suggested by David Young, create the handler on a separate thread (eg: instantiating the handler as a class variable in a singleton class running on a main thread or separate service) before invoking its methods when AltBeacon didEnterRegion/didExitRegion is called. Whatever you do, do not create a new handler object with post delayed within onHandleIntent as the handler will be attached to the intent service thread and die with it when it finishes executing, thereby not executing the runnable in post delayed.
ScheduledExecutorService is advocated as opposed to the native timer/timer task for reasons stated in Java Timer vs ExecutorService?.
private static final ScheduledExecutorService mWorker = Executors.newSingleThreadScheduledExecutor();
@Override
public void didEnterRegion(Region region){
new Timer().schedule(new TimerTask(){
@Override
public void run (){
// remember to free timer after using it
// it runs after didEnterRegion finishes execution, and after 60 seconds
}
}, 60000);
}
@Override
public void didEnterRegion(Region region){
mWorker.schedule(new Runnable(){
@Override
public void run (){
// it runs after didEnterRegion finishes execution, and after 60 seconds
}
}, 60000);
}