android - force close, stop the app altogether - android

Our app is working great until we shut down the phone. When we power it back on the app comes up but the buttons and anything else are not responding to anything. I a, thinking its because we are not killing the app altogether when the phone shuts down. How to properly do that? How to force the app to shut down properly when the phone is being shut down?

Your problem almost certainly lies elsewhere as the kernel will fully close any apps you have running when you shut the phone down.

Related

android:process=":remote" doesnt prevent separate process from being destroyed with Force Close

Im using Sumsung GT-S7710 android version 4.1.2 . When I force close my app from app list in my phone manually - separate service process becomes dead. I can see it in studio. And trully it doesnt work any more (I used to check it with shedulled launching of notification sound). But in many places over the net people say android:process=":remote" option will prevent my service from being killed, but it seems not working for Force Close case. Any suggestions appreciated. Thx in advance.
<service android:name=".ActService" android:process=":remote"/>
When I force close my app from app list in my phone manually
What you appear to mean is that you are going to the Settings app, to the Apps screen within there, finding your app, and tapping the "Force Stop" button.
separate service process becomes dead
Sure. All of your processes will be terminated if the user force-stops the app through Settings.
But in many places over the net people say android:process=":remote" option will prevent my service from being killed, but it seems not working for Force Close case.
Correct. It is not supposed to work for that case. Where a separate process may help is if the user swipes your app's task off of the overview screen (a.k.a., the recent-tasks screen).

CPU still running when user leaves app

I am building an android app with a map inside of it. It seems that when the user leaves the app (home button or back button), the app still uses cpu. The User and Kernal field jump from 0.00% to about 0.86% (at max) all the time after the user leaves the app. It seems to be killing the battery in my phone if I don't force close the app. Could the GPS be the issue of always searching? How could I stop all running processes with GPS if that is the issue?
thanks!
To kill a process you can use
android.os.Process.killProcess(android.os.Process.<PID>());

How can I trigger my app to reopen whenever the device sits idle for a period of time?

I have an app that needs to reopen when the device isn't used, I've searched the internet but I didn't find what I was looking for.
How can I automatically reopen my app when the device isn't used for 10 seconds?
maybe you want to use WAKE-LOCK, which prevents the screen from going blank after a period of non-use. Rather than "reopen" your app, simply prevent it from closing.
http://developer.android.com/reference/android/os/PowerManager.WakeLock.html
The wake lock is no longer in effect once your user has switched out activities.
And if I installed an app that woke itself back up to the forefront after I'd switched out and away from it I'd uninstall. What is it that you're trying to do that is so important you've got to pester your user even after they've left your app? Describe the scenario - maybe there's an alternative to annoying your user to death.

background service makes app crash after unlocking the real device

I am running a background service which checks for some updates from the server every 2 hours in my android app and it works fine so long as the device is the not in the locked state. But once I lock my phone and unlock again I see my device displaying the message that my app has crashed. What could be the real reason behind it. Does it need some permissions to be declared. Could anyone suggest me as to why this is happening.
It can be happening from several causes. But I gonna give my guess: are you taking in consideration the case that your app fails to reach the server? What I mean is that I'm guessing that when you lock your phone, or close it in some way, it can be closing your connection and your app can be crashing because it fetchs the server without connection. Its only a very broad guess...

Is it fine if I see my application from Settings App in the emulator has Force Close option enabled even tough I have come out of my application?

I have written a simple database program in android. It runs fine, there is no force close error. But I checked from my application from Settings App I see the Force Close option enabled, which implies that my application is still running in the background, even though I have completely came out from my application to the home screen by pressing back key. And moreover I am not using any services, alarm or broadcast things.
Can some one please guide me what may be the probable reason?. Or is it okay? Or will it crash if I put it on device?
Can some one please guide me what may be the probable reason?. Or is it okay? Or will it crash if I put it on device?
Your application is alive until Android OS needs more memory and destroys it. What I have understood does Android start destroying activities before killing the whole application. This means that your application can be alive even if you have finished your activities.
Do not worry about this; Android OS is handling this extremely well.

Categories

Resources