我正在尋找在出現撥打電話時顯示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