我的應用程序作爲啓動器工作,並且它在啓動時啓動。但是,它有些問題。例如,我在設備上安裝我的應用程序,並通過選擇Always按鈕(作爲默認啓動器)打開它。這裏沒有問題。但是,如果我重新啓動設備(它在啓動時打開,如前所述),應用程序將打開。但是當我想關閉它時,我無法做到這一點。它再次打開。
這是我的清單文件:
啓動後我無法關閉我的啓動器應用程序
<receiver android:enabled="true" android:name=".BootUpReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity
android:name="com.comeks.cocuktablet.Main"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
這是BootUpReceiver.java:
public class BootUpReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
Intent i = new Intent(context, Main.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
你昨天基本上問了同樣的問題。 http://stackoverflow.com/questions/15885626/how-to-end-a-launcher-completely並禁用啓動器功能,用戶將不得不去設置 - >管理應用程序 - >你的應用程序 - >清除默認值。他們按下清除默認按鈕後,他們會按下主頁按鈕,他們會得到彈出顯示所有avaialbe發射器,包括股票之一(和你的) – FoamyGuy 2013-04-09 14:40:35
@Arju謝謝你的回答。我嘗試過,但是當我在意圖過濾器中刪除這4行中的一行時,它不起作用。 – halilkaya 2013-04-09 14:43:32