Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have application which have timers and if the timers are stopped the application will wont work I need to keep the application on all time even when the app is turn off (I know doesn't makes sense) and also to save the files if the phone is switched down.
I need to keep the application on all time even when the app is turn off
You can you Service. Its for the same purpose.
Save the files if the phone is switched down
You can receive an intent ACTION_SHUTDOWN in the broadcast receiver, when phone is about to switch off. Then you can do whatever you want to do there. See Is there any way to receive a notification when the user powers off the device? for details.
Hope this helps.
I suggest that you investigate Services.
A service can run in the background continuously.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i want to do is that if my application is closed from the task manager my service won't stop and if stops another package that is also running and checking the application process will turn my service ON how can i do it
If you want to make sure that your service should keep running or should get recreated again after killed then you should return start_sticky from your onStartCommand() method which will make sure to recreate your service as soon as memory is free. check the following link for more detail. http://developer.android.com/reference/android/app/Service.html#START_STICKY
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am implementing a tracking app. Where I need to find out how much time a user is using a different app like facebook or twitter. I can track the time but my main problem is that time keeps adding, if the screen is locked. I want to find out how much time a user are actually using facebook or twitter. I have implemented a Broadcast Receiver in my app to receive the broadcast when the screen is locked. It worked fine, and the broadcast receiver receives screen lock call when my app is running. But my app does not receive any notification when my app is not running. How can I solve this problem?
You should implement a Service!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to know if there is any class or Alarm in android or IOS that tells if the mobile is Down or UP, or just started or restarted. (and for how long!)
i'm creating a logging system, and i need to log the different state of the mobile all along the day.
Thanks in advance,
You need to add send notification from you app (native in iOS and Android) to your remote logging server.
Android as well as iOS have Application life cycle. Which provides you with callback if app is in running state , background , foreground etc.
There is a similar one for Android
The idea is that both of them have singleton for application and they have callbacks for app transition stage
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I want to upload some data using web services, I have created a service, but when phone is switch off services are getting kill and data are not uploaded, please guide me on how to create a service which run even after switch of and on android, and will they persist data which is passed in intent to start service.
You can use Broadcast Receiver on reboot. Then re-start your background server.
see this question Broadcast receivers on reboot?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new at android and I am trying to make an android app which takes from you the time and sends a message to user at that time. Can someone tell me the steps to follow so I can make this app.
This is actually pretty simple. One way to do this (may not be the simplist but would give you good experience with a bunch of the android framework:
Register a BroadcastReceiver
Gather the information (message, destination, time) from the user using UI elements.
Send an intent to the BroadcastReciever with the time specified.
Send the sms from the BroadcastReceiver, using SmsManager.
This would also give you a lot of opportunity to add to this app, you can learn to use Content Providers to keep track of the current 'Pending Messages' and give the user an option to view and edit them.