0

this is my manifiest file below my application not start my application when i turn On mobile i follow this like how to start my application when ever mobile restart or turn on

<?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);
    }
}
Community
  • 1
  • 1
lovely guy
  • 51
  • 5

1 Answers1

0

Check this question of mine, and the answer provided - they are related, and might solve your problem:

Even though the intent used is different, the security issue I describe below is similar.


The problem might be that you need to run the application once BEFORE it will respond to the BOOT_COMPLETED intent.

This is a security measure.

If you do not run the application, it will not start on boot. Give it a try.

i.e.

  1. write app
  2. install app
  3. RUN APP
  4. reboot phone to check if it works
Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255