反应在Android的传入消息 [英] React to an incoming message in android
本文介绍了反应在Android的传入消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经得到了项目,开发一个应用程序在我的Android手机响起时,它是响亮在静音模式下来电短信。我不要求任何来源$ C $ CS。我只是想知道如何与这个继续。
I have got the project to develop an app where my android phone rings loud when it is in silent mode by an incoming SMS. I am NOT asking for any source codes. I just want to know how to proceed with this .
推荐答案
ü需要注册传入短信接收器
u need to register receiver for incoming sms
public class SmsReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
//play ringtone here
}
}
播放铃声参考这里&安培; 这里和<一个href=\"http://stackoverflow.com/questions/4162230/how-do-i-play-an-mp3-in-the-res-raw-folder-of-my-android-app\">here
for playing ringtone refer here & here and here
*注意:不要忘记在清单文件的权限
*note: dont forget to include permission in Manifest file
<uses-permission android:name="android.permission.SEND_SMS"/>
和接收器部分:
<receiver android:name=".listener.SmsListener">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
这篇关于反应在Android的传入消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文