开发者

How can I resume an Android app that was running if any call came to that phone

I am working with bluetooth application. After running the app two bluetooth enabled devices are getting connected. But if in t开发者_JAVA技巧he mid time any call came then the bluetooth automatically disconnected. But it should not be like that. How can I resolve this problem?


You probably need to move your Bluetooth communication code into a Service: the only time this should happen is if your app's Activity is getting paused or destroyed when the call comes in. If you move the Bluetooth communication code into a Service then it will continue to run in the Background even when the Activity is paused or destroyed.

You can use PhoneStateListener in your Service to determine when the call ends and then relaunch your Activity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜