我想实现一个基本的想法,在android中制作资产负债表.如果我在我的号码拨号屏幕上写*#*#1234#*#*,那么它必须在我的应用程序中增加34(或者可能在文本文件中).为了实现这个想法,我遇到了androID.provIDer.Telephony.SECRET_CODE.
我想要的是从手机的拨号盘读取任何数字,如*#*#< number>#*#*.因此,我希望我的代码以某种方式运行,以便将此格式的任何代码标识为密码:*#*#12 $$#*#*.我想很难想象它是否有任何可行的方法,但如果有人知道的话,我会非常好奇地知道.非常感谢提前!
解决方法:
http://blog.udinic.com/2013/05/17/create-a-secret-doorway-to-your-app
检查此链接.
这是一段代码示例.在您的清单中,声明您的接收器并使用密码,例如:111222
<receiver androID:name=".receiver.DiagnoserReceiver"> <intent-filter> <action androID:name="androID.provIDer.Telephony.SECRET_CODE"/> <data androID:scheme="androID_secret_code" androID:host="111222"/> </intent-filter></receiver>
然后创建接收器:
public class DiagnoserReceiver extends broadcastReceiver { public voID onReceive(Context context, Intent intent) { if ("androID.provIDer.Telephony.SECRET_CODE".equals(intent.getAction())) { //Do your increment here } }}
我想如果你想要多个数字,你可以添加你的应用会监听的代码变体:
<intent-filter> <action androID:name="androID.provIDer.Telephony.SECRET_CODE"/> <data androID:scheme="androID_secret_code" androID:host="111222"/> <data androID:scheme="androID_secret_code" androID:host="1234"/> <data androID:scheme="androID_secret_code" androID:host="1235"/> <data androID:scheme="androID_secret_code" androID:host="1236"/> <data androID:scheme="androID_secret_code" androID:host="1237"/></intent-filter>
编辑:
你可以试试这个SO post I found
only to match the beginning of host. The rules are these:
Put * as the first character of the host.Write the rest of of the host until the end.
androID:host="*site.com"androID:pathPattern=".*"androID:scheme="http" />
It will catch links of:
www.site.comsite.commail.site.com
所以你应该能够通配符的字体
<data androID:scheme="androID_secret_code" androID:pathPattern="*" androID:host="*34"/>
理论上它应该适用于0034 … 9934
**小心:**
任何人都可以反编译您的应用并查看清单文件中的代码.所以无论你做什么,都要确保它是安全的. IE浏览器.如果您从接收方打开活动,请确保活动首先要求输入密码.
总结以上是内存溢出为你收集整理的使用android.provider.Telephony中的SECRET_CODE全部内容,希望文章能够帮你解决使用android.provider.Telephony中的SECRET_CODE所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)