Java Android在平板电脑启动完成后启动应用程序
我使用的是Android 3.2,我创建了我的Android应用程序,当我的平板电脑启动完成时,它将自动启动 当应用程序开始自动运行时(启动完成后),除了活动运行两次之外,一切正常 手动启动应用程序时不会出现此问题 公共类BootStartUpApp扩展了BroadcastReceiver{Java Android在平板电脑启动完成后启动应用程序,java,android,performance,android-intent,Java,Android,Performance,Android Intent,我使用的是Android 3.2,我创建了我的Android应用程序,当我的平板电脑启动完成时,它将自动启动 当应用程序开始自动运行时(启动完成后),除了活动运行两次之外,一切正常 手动启动应用程序时不会出现此问题 公共类BootStartUpApp扩展了BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Intent startUpApps = new Intent(c
@Override
public void onReceive(Context context, Intent intent) {
Intent startUpApps = new Intent(context, StartMainActivity.class);
startUpApps.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startUpApps);
}
}
在清单文件中,我添加了以下代码:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name="com.logica.eHealthBox.tab.activity.BootStartUpApp" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
以下是操作方法:
public class BootReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, TestReceiversActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
在清单中放入一个条目:
<receiver android:name=".BootReceiver" />
而且也有这个活动
有关更多信息,请检查和是否有代码显示给我们?。。BroadcastReceiver部分将不胜感激。与post中使用的代码相同,其工作正常,但我的问题是,启动完成后启动应用程序时,活动会运行两次