[Q] Android service and broadcast - Java for Android App Development

Hello all,
I have a question about Android service and broadcast.
For my application I am trying to keep track of the time with the Timer class.
The user can press a button and a timer will increase his value. (visible in activity).
What I am trying to achieve is to keep this timer going even if the user closes his application.
And after some specific time (say like every 10 mins) I want to send the user a notification to let him know the timer is still running.
Am I using the right implementation for using a service and broadcast?

I'd say there is no need for any broadcasts.
The Service can keep track of the Timer and Notification, then your Activity either starts and binds to the Service or if the Service is already started it rebinds.
Then use a PendingIntent to either stop the Service or start the Activity on Notification clicks, depending on your flow.

registered-user said:
I'd say there is no need for any broadcasts.
The Service can keep track of the Timer and Notification, then your Activity either starts and binds to the Service or if the Service is already started it rebinds.
Then use a PendingIntent to either stop the Service or start the Activity on Notification clicks, depending on your flow.
Click to expand...
Click to collapse
Thanks for your reply! I meant alarmmanager sorry! My idea was to check every x amount of time with my alarmmanager if my service (timer) is still running. Or is there also no need for a alarmmanager?

I guess you could do that, depends on the overall goal. You could also create a static flag in your Service that is flipped on start and on stop. Then post a delayed runnable/message to check the flag?

Related

test for call in progress?

our app requires continuous gprs connection to our server. connection is lost when incoming phone call is accepted. automatic reconnect would be nice, yet gives problems when executed prematurely. anyone aware of a test for 'call in progress' in pocket pc sdk to avoid the situation?
How do you initially create the connection and how do you handle the error right now? You need to use TAPI to check the status of a call.
some functions to note:
lineInitialize
lineNegotiateExtVersion
lineOpen
lineGetNewCalls
lineGetCallStatus
You can set a notification to be sent to your program using
lineSetStatusMessages to send a notification on LINEDEVSTATE_DISCONNECTED event
so that you don't have to continuously monitor the call
How to use lineGetNewCalls ?
Can you give me a sample so I can follow? I try to catch the incoming call from the callback function for LINECALLSTATE_OFFERING, but no event is sent. Event such as LINEDEVSTATE_RINGING occured. What happen if event such as LINEDEVSTATE_OPEN is occured?

replace the caller ID notification screen

Hi,
I need to develope an application that basically replaces the caller ID screen that pops up when you have an incoming call and show some more information on the caller, then let the user answer or decline the call.
any help on where to look first (or maybe code snipets if i'm lucky) highly appreciated.
Cheers,
Shafa
I think you may have a hard time if it is truly a seperate application you wish to write. I have written a program to try to be used at the same time as cprog.exe and when that incoming call window comes up nothing I have tryed will let the user interact with any windows I create. You could stop that process but most users will not want to do this. I ended up having my program automatically determine if it wants to accept the incoming call and answer it itself. This was particularly anoying because my incoming call interest was set to data only and cprog dose not normally even register an incoming call that is purly data. But after I had initialized tapi with my settings cproc unexpectedly shared the same interest for incoming data calls.
Just as speculation - if your program was constantly running, when an incoming call is offering, you could enumerate the desktop windows using EnumWindows and its associated callback function to get the hwnd of the ballon that comes up. Then perhaps you could close the incoming call window or send it to the bottom of the z order and use your own to replace it. I do not know what effect this would have on cprog.
code related to tapi tends to be long so your not that lucky
:lol:

[REQ] Looking for an sms app that does the following...

Hi everybody! I have a request for an sms app to fulfil my daily needs! Here is what I would wish for:
1) Config and save the following parameters: phone number, sms text, start time, interval (in minutes), end time and/or number of iterations.
2) Start the app, change/confirm settings and then let it automatically and repeatedly send sms to the predefined number with the predefined text and timing.
What is this good for? Well, my personal scope of application would be the sms parking service that is available in my hometown (Austria/Vienna)... You just send a text e.g. "10 *w47559e" and you're good to park your car for the stated number of minutes and car sign. However, if for some reason one needs more time, it is troublesome to constantly extend that sms ticket manually.
Maybe you guys can point me to an already existing tool that does the job. Or perhaps one hell of a coder here can give it a try! Wouldn’t normally make such a request but considering some of the great apps appearing on this board I thought it could be worth asking.
Thanks!

[REQ] Looking for an sms app that does the following...

Hi everybody! I have a request for an sms app to fulfil my daily needs! Here is what I would wish for:
1) Config and save the following parameters: phone number, sms text, start time, interval (in minutes), end time and/or number of iterations.
2) Start the app, change/confirm settings and then let it automatically and repeatedly send sms to the predefined number with the predefined text and timing.
What is this good for? Well, my personal scope of application would be the sms parking service that is available in my hometown (Austria/Vienna)... You just send a text e.g. "10 *w47559e" and you're good to park your car for the stated number of minutes and car sign. However, if for some reason one needs more time, it is troublesome to constantly extend that sms ticket manually.
Maybe you guys can point me to an already existing tool that does the job. Or perhaps one hell of a coder here can give it a try! Wouldn’t normally make such a request but considering some of the great apps appearing on this board I thought it could be worth asking.
Thanks!
PowerSMS (Freeware) will do all that for you.
Here is the Home Site URL:http://www.trinketsoftware.com/powersms/default.aspx

[Q] Android service restarts, but application does not

I am a complete newbie in Android.
I am developing an application that sends over a webservice information about the last dialed number, call status, and duration of the call.
The application works perfectly fine, but when the device closes the application the android service does restart but the activity does not.
The way I am sure about that is that I have Toasts when the service is started: "Servicio TRUCKA iniciado" and "Servicio TRUCKA creado" tell me that the service has been created and started.
And when the information is sent to the webservice I have toasts saying: "Enviando información..." and "Información enviada."
But when the application is closed (via the android task manager that automatically closes apps) the messages from the service "Servicio TRUCKA iniciado" and "Servicio TRUCKA creado" do appear, but the toasts from the information sent part do not.
I hope someone can help me and tell what am I doing wrong?
Really really thanks a lot!
I can not add code to the post, so I am adding the project hoping someone can help me
CLOSED
Human stupidity has no limits.
My actions where not in the service

Categories

Resources