在处理Android应用程序的来电 [英] Handling Incoming calls in android application

查看:103
本文介绍了在处理Android应用程序的来电的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发出一种音乐相关的Andr​​oid应用程序。我在处理对呼入的媒体播放器的一个问题。我想phonecall期间暂停音频,恢复回呼叫被结束之后。我需要建议是否使用TelephonyManager与onstatechanged暂停和恢复音频(OR)任何其他方法来暂停,并在来电恢复应用程序本身。

I have developed a music related android application. I have a problem in handling the mediaplayer on incoming call. I want to pause the audio during the phonecall and resume it back after the call gets ended. I need suggestions whether to use TelephonyManager with onstatechanged to pause and resume the audio (OR ) any other methods to pause and resume the application itself during Incoming calls.

推荐答案

使用的onPause() onResume()在您的活动方式。当有来电来了,在onPause()方法被调用。和onResume()被调用时通话挂断了电话。

use onPause() and onResume() methods in your activity. When an incoming call comes, onPause() method is called. and onResume() is called when call is hung up.

如果用户点击了其他一些应用程序发送通知这甚至会工作。

This will work even if the user clicks on a notification sent from some other app.

这篇关于在处理Android应用程序的来电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆