Service Doesn't Stop When Asked To Stop

Aug 2, 2012

Okay when user presses log out button what's supposed to happen is:

Code:
stopService(myIntent);
unbindService(mConnection);
mIsBound = false;

I need to shut down the service on background.Except the service restarts itself over and over again! Even if I kill the program from task manager the service restarts itself. Other programs aren't using the service. when I uninstalled the program the foreground program information popped up indicating it was STILL there(albeit this I solved by rebooting phone).

When user says he's finished with the program 'least he can expect is for the program to stay down rather than keep eating battery by acquiring GPS signal and sending them to server. The program is not intended to be "once you log in you need to Uninstall me and reboot phone to get rid of me!" type of program!

Service doesn't stop when asked to stop


Servicestop() Doesn't Stop GPS Acquire?

Jul 4, 2012

When user press log off button following 2 lines should happen:

stopService(myIntent);
unbindService(mConnection);

myIntent is same intent that was used to start service(desperate attempt to get this working). mConnection is basically straight from android's development center.

I have verified that service's onDestroy gets called. There it sets boolean variable true to make Runnable stop it's course(which among itself starts up gps tracking if certain requirements happen), calls the locationManager's removeCallbacks and finally calls super.onDestroy function.

I thought this was supposed to be enough to stop the service from running and acquiring GPS positions(and likely sends them to server too) but the GPS acquiring symbol is STILL blinking. I presume this is not just graphical error by the phone but that it still is searching(and wasting battery).

What have I done incorrectly? What else I need to do to get the service stop when I want? Service dying off when android decides off yet staying up when I'm trying to get it closed.

View 1 Replies View Related

Android :: Start And Stop Music On Application Launch And Stop

Jan 5, 2010

In my application i have several activities and i want to start background music whenever my *Application* is launched and stop music whenever *Application* is paused or stopped.

View 4 Replies View Related

Android :: Make Service Stop Itself?

Dec 11, 2009

I start a service in an activity then I want the service to stop itself after awhile.

I called stopSelf() in the service but it doesn't work.

how to make the service stop itself?

View 3 Replies View Related

HTC Incredible :: How To Stop Obex Service

Jun 24, 2010

I saw this in the "running services".. and i stopped it, what the hell is it and should i not have stopped it?

View 2 Replies View Related

Android :: Service Won't Stop When Exiting Application

Jul 13, 2009

I have a service receiving and sending data to a server in separate threads each. The service lifecycle methods look like this:..................

View 3 Replies View Related

Android :: Way To Correctly Stop Camera Service?

Jun 1, 2010

Is there any way to correctly stop the camera service? This does not seem to work: After doing that the camera does not work, even if I use the program that is pre installed in my handset.

View 2 Replies View Related

Android :: How To Stop Service - When All Activities Are Finished

Jan 26, 2010

I am programming a game. I have a service for the background-music. When I press the home-button and leave my activities, the service still runs in background. How can I stop the service, when there is no more visible activity in my program and restart it, when the user goes back to my game (some activity of it)?

View 8 Replies View Related

Android :: Stop Service After AsyncTask Finished

Jun 26, 2010

I have a service, that requests another class, which launches an AsyncTask

Service->Weather Class->Execute Method->Asynctask->Execute

this is launched in the service by

new Weather(this).execute(); // the execute is a method of the class, not of the AsyncTask

how do I detect in Service that the AsyncTask finished so I can call stopSelf?

View 1 Replies View Related

Android :: Stop Service Only When There Are No Other Activities In App Running

Mar 13, 2010

Is there a way I can test if there are any other activities in my app still alive? I am looking to stop a service in an onDestroy method, but only want to do this if there are no other activities from my app still alive on the stack.

I have the call stop the service in the main activity's onDestroy() method. This works perfect EXCEPT that if a user launches my app, then launches a few activities in my app, then hits the home screen and RELAUNCHES my app, they will subvert my order and the main activity will now be above other activities of my app. From this state, if they hit the back button and 'back out' of my home screen they will trigger the onDestroy() method and kill the service even though there are other activities open on the stack. I want to avoid this by stopping the service ONLY if I am sure there are no other activities of mine open on the stack.

View 1 Replies View Related

Android :: How To Stop Location Manager Service?

Jul 2, 2009

I have a location manager: mLocationManager01 = (LocationManager)getSystemService (Context.LOCATION_SERVICE); because i want to stop the gps service, but when i use mLocationManager01.removeUpdates(mLocationListener01); that's not working to stop gps. how can i stop it?

View 4 Replies View Related

Android :: Running Service On Start Up And Stop Before Shut Down

Jan 30, 2010

Is there an API, or a registry I can do in the manifest to make sure my service is being run at the device start up and being shut down before the device shuts off?

View 3 Replies View Related

Android :: Service Stop When Pressing Back Button

Mar 19, 2010

I created and binded a service in an activity and I would like to know how I can avoiding the android application to stop when I press the back button. When the back button is pressed the onDestroy method is called and I unbinded the service in this method. I try to prevent it by taking care of the back button event and manually call for onStop() method but it always called onDestroy after, why?

View 1 Replies View Related

Android :: Force Service To Stop After Fixed Time?

Oct 14, 2010

I have a service which runs in the background when the user starts using my app. I am using it to do some posts to our server. I always close my service by calling stopSelf as soon as the posts have been made or failed.

But I recently observed two times that my service did not stop. I saw that in the running services in settings on my device that it has been sitting there for over a few hours.

So I was trying to see if I can alternatively set a timer using which I can force the service to stop after a few minutes no matter what.

View 3 Replies View Related

Motorola Droid :: GTalk Service Starting All By Itself / Stop It?

Nov 23, 2009

So sometimes I'll go into my contacts and notice that some of them have the green ball lit up telling me that they are online in gtalk. Now I am not signed onto gtalk... but yet somehow I see that in my running services that GTalkService is running.

I can only assume that its eating away battery trying to see how is online and not. I certainly don't need this info unless I wish to go online myself... in which case I would actually go into the gtalk app.

ANyways, obviously i've been killing it in the running services, but it just comes back all on its own. ANy idea why or how to stop it?

View 9 Replies View Related

Android :: Close Location Manager / Gps Signal Doesn't Stop?

Jul 26, 2009

It' so strange about close gps location manager, the gps signal doesn't stop. my code is...

View 7 Replies View Related

Android :: How To Stop Service Method Of Calling Activity Class?

Jul 2, 2010

I am trying to call my service class's stopService() method from my activity. But I don't know how to access stopservice method from my activity class. I have the below code but its not working. This is HomeScreen class:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
enablecheck = (CheckBox)findViewById(R.id.enablecheck);
enablecheck.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if(enablecheck.isChecked()){
startService(new Intent(HomeScreen.this, AutoService.class));
} else {
stopService(new Intent(HomeScreen.this, AutoService.class));
} } });
}
This is Service Class:
public class AutoService extends Service {
private static final String TAG = "AutoService";
private Timer timer;
private TimerTask task;
@Override
public IBinder onBind(Intent intent) {
return null;
} @Override
public void onCreate() {
Toast.makeText(this, "Auto Service Created", Toast.LENGTH_LONG).show();
Log.d(TAG, "onCreate");
int delay = 5000; // delay for 5 sec.
int period = 5000; // repeat every sec.
timer = new Timer();
timer.scheduleAtFixedRate(task = new TimerTask(){
public void run() {
System.out.println("done");
} }, delay, period);
}
@Override
public boolean stopService(Intent name) {
// TODO Auto-generated method stub
timer.cancel();
task.cancel();
return super.stopService(name);
} }

View 3 Replies View Related

Android :: Droid Screen Locked - Service Stop / Can I Solve It

Sep 18, 2009

I had the program I wrote a service, and in service has written a timer, change the timer for one minute cycle time, but why the program in the phone standby (screen lock) were time, I have the timer will be stop running, when I click the menu, get back to normal mode when the timer will automatically have to run? What is the reason, how to solve?

View 2 Replies View Related

Android :: Where To Stop / Destroy Threads In Droid Service Class?

Mar 25, 2009

I have created a threaded service the following way. code...

After I close the application the phone works really slow and I guess it is due to thread termination failure.

Does anyone know what is the best way to terminate all threads before terminating the application?

View 3 Replies View Related

Android :: How To Stop Service Started By BindService() With Bind_auto_create Option

Nov 18, 2010

I start service by using:

private ServiceConnection _serviceConnection = new ServiceConnection() {...}
bindService(new Intent(this, MainService.class), _serviceConnection, Context.BIND_AUTO_CREATE);

I want to 'restart' the service. (Let's not argue why I want to do that)
I do that by:

unbindService(_serviceConnection);
// Do some initialization on service
bindService(new Intent(this, MainService.class), _serviceConnection, Context.BIND_AUTO_CREATE);

I noticed service doesn't die(onDestroy doesn't run) until I call next bindService();
So some static initialization I did on service got cleared by onDestroy() implementation.

Question: How do you make sure unbindService() will stop service (run onDestory()),
so that I could do initialization after and re-run bindService()?

View 3 Replies View Related

Samsung Epic 4G :: Hotspot Service Running / Stop It From Starting?

Sep 18, 2010

Ok, so i go to check running services and i see that sprint hotspot is running. i have not started it since the day i bought the phone. i have no intention of using it, for now. why is it running and how can i stop it from starting? is it supposed to be running?

View 2 Replies View Related

Motorola Droid X :: Data Synchronization Doesn't Appear To Stop - Battery Dying

Sep 20, 2010

I don't know what I did, but it seems that my data synch is on non-stop. Maybe I never noticed before but in the notification bar, I see the recycle arrow icon just to the left of 3G and I can't seem to turn it off and my battery is running out faster than normal and the phone is very hot. I have used the Power Widget to power cycle (turn on/off) the data sync to no avail...

View 9 Replies View Related

Android :: Droid Phone Vibration Doesn't Stop Using Cancel Method / Way To Do

Jul 10, 2010

I wrote some code that mute the phone whenever an incoming call is received.
When the phone in vibrate mode I use the following code to stop the phone vibration:

Vibrator vib = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
vib.cancel();

While it worked on my Nexus One with android 2.1, it seems that it doesn't stop the vibration on an HTC Desire handset with android 2.1.
Have someone encountered this issue?

View 2 Replies View Related

HTC Droid Eris :: Ringtone Doesn't Stop / Edit Keyboard Input Sound When Typing - Resolve These?

May 9, 2010

Just wondering if there is anyway to set my phone in such a way that my ring tone will turn off when I open the phone (either unlock/ do anything to the phone). As it is right now my ring tone (a full mp3 song imported from my pc) will play until I drag down my notification bar. I'm using tone picker and handcent sms if it makes any difference.

Also, is there a way to edit the the keyboard input sound when typing with the stock keyboard?

View 7 Replies View Related

HTC Droid Eris :: Battery - Charge Stop Charge Stop Continuous

May 28, 2010

My battery keeps on over heating when i charge it. My battery started acting funny this week when i plugged it in to the charger and it would charge stop charge stop continuous. Should i take it up to Verizon and see what they say.

View 13 Replies View Related

Android :: Android LocationManager Stop Listening GPS - Stop The App

Nov 17, 2010

I have a very simple app. I have simplified for sake of discussion, but I think this is a good representation.

My issue is that when I exit the app, the GPS continues receive updates. As far as I can tell the app never stops running, it just no longer displays the map activity.

I have to be missing something important.

CODE:..............

View 2 Replies View Related

HTC EVO 4G :: Was Just Asked To Update On My EVO?

Oct 24, 2010

just got a message thst poped up on my EVO asking me if i wish to update,iam rooted on 2.2,what to do?

View 4 Replies View Related

Samsung Vibrant :: Warning Tmobile Asked About Voodoo

Nov 6, 2010

I bricked my Vibrant right after an all night no holds barred recovery using Odin. Long story.I then allowed the Froyo update and it completely bricked my phone dead! Tmo is sending a new unit but asked if I had used Voodoo Lag Fix. Odd thing to ask and I can only assume they were going to void my handset exchange.Word to the wise. Stay away from voodoo?They confirmed that phones are bricking with the Froyo ota update. I'm just saying!

View 9 Replies View Related

Android :: Android Remote Service Doesn't Call Service Methods

May 28, 2010

I'm developing a GPS tracking software on android. I need IPC to control the service from different activities. So I decide to develop a remote service with AIDL.This wasn't a big problem but now it's always running into the methods of the interface and not into those of my service class. Maybe someone could help me?If i now try to call a method from an activity for example start(trackId) nothing happens. The binding is OK. When debugging it always runs into the startTracking() in the generated ITrackingServiceRemote.java file and not into my TrackingService class. Where is the problem? I can't find anything wrong.

View 1 Replies View Related

HTC EVO 4G :: Stop Blinking

Jun 12, 2010

Is there any possible way to get the LED to quit blinking orange constantly when the battery is low? It's incredibly annoying to have the phone flashing at me out of the corner of my eye for hours on end...

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved