Have you added RECEIVE_BOOT_COMPLETED permission in your manifest?

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

Kaz

On Feb 1, 6:48 am, Acer <[email protected]> wrote:
> Hello,
>
> I'm new to Android. I'm trying to use the intent
> android.content.Intent.ACTION_BOOT_COMPLETED in order to start a
> activity/service as soon as the device is booted.The intent filter is
> as below
>
> <receiver android:name="My2Receiver" android:enabled="true">
>             <intent-filter>
>                 <action
> android:name="android.content.Intent.ACTION_BOOT_COMPLETED"/>
>                 <category android:name="android.intent.category.HOME"/>
>             </intent-filter>
>         </receiver>
>
> Also the following is the code in My2Receiver
>
> public void onReceive(Context context,Intent intent) {
>                 Log.d("DEBUG","BOOT COMPLETED");
>                 Intent myStarterIntent = new Intent(context, Hello.class);
>         /* Set the Launch-Flag to the Intent. */
>         myStarterIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>         /* Send the Intent to the OS. */
>         context.startActivity(myStarterIntent);
>         }
>
> But I do not see any debug messages like BOOT COMPLETED.
>
> Target Version - Android 1.6 API Level 4.
>
> Could anyone please help me know where I'm going wrong here.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to