如何在中文设备上以编程方式为我的应用启用自动启动选项?

时间:2019-11-19 11:09:46

标签: java android android-intent broadcastreceiver

如何在没有用户影响的情况下在我的应用中启用自动启动选项?请帮助我

   public class BootUpReceiver extends BroadcastReceiver {
   @Override
   public void onReceive(Context context, Intent intent) {
       Intent i = new Intent(context, Splash_Screen.class);
       i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
       context.startActivity(i);
   }
}
 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" 
  />

 <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>

0 个答案:

没有答案