Autostart an application at bootup

9 votes · 32 comments

This snippet starts an Application automatically after the android-os booted up.

raw ·
copy
· download
in AndroidManifest.xml (application-part): <receiver android:enabled="true" android:name=".BootUpReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver> [..] <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> [..] public class BootUpReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Intent i = new Intent(context, MyActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } }
Add a comment

32 Comments

Using BOOT_COMPLETED to trigger, say, a service to do something in the background is one thing, and even that was considered bad enough to warrant requiring its own permission.

Using BOOT_COMPLETED to start an Activity, though, is evil incarnate. Users are unlikely to appreciate a bunch of activities deciding they want to take control of the device after a reboot. Anyone using this deserves whatever lousy Android Market rating they get.

Reply · May 26, 2009, 3:56 a.m.

discount five fingers VIBRAM sole Introduction Vibram is a famous Italian manufacturer of rubber, the main business of two, one is the production of aircraft tires, another is what we today call a variety of specialized functional sole production. Its designed specifically for rubber soles with good abrasion resistance, good slip resistance, uniform texture to obtain the world's many outdoor footwear manufacturers and the majority of outdoor enthusiasts recognized as the standard high-end outdoor shoes.

Reply · July 23, 2011, 3:33 a.m.

"Anyone using this deserves whatever lousy Android Market rating they get."

thanks :P

I used this code because we are developing an application which is sold with an android-device as a bundle. So we have an interest in starting an activity at boot-up without being evil ;)

Reply · May 26, 2009, 2:18 p.m.

Thanks for this code snippet. A very useful one..

chandu http://www.geekland.co

Reply · Jan. 31, 2012, 2:25 p.m.

If you want it to open, declare your application as launcher/home application in Manifest and let the user choose if he wants it to be the default app on boot.

Reply · May 29, 2012, 11:50 a.m.

Hi,

You can send a model APK working with this code, I have to do is an application for a security system that should be started to connect the tablet and I can not do. I thank you for your attention and effort. My email to send the apk would adrianoboller@gmail.com can contain a screen hello world! ...

Starting a button and automatically close.

[ ]'s from Brazil

Adriano Boller

Reply · Jan. 29, 2013, 2:28 p.m.

Thanks for the code snippet. I am doing something similar where the android device is to be supplied as part of a product. Did you manage to complete the exercise and did you have any other problems in getting it to work?

Reply · Aug. 19, 2014, 8:04 a.m.

Another way you could use this code is if you package your app with an emulator and want your app to autostart.

Great snippet, thanks!

Reply · June 28, 2009, 3:19 p.m.

Can get the full source code of this snippets,because i have many doubts in it.

Reply · June 29, 2009, 1:03 p.m.

@Raj: Sorry I didn't see your post ... I'm afraid I can't offer any complete code because it's part of a project we're developing at our company and we're not into open-source currently ;(

Reply · July 27, 2009, 2:22 p.m.

Well said, the post is really the freshest on this valuable topic. I fit in with your conclusions and will thirstily look forward to your next updates. Website design company

Reply · July 7, 2011, 4:38 a.m.

Vibram Origin In 1935, Italian Vitale Bramnni mountaineering team led by a team of British Columbia mountain adventure in Afghanistan encountered a

blizzard, in which six people died due to inability to down time, Vitale later, that was used by the result of climbing shoes, at the time

of the climbing shoe is made ??of leather, and then nailed the nail on Leather Sole, use very bulky and inconvenient. Because of this

tragedy, let Vitale Bramnni committed to developing a new generation of climbing shoes.

<a href="http://discountvibram5fingershoes.com/vibram-five-fingers-men-s-shoes/cheap-five-fingers-men-s-kso/" title="cheap five fingers

kso">cheap five fingers kso

Reply · July 21, 2011, 8:24 a.m.

The benefits of barefoot running are being validated by more and more research everyday. As such, barefoot alternative running shoes are being developed by many shoe companies as they do not want to miss the out in the 'barefoot movement' cheap five fingers shoes

Reply · July 23, 2011, 7:56 a.m.

http://www.cheap5fingersonline.com Humans are well-adapted biomechanical machines. Our bodies have evolved over thousands of years and our feet have not been left behind. The foot is composed of 26 bones and numerous tendons and ligaments - a very complex structure! While the technology and advances for walking and running shoes has improved each year, this has not necessarily been a good thing. Injuries that are often blamed on other circumstances might be caused by the shoes we wear - even the expensive ones!

Reply · July 23, 2011, 7:39 a.m.

nike heels for women

Humans are well-adapted biomechanical machines. Our bodies have evolved over thousands of years and our feet have not been left behind. The foot is composed of 26 bones and numerous tendons and ligaments - a very complex structure! While the technology and advances for walking and running shoes has improved each year, this has not necessarily been a good thing. Injuries that are often blamed on other circumstances might be caused by the shoes we wear - even the expensive ones!

Reply · July 23, 2011, 7:40 a.m.

Wow! It is like you understand my mind! You appear to understand a good deal about this, like you wrote the e-book in it or something Testking 642-427. I think that you simply could do with some images to drive the content material residence a bit, but other than that, this is superb weblog Testking 000-978. An excellent study. I will definitely be again.

Reply · Aug. 11, 2011, 9:41 a.m.

Come on It looks good. Optimistic face life, and life will be very good to you! Welcome to my clothes stand, I wish you good mood every day! www.fashionbiz2u.com

Reply · Sept. 16, 2011, 4:05 a.m.

Wonderful MP4 to imovie converter on Mac lion

Reply · Nov. 10, 2011, 3:17 a.m.

Enjoy any videos/audios on Amazon's Kindle Fire with Kindle Fire video converter

How to burn videos to DVD on Windows 7link text

FCE converter

Reply · Nov. 15, 2011, 11:33 a.m.

I'm not into programming or anything, but I was looking for a what I thought would be a simple app, one that would start an app of my choice once the unit is booted up. I read through this and realize that this is likely a place for programmers, but I thought I'd add my two cents if anyone is still reading this. It would be annoying and presumptuous to have this code in an app you wish to place on the market. However, if one had a desire to use their tablet for one thing only, it would be nice to be able to autorun a custom made app. In my instance I know nothing of programming, but I want to run one program exclusively on my tablet. I have an old console radio that I am turning into something a little modern. I would like TuneIn Radio to autostart on my tablet when the device starts up. So far, I have had no luck finding any way to do this. A little more info on the project, if you are interested... I will be painting the outside of the console either high gloss black or white, not sure yet. Whichever I decide on, the trim pieces will be done in the other colour. I have a friend in the spray foam business and I was thinking of having him spray the inside with about an inch, that stuff is great, really holds things together, and would keep anything from vibrating. The 7" tablet screen will fit perfectly into the space where the old painted glass section was that tells you what frequency you are on. I don't think I'll go all out on the speakers, I'll probably just wait for a decent set of logitec pc speakers, and they will plug into the headphone jack. Hoping to find some cool looking buttons to install on the front, electroluminescent or something :) and these will push the four buttons I have on my tablet. The end result: Old 1940's AM radio updated to internet radio player, and a very cool looking piece for the living room.

Reply · Dec. 4, 2011, 3:07 a.m.

This is a great idea indeed. If Android had a function to auto-start an app without a programmatic way it would indeed give that power to users to default to an app at start up.

Chandu http://www.geekland.co We are an Atlanta, Georgia based company focused on custom Android Tablet design and development services. We provide both OEM (Original Equipment Manufacturer) and ODM (Original Design Manufacturer) services. By partnering with high quality and reliable manufacturing companies in China, we are able to design and build high quality Android tablets to custom specifications.

Reply · Jan. 31, 2012, 2:25 p.m.

Did you ever got an app that did this? If not, let me know. (Android developer & old AM radio fan).

Reply · Feb. 18, 2014, 10:24 p.m.

Welcome to boutique maternity store http://www.fashionmaternitydress.com http://www.bangtoysmall.com

Reply · Dec. 31, 2011, 5:12 a.m.
Reply · Jan. 9, 2012, 7:58 a.m.

Oh no, this is a fault. swf video converter mac is a powerful flash tools, convert swf to mov, upload swf to youtube, and play swf on ipad

Reply · Jan. 9, 2012, 8:01 a.m.
Reply · Feb. 10, 2012, 6:17 a.m.

Best and powerful PDF to TEXT Mac will help make your life more wonderful.Excellent PDF Converter For Mac help you.

Reply · Jan. 3, 2012, 2:09 a.m.

http://www.uoften-tablettepc.com/netbook/netbook-10-pouces.html

Reply · Feb. 20, 2012, 9:50 a.m.

This is a great idea indeed. If Android had a function to auto-start an app without a programmatic way it would indeed give that power to users to default to an app at start up.

Reply · March 15, 2012, 10:31 a.m.

pc part is very helpful for you!@

Reply · March 30, 2012, 9:40 a.m.

www.bangtoysmall.com

www.fashionmaternitydress.com

Reply · May 24, 2012, 7:18 a.m.

Can anyone tell me how to allow applications to automatically start at boot on HTC device (Flyer in special)? I've added this snippet to my project, but on device boot it doesn't start. When I take a look in Settings/Applications, theres no check mark ahead of "System Tools/Automatically start at boot" in Permissions section of my application.

I did some surfing around in details of other apps and realized that none of them has a check mark when this permission is requested.(i.e. in Google Mail app...)

Note: I gotta develop something for my college so nothing evil is planned ;)

Reply · April 29, 2012, 1:17 p.m.

seems a little complex to me, is there anyone can give an detailed explain about it?v I am interested in it...recommend: video editor mac

Reply · Aug. 9, 2012, 3:55 a.m.

thank you very much. this snippet help me in my project.

Reply · Sept. 17, 2012, 4:11 p.m.

Hi, ==

You can send a model APK working with this code, I have to do is an application for a security system that should be started to connect the tablet and I can not do. I thank you for your attention and effort. My email to send the apk would adrianoboller@gmail.com can contain a screen hello world! ...

Starting a button and automatically close.

[ ]'s from Brazil

Adriano Boller

Reply · Jan. 29, 2013, 2:23 p.m.

We would like to hire you for a small bit of consulting, advising us on how to make an autostart program for our Android-based tool that does not require us to "root" anything. We get the main idea from your nice sample snippet, but we figure it's worth a bit of money to get your head wrapped around our specific situation. And possibly consult on our simplistic Android development effort in general.

Hope to get emailed instructions from you, as to how to contact you via email. Thanks /finaldesignrb@yahoo.com

Reply · March 19, 2013, 7:15 p.m.

Very useful... Thank You

Reply · Oct. 24, 2014, 5:32 a.m.