Trying to launch a url when Android starts up
<p>What am I doing wrong with the code below?</p>

<p>Here is the backstory:
I am working on a simple project that is being used on Android MicroPCs attached to TVs.
Basically all I want it to do is open a URL when Android boots up.</p>

<p>Here is what I have come up with using <a href="https://github.com/fangstar/BootAtStartup" rel="nofollow">https://github.com/fangstar/BootAtStartup</a> as a base</p>

<pre><code>package com.mfcoding.android.bootatstartup;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.net.Uri;
/**
* To Test: 
* In shell terminal type: adb shell 
* Within adb shell: am broadcast -a android.intent.action.BOOT_COMPLETED
* 
* @author cwhittl
* 
*/

public class BootAtStartupReceiver extends BroadcastReceiver {
static final String TAG = "BootAtStartupReceiver";

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
        Log.d(TAG, "*** onReceive ACTION_BOOT_COMPLETED");

        // Start Intent or Service
        /*
         * // Example of Intent Intent intent2 = new Intent(context,
         * NewActivity.class);
         * intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         * context.startActivity(intent2);
         */
        /*String url = "http://www.collectivebias.com";
        Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        context.startActivity(i);*/
        Intent mIntent=new Intent();
        mIntent.setAction(Intent.ACTION_VIEW);
        mIntent.setData(Uri.parse("http://www.android.com"));
        mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(mIntent);
    }

    Log.d(TAG, "*** onReceive");
}

}
</code></pre>

<p>Manifest</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mfcoding.android.bootatstartup"
android:versionCode="1"
android:versionName="1.0" &gt;

&lt;uses-sdk android:minSdkVersion="8" /&gt;

&lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;

&lt;application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" &gt;
    &lt;activity
        android:name=".BootAtStartupActivity"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity android:name=".NewActivity" &gt;
    &lt;/activity&gt;

    &lt;receiver android:name=".BootAtStartupReceiver" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;/intent-filter&gt;
    &lt;/receiver&gt;
&lt;/application&gt;
</code></pre>

<p></p>
