让我的应用程序启动时的秘密code进入? [英] Make my app launch when secret code entered?

查看:100
本文介绍了让我的应用程序启动时的秘密code进入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何让我的应用程序启动时,一个秘密的code,如 *#*#12345#*#* 输入到拨号?

How would I make my app launch when a secret code, such as *#*#12345#*#* is entered into the dialer?

我找不到在Android文档的解决方案。

I couldn't find a solution in the Android docs.

推荐答案

这是我是如何做的:

我改变了我的主要活动有没有意图过滤器:

I changed my main activity to have no intent-filters:

<activity
            android:name=".ParentTrap"
            android:label="@string/title_activity_parent_trap"
            android:theme="@android:style/Theme.Holo" >
        </activity>

然后我做了一个广播接收器,意图筛选器操作: android.provider.Telephony.SECRET_ code

然后添加数据给它。整个事情是如下:

I then added data to it. The entire thing is below:

<receiver android:name=".ParentTrap$Launch" >
            <intent-filter>
                <action android:name="android.provider.Telephony.SECRET_CODE" />

                <data
                    android:host="(secret code)"
                    android:scheme="android_secret_code" />
            </intent-filter>
        </receiver>

一旦这样做,使类(我在我的主类所做的启动类,延伸广播接收器),然后在的onReceive类,火的意图来启动该活动。

Once done, make a class (I made the Launch class in my main class, extending BroadCast Receiver), then in the onReceive class, fire an intent to launch the activity.

然后键入 *#*#(秘密code)#*#* 进入拨号器将启动应用程序。

Then typing *#*#(secret code)#*#* into the dialer will launch the app.

这篇关于让我的应用程序启动时的秘密code进入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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