2011-11-08 42 views
0

我正在開發應用程序,它可以作爲其他應用程序的啓動中心。事情是,我的應用程序在任何其他外部活動從它啓動並保持活動狀態約75秒後總是被系統破壞。Android應用程序在75秒後自動銷燬

例如,我正在啓動瀏覽器或任何帶有選擇器的活動。然後等待75秒,後退按鈕將帶我回家。通過選擇器活動,我甚至可以看到我的應用程序在後臺退出。

如何避免這種情況,可能是什麼原因?我的猜測是我應該對推出的活動有某種親和力,但我可能是錯的。

這是我如何描述我的活動。該應用程序在市場上名爲Speaktoit Assistant,您可以對其進行測試。

<activity 
android:name="com.speaktoit.assistant.main.MainActivity" 
android:theme="@style/Theme.DoNotDim" 
android:windowSoftInputMode="stateHidden|adjustPan" 
android:configChanges="orientation|keyboardHidden" 
android:launchMode="singleTop">  
</activity> 

<activity 
android:name="com.speaktoit.assistant.SplashActivity" 
android:label="Assistant" 
android:theme="@android:style/Theme.Light.NoTitleBar" 
android:screenOrientation="portrait" 
android:configChanges="keyboard|keyboardHidden|orientation" 
android:finishOnTaskLaunch="true" 
android:noHistory="true" 
android:launchMode="singleTop"> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
</activity> 

UPDATE: 好吧,貌似系統停止我的應用程序並將其返回初始啓動活動,因爲SplashActivity是finishOnTaskLaunch =「true」,那麼它只是存在。問題是如何使android返回到MainActivity,而不是...

更新2: 好吧,我發現埋在代碼中的killTask​​。問題解決了 :)。

回答

0

您是否嘗試刪除singletop launchmode?

+0

是的,我已doublechecked,singleTop刪除不影響這一點。 – realill

相關問題