I’m thinking of broadcasting an Intent from my MainActivity to be received by SomeReceiver, then register a new alarm somewhere in onReceive() which fires an Intent that SomeReceiver will again catch. Is that possible? How do I overwrite the old alarm with the new one and make sure the old one is killed or unregistered?
UPDATE: The MainActivity will not be open at all times and the Alarm will need to keep being fired nonetheless.
First call of alarm is depends on your logic. For next alarm you should reschedule alarm in onreceive of receiver. You are right you need to call
set(). Repeating time in not fixed? If yes then go ahead. U r on right track. But if repeating time is fixed, then you should usesetRepeating().