进入工程测试模式 安卓手机如何通过暗码进入工程测试模式,在拨号界面按下 *#*#4636#*#* 即可出现'测试'菜单 进入后可以看到移动网络信息,在电池信息中可以查看电量。
参考如下:首先在manifest.xml中 添加 <receiver >相关的代码
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".PhoneGuide"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="Cipher">
<intent-filter>
<action
android:name="android.provider.Telephony.SECRET_CODE"/>
<!-- *#*#1001#*#* -->>
<data android:scheme="android_secret_code"
android:host="1001"/>
</intent-filter>
</receiver>
</application>
然后Cipher.java的代码如下
[java] view plain copy
package feng.PhoneGuide
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
/**
* 通过暗码启动重置activity的处理
* */
public class Cipher extends BroadcastReceiver{
public Cipher(){
}
@Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
if(arg1.getAction().equals
("android.provider.Telephony.SECRET_CODE")){
Intent i = new Intent(Intent.ACTION_MAIN)
i.setClass(arg0, PhoneGuide.class)
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
arg0.startActivity(i)
}
}
}
然后在打电话的界面输入 *#*#1001#*#* 就可以启动相应的应用程序了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)