If your BroadcastReceiver is registered on main thread(UI thread), then it will be killed after 10 seconds. You can read about it here.
If you wan't to do something which takes much time you have two options:
- Use another thread for receiver
- Start a
Service
from your onReceive and perform long-running task within aService
.
I would go with second option. That'll give you more clean and flexible architecture.
UPD
More on Services here.
There's a range of options with Services. So I sugges you to learn more about Service lifecycle and then choose what fits best for your problem.