1.按键广播接受
public class SecretCodeReceiver extends BroadcastReceiver {
/*接受按键指令*/
@Override
public void onReceive(Context context, Intent i) {
// TODO Auto-generated method stub
Intent intent=new Intent(context,AfterSaleCardActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}
2.在AndroidManifest.xml中注册接受器
<receiver android:name="SecretCodeReceiver">
-
<
intent-filter
>
<
action
android:name
="
android.provider.Telephony.SECRET_CODE
"
/>
<
data
android:scheme
="
android_secret_code
"
android:host
="
369
"
/>
</
intent-filter
>
</
receiver
>
OK,现在输入*#*#369#*#*就可以进入你想要的界面了