我正在寻找在出现拨打电话时显示Android Native Phone应用程序顶部的对话框。 我能够创建对话框,但它在电话应用程序的顶部不可见。电话应用程序顶部的显示对话框:Android
我曾尝试: 在该建议:Android, how to bring a Task to the foreground?
中已设定清单文件中的以下
<activity
android:name=".DialogActivity"
android:excludeFromRecents="true"
android:label="@string/title_activity_dialog"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@android:style/Theme.Dialog" >
</activity>
电话状态听众:
public void onCallStateChanged (int state, String incomingNumber)
{
if(TelephonyManager.CALL_STATE_RINGING == state) {
Log.i("PHONESTATE","RINGING");
//Incoming call handling
}
if(TelephonyManager.CALL_STATE_OFFHOOK == state) {
Log.i("PHONESTATE","OFFHOOK" + context.toString());
Intent in = new Intent(context, DialogActivity.class);
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
in.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(in);
}
if(TelephonyManager.CALL_STATE_IDLE == state) {
//Device back to normal state (not in a call)
Log.i("PHONESTATE","IDLE");
}
}
能否请您就引导我应该采取什么方法来实现我想要的。 感谢提前:)
试过这个,结果还是一样。 :( PS:我想创建活动“DialogActivity”从具有PhoneStateListener的服务 – 2014-10-18 19:18:53