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.

Android :: force service to stop after fixed time?


Android :: Set Alarm To Fire Properly At Fixed Time?

Jun 7, 2010

Calendar c = new GregorianCalendar();
c.add(Calendar.DAY_OF_YEAR, 1);
c.set(Calendar.HOUR_OF_DAY, 23);
c.set(Calendar.MINUTE, 22);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);

// We want the alarm to go off 30 seconds from now.
long firstTime = SystemClock.elapsedRealtime();
firstTime += 30*1000;
long a=c.getTimeInMillis();

// Schedule the alarm!
AlarmManager am = (AlarmManager)ctx.getSystemService(Context.ALARM_SERVICE);
am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
c.getTimeInMillis(), 1*60*60*1000, sender);


It is not executed at 23:22h. What I am doing wrong? I noticed firstTime and c.getTimeInMillis() differs a lot in size and length. When I use firstTime, so when set to 30 seconds, the alarm is executed well.

View 3 Replies View Related

HTC Incredible :: Cracked Screen - What Is The Turn Around Time To Get It Fixed?

Oct 10, 2010

My Incredible fell out of my pocket when I was getting out of my car and it cracked. The touchscreen on the Incredible still works, but the glass/LCD (or digitizer) is cracked. I don't have the insurance and since it's been a few months, I can't add it.

1) How much will Verizon charge to replace the glass/LCD (or digitizer) or provide a replacement phone?
2) What is the turn around time to get it fixed?

View 1 Replies View Related

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!

View 6 Replies View Related

Android : How To Start An App After A Force Stop?

Oct 22, 2010

If I Force Stop an app (via Settings->Applications->Manage Applications->Any App->Force Stop) will the app ever start up automatically again or is the only way to start it up again to have the user start it. I have an app that starts a service. The service registers an alarm I've defined, with the Alarm Manager and this is recieved as expected. In my manifest I've defined a TimerIntentReceiver, to receive that alarm I've defined. If I Force Stop the app then is it possible to have the Alarm Manager "wake" my app up via the TimerIntentReceiver I've defined. I'm not seeing this happen. Once I Force Stop my app it never runs again unless I manually start it. Is there anything I can listen for, apart from BOOT_COMPLETE, to start up my app? Or does the user always have to start all apps.

View 2 Replies View Related

Android :: Whats Fastest Way To Force Stop?

Aug 6, 2010

I've done a search but found nothing. It seems like when I have to force stop an application, it takes me 8-10 button presses to accomplish it (menu-settings-applications-manage applications-sort by size-sort az-find application-scroll down-force stop). It's just not easy. Especially if I'm driving or jogging. Is there a quick and simple way to force stop an application?

View 3 Replies View Related

Android :: Detect That Force Stop Was Called?

Nov 10, 2010

Is there any way for a process to detect that its being stopped as a result of the user going to Settings->Applications->Manage Applications->My App->Force Stop? I see onDestroy() isnt being called under those circumstances.

View 2 Replies View Related

Android :: How To Stop Email Intent To Cause Force Close Error?

Jul 16, 2010

I just ran into a problem when trying to launch the phone's email app via a button in the options menu because as soon as I click the button in the emulator it causes a force close error.

View 2 Replies View Related

HTC EVO 4G :: Android Process Force Close All The Time

Jul 29, 2010

I get this error all the time when using apps or putting apps on my home screen or doing almost anything. I'm using cm6 And snapv3.

View 2 Replies View Related

Android :: Service With MediaPlayer Force Closes

Aug 1, 2010

I have a Service with a MediaPlayer which streams audio from the Internet but when I press the Home button and it goes back to the home screen it Force Closes. It's strange though because it works perfectly in the emulator and sometimes it doesn't Force Close on my phone (G1), when I've just turned it on.

This is my code:

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

Log:

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

View 1 Replies View Related

Android :: Service Always To Restart Even If Force To Kill It?

Apr 22, 2009

Is there any way not to force to restart the service once the service crash and is killed?

View 11 Replies View Related

HTC EVO 4G :: Force Stop Safe To Do?

Sep 14, 2010

I've read about how task killers aren't necessarily good because of the way they FC apps, so I'm wondering, is it safe to go into my Running Apps list and Force Stop certain apps? I'm thinking of apps like Amazon MP3, Maps, Peep, Facebook, Fandango, etc. General things like that, nothing system-important.

View 5 Replies View Related

Android :: Force WVGA Droid Browser To Stop Scaling Images?

May 9, 2010

I'm designing an HTML page for display in Android browsers. Consider this simple example page:

<html>
<head><title>Simple!</title>
</head>
<body>
<p><img src="http://sstatic.net/so/img/logo.png"></p>
</body>
</html>

It looks just fine on the standard HVGA phones (320x480), but on HDPI WVGA sizes (480x800 or 480x854) the built-in browser automatically scales the image up; it looks ugly.

I've read that I should be able to use this tag to force the browser to stop scaling my page:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" />

... but all that does is disable user scaling (the zoom buttons disappear); it doesn't actually prevent the browser from scaling my image. Adjusting the scale factors (setting them all to 2.0 or 0.5) has no effect at all.

How can I force the WVGA browser to stop scaling my images?

View 3 Replies View Related

Android :: 1.6 SDK WebView - Application Force Closes Every Time

Sep 29, 2010

I've narrowed down the problem to WebView; my application force closes every time. If I take out the WebView and put in a color change button or something, the case switching works and the application loads. I'm fairly new to the plaform, but I'm (mostly) copying directly from examples here for WebViews.

CODE:........

main.xml

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

AndroidManifest.xml

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

View 1 Replies View Related

Android :: Local Service Not Registering - Force Closes

May 6, 2010

Essentially my problem is this, I open my Activity. It binds to a local service that "appears" to be connected. I get a force close when I press the back button:

"IllegalArgumentException: Service not registered" when unbind is called in my onPause method...
public void onPause() { super.onPause(); if (isFinishing()) {
if (mConnection != null){ Log.i(TAG,"onPause, mConnection" + mConnection.toString());
mDbS.unbindService(mConnection); }else { Log.i(TAG,"mConnection is null");
} The service is bound in onCreate // bind to our sdCard database using our Service Connection
mServiceIntent = new Intent(this,DatabaseService.class);
if(bindService(mServiceIntent, mConnection, Context.BIND_AUTO_CREATE)){
Log.e(TAG, "service bound"); }else{ Log.e(TAG, "service not bound");
} bindService is returning true.

My Service connection is as follows. onServiceConnected is called and goes to completion. onService Disconnected is never called (presumably because my service is in same process)
private ServiceConnection mConnection = new ServiceConnection() {
public final String TAG = "LoadView.ServiceConnection"; //$NON- NLS-1$
public void onServiceConnected(ComponentName className, IBinder service) {
mDbS = ((LocalBinder<DatabaseService>) service).getService(); .....
stuff not relevant.... Log.i(TAG, "finished onServiceConnected");
//$NON-NLS-1$ } public void onServiceDisconnected(ComponentName className) {
Log.e(TAG, "onServiceDisconnectedCalled"); //$NON-NLS-1$ } };

The only thing I do a little different is that I don't use an inner class in my service for the Binder object - I use a separate class. This is mostly because I have several databases and wanted code I could reuse and set up simply rather than worry about all the ins and outs and memory leak issues.

import android.os.Binder; import android.util.Log;
public class LocalBinder<S> extends Binder { private String TAG = "LocalBinder";
private S mService; @SuppressWarnings("unused") private LocalBinder() {
} public LocalBinder(S service){ mService = service;
} public S getService() { return mService;
} public void finalize(){ mService = null;
try { //TODO reinstate this after Issue 8046 is resolved
//super.finalize(); } catch (Throwable e) { Log.e(TAG,"Unable to finalize Binder");
} } }

View 2 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 EVO 4G :: How To Restore Sense After Force Stop?

Jun 27, 2010

A few weeks ago I switched my EVO 4G to the standard Android 2.1 UI through the widely publicized "clear defaults" and "force stop", then pressing "Home" and selecting to default to the Android launcher. This worked very well. Unfortunately for me, I thought this was just going to be a test drive. I wanted to see how it compared to Sense UI, but now I can't figure out how to re-activate Sense. According to the description of the process for other Android phones with Sense, you are supposed to be able to turn Sense back on by doing essentially the same process. Select application "HTC Sense", and do "clear defaults" and "force stop" again. Then press the Home button, and select to default to Sense UI when asked.

This doesn't work on my EVO 4G. When I perform these steps, pressing the Home button has no effect. There is no popup asking which UI to use as default. The standard Android UI remains in effect. I've done a fair amount of google searching, but haven't seen any explanation how to do this so far. I'm hoping that it's possible without wiping the phone back to its initial state. Anyone know how to restore Sense? I'd like to experiment with it, at least until the day Froyo comes out for it.

View 6 Replies View Related

Android :: Why User Report Force Quits Every Time I Load?

Nov 23, 2009

I'm trying to guess why a user would report "Force quits every time I load" the problem does not occur for all users, especially not me.The system constructs a database when it first loads. I suspect that user's phone does not have enough memory.Questions: How can I verify that the system has enough memory to store a small database?
What else might cause a user's particular system to force quit on startup?Wrong answers or things I've tried thus far:The user's hardware is probably different than mine The user's software and available memory is likely different as well The data is already loading in its own thread, with a progress dialog showing

View 4 Replies View Related

Android :: Force Garbage Collection To Happen At Convenient Time?

Apr 15, 2009

I have screen 1 of my app which I want to transition smoothly into screen 2.

I want the transition to be smooth but I don't mind a slight pause before or after the transition. Before the transition I dump a lot of objects that are no longer needed from screen 1.

However, as luck would have it (!), the garbage collection almost always takes place during the transition causing the frame rate to drop and the transition looks terrible :(

Is there a way for me to either force the garbage collection to complete before the transition or delay until after the transition is finished? I have tried System.gc() in various places but it doesn't seem to help performance.

View 2 Replies View Related

Android :: Nothing Works After Reboot - No Service - Complete Force Close

Jan 4, 2010

I've had my htc hero (sprint) for about a month and half now and there has been a major problem i've been dealing with that i cant seem to find a solution to anywhere. everytime i reboot my phone, it wont work after the reboot. i cant get service, only wifi works, i cant access system updates, cant access my phone dialer. nothing works that requires date or service.

what i've tried to do is go to applications manager and ive been able to delete all the data from the google apps. this actually gave my phone service again after reboot, but i was never again able to sync my phone with google. meaning i couldnt get my contacts back, no gmail, and no market.

what ive been doing is having to do a complete hardware reset each time where i would then have to reset up my google account and re-download all my apps, needless to say this takes a lot of time each time. everytime i reboot, or when the battery drains, this happens.

View 3 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 :: Notify Activity / Service Of Force-close Request Right Before It Gets Killed?

Oct 4, 2010

Is there a way to notify an activity/service of a force-close request right before it gets killed?

I mean when the user hits the force close button in Menu>Settings>Applications>Manage applications>app name>Force Close.

View 2 Replies View Related

Android :: At Time Of Closing An Application / How To Stop A Thread?

Jul 5, 2010

I use the following code to receive the data using UDP. When I click the back button my screen visual is closed and it shows the home screen. But a thread is working in the background (it receives the data from the UDP server). When I close the application I also need to stop the thread. How to stop a thread? Code...

View 2 Replies View Related

Android :: Stop Thread At Time Of Closing Application

Jul 4, 2010

I am new to android.At the time of closing application i need to stop the thread in android. Can anyone help me to solve this?

View 2 Replies View Related

Android :: Need App To Stop Things Starting Up All Time On Phone

Aug 10, 2010

Is there any app that will allow me to stop things starting up all the time on my desire. something that maybe i can block apps starting up unless i want them to.

View 1 Replies View Related







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