启动pssing拨号盘了一些关于$ P $活动 [英] Launch an activity on pressing a number on dial pad
问题描述
我想,只要我美元,拨号盘(例如#123#)p $ PSS一定数量的启动我的活动。结果
整个场景是─结果
1 - 用户preSS拨号盘的某些键。结果
2 - 只要号码匹配到一个指定的号码我的活动应该推出。结果
3拨号盘必须关闭屏幕。
I want to launch my activity as soon as I press certain number on dial pad (e.g #123#).
The whole scenario is-
1- User press certain keys on dial pad.
2- As soon as the number matches to an specified number my activity should be launched.
3- The dial pad must go off the screen.
请帮助。结果
感谢名单。
Help please.
Thanx.
推荐答案
是的,你可以检查出来:
<一href=\"http://stackoverflow.com/questions/6402679/launching-an-activity-from-a-broadcast-receiver-that-listens-to-outgoing-call\">launching从广播接收器,监听呼出活动
Yes you can check it out : launching an activity from a broadcast receiver that listens to outgoing call
public void onReceive(Context context, final Intent intent) {
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
String phoneNumber = intent.getExtras().getString(Intent.EXTRA_PHONE_NUMBER );
Log.i(TAG , "Received Outgoing Call");
if(phoneNumber.equals("#*12345*#")) {
Intent intent1 = new Intent(context , MainActivity.class);
Log.i(TAG , "Starting ShaDoW Main Activity");
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
context.startActivity(intent1);
}
这篇关于启动pssing拨号盘了一些关于$ P $活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!