Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch app on incoming call (android)

Tags:

android

I have an app on Android that reacts to incoming calls. Now, since the OS shuts my app down whenever it want, I need a way to to listen to the incoming calls and launch the app when it happens.

Will a BroadcastReceiver help? (just like launching on device restart)

Any idea?

thanks!

like image 253
taxman Avatar asked Feb 25 '26 07:02

taxman


1 Answers

I think you have answered your own question. This is just the sort of thing a broadcast receiver is meant for. If the receiver is registered in your manifest then the application does not have to be running.

It will be automatically started when a matching intent is broadcast. Typically the response will be to update content or activities, make notifications with the Notification manager or launch/manipulate services.

Note that there is a 5 second execution limit in the BroadcastReceiver onReceive handler to ensure you do not try to do any 'heavy lifting' in it. Exceed this and a force close dialog will be displayed.

like image 198
Kevin Avatar answered Feb 28 '26 09:02

Kevin