make my application start when boot complete on/off
-
Heloo everyone im new to android development and im developing an android application for my graduation project my application must start when the device boot up so to that i put these lines in the AndroidManifest file <!--this to make app run at start up--> <receiver android:name="MyIntentReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.HOME" /> </intent-filter> </receiver> so my program run autmaticlly when boot complete. my question is how to stop this by user?? i want to put a toggle button on/off for this option so the user can chose if he want the app to start automaticlly in background or manually ??? thanks in advance
-
Answer:
This sounds pretty straight forward. Basically, when the phone starts, the Receiver class "MyIntentReceiver" will run. Inside this receiver you can put code based on user preferences to either start the application or do nothing. The toggle would be a CheckBoxPreference in the user preferences. Let me know if you have any questions.
user935143 at Stack Overflow Visit the source
Other answers
so my program run automatically when boot complete. I would say no to that. It is rather you receiver gets notified when boot is completed. From that point on, your program has to decide to fire up your activity/service in onReceive() method of your receiver. Thus, you will need to save a preference to give option to user. When your receiver gets notified, check the pref setting set by user. For more information about saving preference, you can refer to http://developer.android.com/guide/topics/data/data-storage.html#pref
PH7
Related Q & A:
- How to create complete .exe in WPF .net framework application?Best solution by Programmers
- How do i make a signature for when i send an email?Best solution by Yahoo! Answers
- Why not to complete a GST application?Best solution by Yahoo! Answers
- How do I make an Application Stand out?Best solution by eHow old
- Toyota Tacoma won't start when hot?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.