android在拨号键盘输入类似*#*#0318#*#*的指令

来源:互联网 发布:tensorflow下载教程 编辑:程序博客网 时间:2024/06/03 23:38

1、写一个广播接受者

public class KeyCodeReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {Toast.makeText(context, "0318 -- Testing", Toast.LENGTH_LONG).show();}}


 

2、AndroidManifest.xml中做如下配置

 

<receiver android:name=".KeyCodeReceiver" >            <intent-filter>                <action android:name="android.provider.Telephony.SECRET_CODE" />                <data                    android:host="0318"                    android:scheme="android_secret_code" />            </intent-filter>        </receiver>


3、哦了!

原创粉丝点击