andbook!.pdf - Learning Android Get an anddev.org - Android-Shirt Back to index
anddev.org Header Logo
FAQ Search Top rated articles Browse Feeds anddev.org - Authors Contact Details Register Log in

Launch Activity on System/Emulator Startup

Goto page Previous  1, 2, 3
 
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials
Author Message
stilwalli
Developer
Developer


Joined: 21 Jul 2008
Posts: 35

PostPosted: Tue Jul 29, 2008 10:38 am    Post subject: Reply with quote

It worked. These were warn message. But not sure why this was getting printed as I had already given the permission.
Back to top
View user's profile Send private message
bbevol
Once Poster
Once Poster


Joined: 08 Oct 2008
Posts: 1

PostPosted: Wed Oct 08, 2008 7:21 pm    Post subject: Reply with quote

I believe this is out of date now. Here is a modified version for Android 1.0

Java:

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;


public class MyStartupIntentReceiver extends BroadcastReceiver {

     @Override
     public void onReceive(Context context, Intent intent) {
          /* Create intent which will finally start the Main-Activity. */
          Intent myStarterIntent = new Intent(context, MyStarterIntent .class);
          /* Set the Launch-Flag to the Intent. */
          myStarterIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          /* Send the Intent to the OS. */
          context.startActivity(myStarterIntent);
     }
}


in the Manifest file

XML:
<receiver android:name="MyStartupIntentReceiver" >
            <intent-filter>
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
                 <category android:name="android.intent.category.HOME" />
            </intent-filter>
Back to top
View user's profile Send private message
ninor
Moderator
Moderator


Joined: 14 Aug 2008
Posts: 179
Location: Barcelona, Spain

PostPosted: Thu Oct 09, 2008 7:52 am    Post subject: Reply with quote

Thanks bbevol!
I formatted your code to look nicer!

_________________
AndDev: Your Android Development Community / Tutorials | Here's my Basic ToolKit
Back to top
View user's profile Send private message
MrSnowflake
Moderator
Moderator


Joined: 16 Feb 2008
Posts: 544
Location: Flanders, Belgium

PostPosted: Thu Oct 09, 2008 10:20 am    Post subject: Reply with quote

Is it possible to make BOOT_COMPLETED automatically start a service? According the manifest docs you can specify an intent-filter for <service> but I can't get it to work.
Back to top
View user's profile Send private message
Display posts from previous:   
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


© 2007, Android Development Community
All rights reserved.
Powered by phpBB.