3
使用bootcompletedReceiver最近我使用BOOT_COMPLETED
2應用程序(如應用程序,和B的應用程序)優先兩個應用程序在Android
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
一個應用程序是活動和B的應用程序是服務應用
當我的設備引導, 第一個應用程序啓動和B應用程序啓動 所以,顯示B應用程序屏幕。
我想 第一個B應用程序啓動和一個應用程序啓動顯示可能是一個應用程序的屏幕
,我可以給BOOT_COMPLETED
優先級是可能的嗎?
最後,我想,當我啓動我的設備,顯示應用屏幕
謝謝!
添加
我嘗試
乙應用(服務)
public class BootCompletedReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) {
Intent i = new Intent("A app package name.BOOT_COMPLETED");
context.sendBroadcast(i);
}
}
}
<receiver android:name=".BootCompletedReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
一個應用程序(活動)
public class BootSendReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context,Intent intent) {
if(intent.getAction().equals("B app packagename.BOOT_COMPLETED"));
Intent i = new Intent (context, MainActivity.class);
context.startActivity(i);
}
}
<receiver android:name=".BootSendReceiver">
<intent-filter>
<action android:name="blackeyeonandroid.iosystem.co.kr.simpleserviceexample.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
,我嘗試啓動..但顯示乙的應用程序屏幕
謝謝,我試試這個。請等一下! – chohyunwook
這樣,app1先開始,app2開始? – chohyunwook
我添加了問題如何聲明'LOG','mContext'? – chohyunwook