[Q] How apps prevent Garbage collection and service restart - Java for Android App Development

Hi Everyone,
Today, i have come across an application called SlideLock (https://play.google.com/store/apps/details?id=com.slidelock) in google play. When i was trying this application, i have noticed that the app is using 80MB in my Moto G and the memory was not garbage collected even at high RAM usage. When i am using Task killer application, still the RAM memory is not collected and the app is not even getting restarted as other third party apps.
I have also noticed the Report option disabled in the service. How did they achieve this in their application? Because, i would like to protect my app service from task killers.
I have found the developer is active at a XDA thread (http://forum.xda-developers.com/showthread.php?t=2631047). Can you anyone notify them about this post and help me to get the answers?
Regards,
Venkat.

Related

[Help] Apps keep starting after killed

I am having a SGS asia version with latest firmware.
i have rooted it with su access and using process manager to kill those unwanted application (google map, double clock, and others....) running from behind.
but after certain time (range from 1 hour to 2 hours), those unwanted application will load back and take up the memory again. I have to manually killed them again and the remaining RAM is reduced in the process.
Is anyone facing similar problem ?
anyone know how to permanently stop this ? is there any program in the Samsung that keep summoning those application ?
Thank you.
Ya, I've this problem too, but mine is the stock firmware.I've no idea what causes those applications to launch themselves.
yes, a few of my friend also facing this problem. that is why i am thinking is some professional here can help us on this question.
Thanks
If you have rooted your phone, download this app called startup manager from market place, then disable these apps from the start up process. Viola, no more.
Seifer1975 said:
If you have rooted your phone, download this app called startup manager from market place, then disable these apps from the start up process. Viola, no more.
Click to expand...
Click to collapse
Is this startup manager for choosing which applications to auto start during soft reset only though?
You might also want to give "automatic task killer" from the market a go too, first app I would install after flashing roms.
Seifer1975 said:
If you have rooted your phone, download this app called startup manager from market place, then disable these apps from the start up process. Viola, no more.
Click to expand...
Click to collapse
I have installed startup manager application and already disable them at the startup. But they still coming back once a while when the phone is running......
I have successfully stop them from launch at the starting but after a while, it keep coming back. What is more irritating is once i kill them, they launch again 1-2 hours later....
i am thinking , is there any application running underground which keep "calling" them ?
After reading the help section on the system panel I installed, apparently the way android works is by loading up apps that it thinks you might need, so that when you do open them, they're already sitting there ready. system panel shows you a list of apps that are open on your phone and running, open but in the background, and those that on standby. Most task killers only show all these as being open, when they actually all aren't. The maker of the app strongly advises against continually killing all apps, unless any of them have a problem. Anyway, that's just what I read.
Nicolopolus; said:
After reading the help section on the system panel I installed, apparently the way android works is by loading up apps that it thinks you might need, so that when you do open them, they're already sitting there ready. system panel shows you a list of apps that are open on your phone and running, open but in the background, and those that on standby. Most task killers only show all these as being open, when they actually all aren't. The maker of the app strongly advises against continually killing all apps, unless any of them have a problem. Anyway, that's just what I read.
Click to expand...
Click to collapse
I see. Now it does explains everything. Sounds factual to me, if you've read it in the help section of the system panel. Thank you.
Facts are so important in problem solving.
Can you tell us which apps are started every hours like that ??
On my side I would like to know if the following app can be killed :
* Device management
* DRM protected content storage
* SNS
*com.sec.android.app.samsungapps.una
* com.sec.android.providers.downloads
*mobile AP settings
* Mobile Tracker settings
* Log provider
* My upload
* Settings
thanks

These Are My Running Apps

I have the Mugen battery THANK GOODNESS or my Streak would be dead in the water ALL THE TIME .. For those of you that have that battery, I get a long time on a charge. It started telling me a few days ago that I had almost nothing left on the battery at the end of the day where it used to last for a few or more days .. I removed the battery when it told me I had nothing left .. Left it out for a minute .. Put it back in and now it says I have a full charge.
This is a list of my running apps from a fresh start ...
Slide It
Zeam
Visual Voicemail
Dell Settings Storage
Fring
Handscent
White Pages w/ Caller ID
Ebay
EM List
LogMaster2
Quick Office
Quick Office
LogService
Package Checker
LOTA
Gallery
Assistant Free
Dell Sync
Gmail
Amazon MP3
Messaging
Google Search
Market
Clock
I have ** Advanced Task Manager running ALL THE TIME ... and throughout the day I will click on it to END ALL .. it does but they mysteriously start up again ..
I also have ** Startup Cleaner Pro. I have gone in there and told it which ones to NOT allow .. does no good most of the time.
My Streak is the Beta unit with the Froyo update .. I purchased that 'root' program .. have NO IDEA how to use it actually.
Any thoughts ?? What are your ALWAYS RUNNING apps?
HAPPY HOLIDAYS EVERYONE !!
Diane
I was expecting this to be some thread about athletics or jogging
Amazon Mp3 drives me crazy. I have never used it and see no purpose for it running at all. Quick office... 2 instances? Advanced task manager running at all times?
You need to get an app that will show you the services that will run at boot up. I use ES file manager and ES Task manager. With the task manager, I can go to the services portion and kill what I don't need. There is even a way to set apps like Amazon to stop running at boot and that's what you need to do. Your list below with my comments on each one
Slide It You have Swype, do you need this?
Zeam I use it t0o, with Dell stage no choice, I know
Visual Voicemail another something used as a matter of choice
Dell Settings Storage do you use this? if not, disable
Fring shrug
Handscent another shrug... choice again
White Pages w/ Caller ID do I need to shrug again?
Ebay up to you
EM List system service
LogMaster2 system service
Quick Office doesn't need to run at all unless you're using it
Quick Office doesn't need to run at all unless you're using it
LogService run by system
Package Checker run by system
LOTA run by system (like error reporting in windows)
Gallery only needs to be active when you're using it
Assistant Free do you use it?
Dell Sync do you use that rag software to sync your device? if not, heave ho!
Gmail running if you want your email to always alert you
Amazon MP3 should not be running if you're not using it
Messaging leave it alone if you like texting
Google Search should not be running if not being used
Market should not be running if not being used
Clock app or wiget?
The long and short is this... go through the list with a services app and disable at startup what you don't want running. Also check yourself on the live wallpapers... those use energy.
Well i can say from experience fring will eat your battery. It burned through 15% of my stock battery in 45 min when i installed it (and stabilized after uninstalling). Also, might look at this post explaining why your battery showed empty, then full once you pulled it / plugged it back in:
http://forum.pocketables.net/showthread.php?t=8300&highlight=Mugen
I am using Autostarts to keep these items closed for good. And since I don't have an unlimited plan I am also using Droid Wall to restrict most apps to accessing the internet over WiFi only.
From what I can tell you is that that's not what he's talking about. The battery is basically 2 batteries linked together. So 2.2 is reading it like this. Did your 2.2 before read it perfectly? Because as another guy said (finding my post on another forum, and as I wrote you a private message but you never answered ) you cant correctly read the battery readings and 2.2 together.

Apps randomly keep starting up in background

So ill go into my system panel and kill all apps. Ill have about 160mb of memory free. Then the launcher obviously restarts and system panel and my widgets all start back up, but what i dint hnderstand is why do thi gs like google voice or the music player start up in the background if i havent even used them? They start up almost instantly....
How can i make sure **** stays off?
Sent from my SGH-T959 using XDA Premium App
Start up manager or similar from the market. Take care though, if you block something that system wants to be launched, it may keep attempting to launch it, leading to high battery consumption
Some app include a service, which they are executed in background. If the service is maually stopped, android can launch it again.
There are many application on the market which stop periodically these app. The point is that if it has a service, there is a reason, and by stopping it, you can obtain a strange comportment.
By example, in the first version of Android, gtalk was used for the authentification on android market, it is very strange but it was like that. The user was not informed of this link which was a kind of transparent. So if you stopped gtalk, you were not able to go on the market.
Do you need a lot of RAM? If yes uninstall the application you don t use, but I advise you to not stop mannually or automatically the application on your phone.
I guess thats how android functions as such. I tried stopping these programs so many times using apps from the market, but it starts again n few minutes. So its like we are wasting our time trying to kill apps.
Autostarts and/or Android Optimizer will stop any unwanted apps from running constantly. Works for me but just make sure you know what you are doing so you don't stop something you need (as described above)..

Apps that runs on startup/background

I hate it when an app runs in the startup specially if the app is not that important. Is there any way of disabling those apps that run in the startup? As well as those apps that runs in the background even if you don't need em to? They eat up RAM and make the NC slow! I wish I can manage them.
Let them be android takes care of itself.
Read this: http://forums.androidcentral.com/general-help-how/102171-apps-always-running.html#post1088042
---
- Sent from my LG Optimus V using Tapatalk
les02jen17 said:
I hate it when an app runs in the startup specially if the app is not that important. Is there any way of disabling those apps that run in the startup? As well as those apps that runs in the background even if you don't need em to? They eat up RAM and make the NC slow! I wish I can manage them.
Click to expand...
Click to collapse
Yes...get an app in the market called Android Optimizer, it is free. In the menu hit the startup manager icon. Disable the app (s) you don't want to run at start up or background.
StarlahRain said:
Yes...get an app in the market called Android Optimizer, it is free. In the menu hit the startup manager icon. Disable the app (s) you don't want to run at start up or background.
Click to expand...
Click to collapse
You sure of that name? I did a search in the market and do not see it.
StarlahRain said:
Yes...get an app in the market called Android Optimizer, it is free. In the menu hit the startup manager icon. Disable the app (s) you don't want to run at start up or background.
Click to expand...
Click to collapse
You do not need an app like this. People use task killers and startup blockers and then complain about how crappy and slow stuff is because THEY ARE NOT ACTUALLY RUNNING IN THE BACKGROUND. They are cached for faster start up next time. They do not take up any battery or CPU power. Android is linex not windows.
--------------------------------------------------
Here is the post i linked to earlier:
I develop Android apps so I though I'd explain why a task killer isn't needed on an Android system.
Activities
Android apps use activites to preform tasks. For example, if you use a file manager to send a picture via email, the file manager calls the send activity within an email app, passes the file name to it and the email app sends the picture.. not the file manager. This will result in seeing the email app as "running" even though the user didn't actually launch that email app.
Smaller apps
Using activites helps developers design smaller apps. A file manager app that contains every bit of code needed to do everything a file manager does would likely be so large that no one would want to install it. Developers know that an android phone more than likely has an email app so there is no need for the developer to include email code in his/her file manager to send a picture when he/she can call an activity in an existing email app to do the job. This results in a smaller file manager app since there is no need to include email code or any other code for an activity that can be done via an app that is already present on the phone. This also alleviates redundant code. When you install an app outside of the android market, also known as sideloading, the file manager app calls the package installer (already present in Android) to install the requested app.
Running apps vs. cached apps
The "Manage Applications" list included in many android devices lists running apps as well as cached apps. Cached apps don't use any CPU or battery, they're cached so they will load faster the next time you need them. Killing cached apps results in those apps requiring more time to load the next time they are launched.
System management
By default, every android application runs in its own Linux process. Android starts the process when any of the application’s code (activities) needs to be executed, and shuts down the process when it’s no longer needed and system resources are required by other applications.
* Android is hard coded to automatically kill a task when more memory is needed.
* Android is hard coded to automatically kill a task when it’s done doing what it needs to do.
* Android is hard coded to automatically kill a task when you haven’t returned to it in a long time.
* Most services (while possibly running in the background) use very little memory when not actively doing something.
* A content provider is only doing something when there is a notification for it to give. Otherwise it uses very little memory.
* Killing a process when it isn’t ready only causes it to have to reload itself and start from scratch when it’s needed again.
* Because a task is likely running in the background for a reason, killing it will only cause it to re-spawn as soon as the activity that was using it looks for it again. And it will just have to start over again.
* Killing certain processes can have undesirable side effects. Not receiving text messages, alarms not going off, and force closes just to name a few.
* The only true way to prevent something from running at all on your phone would be to uninstall the .apk.
* Most applications will exit themselves if you get out of it by hitting “back” until it closes rather than hitting the “home” button. But even with hitting home, Android will eventually kill it once it’s been in the background for a while.
If you see an app running that you didn't launch, it's most likely because an activity within that app was called by another app to perform a task. If you kill the app you didn't launch, the system has to relaunch that app in order to complete its task. This is why some people kill a task and then see it immediately running again. Constantly killing that app creates a situation where the user is battling the system resulting in wasted system resources.
Android is Linux
Android is not a Windows-based OS, it is based on Linux. Many of the apps you think are running aren't actually running, they're cached, this is typical with a Linux operating system and is much more efficient than other systems. Cached apps don't use any CPU or battery, they're cached and will load faster the next time they're needed.
Let the system manage resources.
---
- Sent from my LG Optimus V using Tapatalk
patruns said:
You sure of that name? I did a search in the market and do not see it.
Click to expand...
Click to collapse
I apologize ..it is called Optimize Tool Box...lite version(free)...
koopakid08 said:
You do not need an app like this. People use task killers and startup blockers and then complain about how crappy and slow stuff is because THEY ARE NOT ACTUALLY RUNNING IN THE BACKGROUND. They are cached for faster start up next time. They do not take up any battery or CPU power. Android is linex not windows.
--------------------------------------------------
Here is the post i linked to earlier:
I develop Android apps so I though I'd explain why a task killer isn't needed on an Android system.
Activities
Android apps use activites to preform tasks. For example, if you use a file manager to send a picture via email, the file manager calls the send activity within an email app, passes the file name to it and the email app sends the picture.. not the file manager. This will result in seeing the email app as "running" even though the user didn't actually launch that email app.
Smaller apps
Using activites helps developers design smaller apps. A file manager app that contains every bit of code needed to do everything a file manager does would likely be so large that no one would want to install it. Developers know that an android phone more than likely has an email app so there is no need for the developer to include email code in his/her file manager to send a picture when he/she can call an activity in an existing email app to do the job. This results in a smaller file manager app since there is no need to include email code or any other code for an activity that can be done via an app that is already present on the phone. This also alleviates redundant code. When you install an app outside of the android market, also known as sideloading, the file manager app calls the package installer (already present in Android) to install the requested app.
Running apps vs. cached apps
The "Manage Applications" list included in many android devices lists running apps as well as cached apps. Cached apps don't use any CPU or battery, they're cached so they will load faster the next time you need them. Killing cached apps results in those apps requiring more time to load the next time they are launched.
System management
By default, every android application runs in its own Linux process. Android starts the process when any of the application’s code (activities) needs to be executed, and shuts down the process when it’s no longer needed and system resources are required by other applications.
* Android is hard coded to automatically kill a task when more memory is needed.
* Android is hard coded to automatically kill a task when it’s done doing what it needs to do.
* Android is hard coded to automatically kill a task when you haven’t returned to it in a long time.
* Most services (while possibly running in the background) use very little memory when not actively doing something.
* A content provider is only doing something when there is a notification for it to give. Otherwise it uses very little memory.
* Killing a process when it isn’t ready only causes it to have to reload itself and start from scratch when it’s needed again.
* Because a task is likely running in the background for a reason, killing it will only cause it to re-spawn as soon as the activity that was using it looks for it again. And it will just have to start over again.
* Killing certain processes can have undesirable side effects. Not receiving text messages, alarms not going off, and force closes just to name a few.
* The only true way to prevent something from running at all on your phone would be to uninstall the .apk.
* Most applications will exit themselves if you get out of it by hitting “back” until it closes rather than hitting the “home” button. But even with hitting home, Android will eventually kill it once it’s been in the background for a while.
If you see an app running that you didn't launch, it's most likely because an activity within that app was called by another app to perform a task. If you kill the app you didn't launch, the system has to relaunch that app in order to complete its task. This is why some people kill a task and then see it immediately running again. Constantly killing that app creates a situation where the user is battling the system resulting in wasted system resources.
Android is Linux
Android is not a Windows-based OS, it is based on Linux. Many of the apps you think are running aren't actually running, they're cached, this is typical with a Linux operating system and is much more efficient than other systems. Cached apps don't use any CPU or battery, they're cached and will load faster the next time they're needed.
Let the system manage resources.
---
- Sent from my LG Optimus V using Tapatalk
Click to expand...
Click to collapse
Yes..I have noticed some side effects.alarms and what not. I guess ur right the only real way is to completely uninstall the apk ..would u happen to know why my adw launcher keeps forceclosing each time boot my nook? I am not running any icon packages..so what other source (or app) could be calling on it to run at startup?
StarlahRain said:
Yes..I have noticed some side effects.alarms and what not. I guess ur right the only real way is to completely uninstall the apk ..would u happen to know why my adw launcher keeps forceclosing each time boot my nook? I am not running any icon packages..so what other source (or app) could be calling on it to run at startup?
Click to expand...
Click to collapse
I am not familiar with adw. Is there an option to save it in memory I know that many replacement launchers do so you might want to make sure that is checked.
Also if you are using a task killer, it is probably trying to kill it and that could cause it to force close.
---
- Sent from my LG Optimus V using Tapatalk
StarlahRain said:
Yes..I have noticed some side effects.alarms and what not. I guess ur right the only real way is to completely uninstall the apk ..would u happen to know why my adw launcher keeps forceclosing each time boot my nook? I am not running any icon packages..so what other source (or app) could be calling on it to run at startup?
Click to expand...
Click to collapse
Do you have Titanium Backup installed? You can clear data and uninstall apps with that as well.
auto starts kills those apps... i run it on my NC>.......i dont need dialer /voicemail...etc.....
Just a thought but if you continue to have force close issues with apps, try running fix permissions. This usually ends the issues. I run adw ex and have no problems. Those few times I have had issues, fix permissions has solved the problem. Just sayin.....
Sent from my NookColor using Tapatalk

Why some apps are only like a service?

Hi, why some default apps run only like a service? Gmail app and gtalk app runs only like a service...
And are some apps appear in Active Apps panel ans not appear in In Progress panel... Is very confusing... I'm not understand what app are running and consuming battery and memory...
Someone can help ?
If the cpu usage for app is 0%, it doesn't consume battery. And freeing memory doesn't help with battery drain, it's quite opposite. Try to find some threads here in "General" section with keywords: ram, multitasking, lmk, minfree...
Ps. Android isn't windows, so things work quite differently..
Sent from my GT-I9000 using xda premium
acazsouza said:
Hi, why some default apps run only like a service? Gmail app and gtalk app runs only like a service...
And are some apps appear in Active Apps panel ans not appear in In Progress panel... Is very confusing... I'm not understand what app are running and consuming battery and memory...
Click to expand...
Click to collapse
There is a difference between a service and a process.
A service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.
Click to expand...
Click to collapse
When an application component starts and the application does not have any other components running, the Android system starts a new Linux process for the application with a single thread of execution. By default, all components of the same application run in the same process and thread (called the "main" thread).... Every application runs in its own process and all components of the application run in that process, by default
Click to expand...
Click to collapse
The Android system tries to maintain an application process for as long as possible, but eventually needs to remove old processes to reclaim memory for new or more important processes. To determine which processes to keep and which to kill, the system places each process into an "importance hierarchy" based on the components running in the process and the state of those components. Processes with the lowest importance are eliminated first, then those with the next lowest importance, and so on, as necessary to recover system resources.
Click to expand...
Click to collapse
In a few words... Gmail and Talk are only services that are constantly monitoring incoming push data from the Google servers. There is also a WhatsApp, Google+, Music, Email, and many other services that are automatically started when an event triggers them. This depends on the app. Not all apps have services. For instance, a Live Wallpaper is a service, not a process. You should not kill those.
When you run an application, you start a process. This process holds all the UI and logic to display the application in your screen. If you press HOME on your phone, the process goes to inactive mode, and it "in theory" should stop using CPU cycles and will sleep in your RAM until you execute the app again, or until Android claims the RAM and kills the app. RAM does not kill your battery, CPU cycles do.
Source: http://developer.android.com/guide/topics/fundamentals.html
In a few words... Gmail and Talk are only services that are constantly monitoring incoming push data from the Google servers. There is also a WhatsApp, Google+, Music, Email, and many other services that are automatically started when an event triggers them. This depends on the app. Not all apps have services. For instance, a Live Wallpaper is a service, not a process. You should not kill those.
Click to expand...
Click to collapse
Why should not I kill them? I installed Germini App and stop GTalk and others to automatically init on boot.
up........

Categories

Resources