在我的应用程序,我想检测来电,我想隐藏默认来电布局与我的自定义布局,远远我现在设法得到来电的状态,但我无法隐藏默认的呼入电话屏幕下面......是我的代码和我的Android清单文件...任何帮助将不胜感激..处理来电android
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.i("DEBUG", "on recive called");
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
String number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
if (TelephonyManager.EXTRA_STATE_RINGING.equals(state))
{
abortBroadcast();
Log.d("MPR", "Its Ringing [" + number + "]");
//start activity
Intent i = new Intent();
i.setClassName("com.ezest.callerid", "com.ezest.callerid.CustomCallActivity");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
if (TelephonyManager.EXTRA_STATE_IDLE.equals(state))
{
Log.d("MPR", "Its Idle");
}
if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(state))
{
Log.d("MPR", "Its OffHook");
}
}
清单
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name="MYPhoneStateListener">
<intent-filter android:priority="999999">
<action android:name="android.intent.action.PHONE_STATE"></action>
</intent-filter>
</receiver>
<activity
android:label="@string/app_name"
android:name=".CallerIDActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="CustomCallActivity">
</activity>
</application>
据我所知,您将无法能够使用SDK时隐藏系统门店屏幕。 – wojciii 2012-07-20 13:01:47
@ wojci ..但我已经看到市场上的这个功能的应用程序.. – android 2012-07-20 13:06:54
你知道他们是否正在使用反射和试图访问电话框架的内部部分? – wojciii 2012-07-21 18:55:14