My application does not start on a bootable mobile device

This is my most explicit file under my application, not launching my application, when I turn on the mobile, I follow it how to launch my application when rebooting or turning on the mobile device

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.example.installedapps22"
 android:versionCode="1"
 android:versionName="1.0" >

 <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="8" />    
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />   
 <application android:icon="@drawable/cherry_icon" android:label="@string/app_name">
    <activity android:name=".MainActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>        
    <receiver android:enabled="true" android:name="com.app.reciever.BootUpReciever">
  <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
 </receiver>
  <activity android:name=".ListInstalledApps" > </activity> 
  <activity android:name=".TabsLayoutActivity" />
  </application>
 </manifest>

Class file

package com.example.installedapps22;

public class BootUpReciever extends BroadcastReceiver
{

    @Override
    public void onReceive(final Context context, Intent intent) {
        Intent i = new Intent(context, MainActivity.class);  
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i);
    }
}
0
source share
1 answer

Check this question and the answer provided - they are related and can solve your problem:

Although the intent used is different, the security issue that I describe below is similar.


, , BOOT_COMPLETED.

.

, . .

.

  • RUN APP
  • , , .
0

Source: https://habr.com/ru/post/1607959/


All Articles