内置拨号盘暗码,启动应用

时间:2020/08/31
之前公司不允许csdn,笔记写在其它地方。最近整理过来

暗码启动方式有2种:

1、监听android自带的广播,设置对应的暗码,接收到广播后启动应用。
2、自己监听拨号盘输入内容启动应用。

广播方式

1、 AndroidManifest.xml文件配置,注册一个receiver,添加Intent过滤条件

<receiver android:name="Me">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE"/>
<!-- *#*#1024#*#* -->
<data android:scheme="android_secret_code" android:host="1024"/>
</intent-filter>
</receiver>

2、 创建类接收广播

在收到Intent的action为“android.provider.Telephony.SECRET_CODE”时启动应用

参考

https://blog.csdn.net/qq3162380/article/details/45393335

猜你喜欢

转载自blog.csdn.net/a396604593/article/details/129797355