由网友(失控的情绪)分享简介:我需要我的应用程序时,有一个新电子邮件,短信或电话通知作出反应。我可以使用NotificationManager创建通知,但不能从其他应用程序读取。我已经看过AccessibilityManager,但我不能完全明白这一点无论是。任何指针或例子?谢谢解决方案 电子邮件。我不认为你可以使用非标准库做到这一点。也许它有意识...![关于启动防汛Ⅳ级应急响应的通知](https://p.xsw88.cn/allimgs/daicuo/20230906/3487.png)
我需要我的应用程序时,有一个新电子邮件,短信或电话通知作出反应。
我可以使用NotificationManager创建通知,但不能从其他应用程序读取。
我已经看过AccessibilityManager,但我不能完全明白这一点无论是。
任何指针或例子?谢谢
解决方案 电子邮件。我不认为你可以使用非标准库做到这一点。也许它有意识寻找第三方API 短信。您shuold使用BroadcatReceiver行动=android.provider.Telephony.SMS_RECEIVED CALL。使用PhoneStateListenerTelephonyManager telephonyManager =(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
telephonyManager.listen(新PhoneStateListener(){
@覆盖 公共无效onCallStateChanged(INT状态,弦乐incomingNumber){ //做未便 }},PhoneStateListener.LISTEN_CALL_STATE);
I need my app to react when there is a notification about incoming email, sms or call.
![关于启动防汛Ⅳ级应急响应的通知](https://p.xsw88.cn/allimgs/daicuo/20230906/3487.png)
I can use the NotificationManager to create notifications, but not read them from other apps.
I have looked at AccessibilityManager, but I can't quite figure that out either.
Any pointers or examples? Thanks
解决方案 Email. I don't think you can do it using standart libraries. Probably it has sense to search third party API SMS. You shuold use BroadcatReceiver for ACTION ="android.provider.Telephony.SMS_RECEIVED" CALL. Use PhoneStateListenerTelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
telephonyManager.listen(new PhoneStateListener() {
@Override
public void onCallStateChanged(int state,String incomingNumber) {
//do smth
}
}, PhoneStateListener.LISTEN_CALL_STATE);
相关推荐
最新文章