On 2/20/2012 2:26 PM, Thomas wrote:
I'll make another request then. Please post the code and manifest for
a simple something that will start the "helloworld" app at bootup.
The helloworld app is just a test case to see if things are working at
bootup. I have a far more complicated embedded application to test
after that.
Best,
Tom B
You know I explained where to get the information you were missing is
at, I even explained what you were confused about. If indeed you have a
far more complicated embedded app to test, judging by the level of your
questions and failure to understand or even explore the material given
to you, I predict you will be bricking that device.
Nonetheless for the comedic value I give you Pies Of Cod, or at least
the parts you asked for. Yes this code executes and launches the app
Pies Of Cod when it is in a proper app environment. It took me about
half an hour to cobble together. Of course you'll want to adjust the
imports and packages to fit your environment so I omitted them. The view
is the main.xml you get from an eclipse generated hello world app.
First make a new android app named PiesOfCod in your workspace. Launch
it and make sure it runs.
Then you need to create a receiver class:
public class RxBcast extends BroadcastReceiver {
private static final String TAG = "RxBcast";
private static final int NOTE_ID = 1;
@Override
public void onReceive(Context c, Intent i) {
// check and handle registerable actions
String act = i.getAction();
Log.d(TAG, "Rxd "+ act );
if( act.equals(i.ACTION_BOOT_COMPLETED) ) {
Intent si = new Intent(c, PiesOfCodActivity.class);
si.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
c.startActivity(si);
}
} // onReceive
}
Then change the strings:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Pies Of Cod!</string>
<string name="app_name">PiesOfCod</string>
</resources>
Then adjust the manifest, yes you will have to use your package names,
etc. mine won't work for you:
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".PiesOfCodActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- android.intent.action.BOOT_COMPLETED -->
<receiver android:name="com.hootinholler.PiesOfCod.RxBcast" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="com.hootinholler.PiesOfCode.LAUNCH_APP" />
</intent-filter>
</receiver>
</application>
Build it, launch it, then restart the AVD that you have it installed on
and it should be open when you unlock the AVD.
Good luck with your very complicated embedded application, and please
keep us informed on how that is going.
--
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