Boot Reciever


A boot reciever is a listener that picks up an intent that is sent when the phone boot animation has stoped. the first thing that needs to be done with it is register it in the manifest

<uses-permission android:name=“android.permission.RECEIVE_BOOT_COMPLETED”/>

<receiver android:name=“com.lukemovement.example.BootResiever”>

<intent-filter>

<action android:name=“android.intent.action.BOOT_COMPLETED”/>

<action android:name=“android.intent.action.QUICKBOOT_POWERON”/>

</intent-filter>

</receiver>

the next bit is creating the activity that responds when the boot complete intent is recieved

package com.lukemovement.example;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.content.SharedPreferences;

public class BootResiever extends BroadcastReceiver

{

@Override

public void onReceive(Context context, Intent intent)

    {

if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {

//intent to start a new main activity

Intent i = new Intent(context, BootActivity.class);

i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

context.startActivity(i);

}

  }

}

and it is as simple as that

Advertisements

One Response to “Boot Reciever”

  1. lukemovement Says:

    So you’ve edited the .java files inside my app. Considering my app is not open source doing this is against the law. Please email me if you wish support to continue, lukemovement@gmail.com


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: