Android Question Test if receiver is started

John Naylor

Active Member
Licensed User
Longtime User
If I start a receiver to fire every hour....

B4X:
    Dim t As Long = DateTime.Now + 60 * DateTime.TicksPerMinute        'Fire the next receiver in 60 minutes from now
    StartReceiverAt (MyReceiver, t, True)

how can I test that it has been started?

I tried ispaused(myReceiver) but that returns True whether I've done the above code or not (makes sense).

I could add a Boolean called Started in the receiver and keep careful tabs on whether it returns true of false but that means I have to explicitly set it. Is there a way I'm missing?

Also if the receiver has actually been set, can I cancel it? Again I could get it to be skipped using the boolean value but is there's an easier way...?

TIA
 
Last edited:
Solution
I think that you are confusing "started" with "scheduled". You will need to track the scheduled state. Also remember that the process can be killed and restarted so it needs to be persisted (KVS can help).

You can use CancelScheduledService to cancel a scheduled receiver.

John Naylor

Active Member
Licensed User
Longtime User
I think that you are confusing "started" with "scheduled". You will need to track the scheduled state. Also remember that the process can be killed and restarted so it needs to be persisted (KVS can help).

You can use CancelScheduledService to cancel a scheduled receiver.
Indeed. Thankyou @Erel much appreciated
 
Upvote 0
Top