如何prevent短信会在Android的奇巧到收件箱 [英] How to prevent SMS going to inbox in Android Kitkat

查看:106
本文介绍了如何prevent短信会在Android的奇巧到收件箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在android的,我们可以通过下面的code座短信previous版本:

In previous versions of android we could block SMS by using following code:

 <receiver android:name=".broadcastreceivers.OnSMSReceived"
                  android:exported="true" android:permission="android.permission.BROADCAST_SMS">

            <intent-filter android:priority="1000">
                <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
            </intent-filter>
        </receiver>

和广播接收器,abortBroadcast()函数prevent短信无法进入收件箱。 但这种方法是不工作在奇巧如,从奇巧短信将仅由默认SMS应用程序被接收。有没有什么解决办法创造奇巧短信拦截器的应用程序?

and in broadcast receiver, abortBroadcast() function prevent SMS from going to inbox. But this method is not working in kitkat as, from Kitkat SMS will only be received by default SMS app. Is there any workaround to create SMS blocker app in kitkat?

推荐答案

您应该阅读此页:<一href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html">http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html

一个变化是奇巧,只允许一个应用程序的时间(默认短信应用程序)来对短信写权限数据库,并能使用它介绍。

A change was introduced in KitKat that only allows one application at a time (the default SMS app) to have write permissions on the SMS DB and to be able to consume it.

您有2种方式解决你的问题的:

You have 2 ways of solving your problem:

  • 请就如何要求用户的默认短信应用程序切换到应用程序中,当你需要进行更改(当时谷歌的意见,一旦你完成这样做,允许用户切换回原来默认的SMS应用程序)。

  • Follow Google advice on how to request the user to switch the default SMS application to your application during the time when you need to perform your changes (and once you finish doing it, allow the user to switch back to the original default SMS app).

查找临时哈克的方式做你需要做的。作为一个暗示,有一个隐藏的API:<一href="http://developer.android.com/reference/android/app/AppOpsManager.html">AppOpsManager#setMode你可能会利用为了给您的应用程序的写权限(OP_WRITE_SMS),头部到这个XDA页面,了解更多关于它:<一href="http://forum.xda-developers.com/showthread.php?t=2551072">http://forum.xda-developers.com/showthread.php?t=2551072

Find a temporary hacky way to do what you need to do. As a hint, there is a hidden API: AppOpsManager#setMode that you could potentially exploit in order to give your application write permissions (OP_WRITE_SMS), head over to this XDA page to learn more about it: http://forum.xda-developers.com/showthread.php?t=2551072

不用说,任何哈克溶液只是暂时作为私人/隐藏的API可以改变在任何时刻。我们强烈鼓励实施什么谷歌建议我们实现这再次说明<一href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html">here.

Needless to say, any hacky solution is just temporary as a private/hidden API could change at any moment. It is strongly encouraged to implement what Google advised us to implement which again is described here.

这篇关于如何prevent短信会在Android的奇巧到收件箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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