2016-10-01 112 views
0

在我的應用程序中,我有一個SIP呼叫功能。
當應用程序未打開並從系統內存中清除並接收來電時,它會從SIP服務中打開呼叫活動。
當呼叫斷開時,我完成活動。

但問題是,活動仍在內存中(當主頁按鈕被按下時)。
我希望該活動不在內存中。
像什麼應用程序調用的行爲,當應用程序被殺時
(即不在內存中)不保持內存中的活動。Android內存清除活動

從SIP服務我這樣稱呼它。

Intent intentIncomingCall = new Intent(getApplicationContext(), CallActivity.class); 
intentIncomingCall.putExtra("DisplayName", callerDisplayName); 
intentIncomingCall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
startActivity(intentIncomingCall); 

和呼叫斷,我只是簡單的停止服務和活動呼籲finish()
我曾嘗試添加標誌和退出(),但沒有任何工作。下面光潔度

回答

2
android:allowTaskReparenting="false" 
     android:excludeFromRecents="true" 
     android:launchMode="singleTask" 
     android:permission="android.permission.USE_SIP" 
     android:screenOrientation="portrait" 
     android:taskAffinity="" 

嘗試增加上述性能到活動清單中

+0

偉大的人非常感謝,我是無言的回話。你是個天才。 –

0

添加線()方法:

finish(); 
System.exit(0); 
+0

這不是從存儲器清除應用程式。當點擊主頁按鈕時,活動在最近的應用程序列表中仍然可見。 –

+1

+0

將這些行添加到您的menifest文件中 –

0

callClosed時回調,
System.exit(0);

android.os.Process.killProcess(android.os.Process.myPid());

+0

這不會從內存中清除應用程序。當點擊主頁按鈕時,活動在最近的應用程序列表中仍然可見。 –