Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Google maps seems to have an insane amount of Intents registered for it, as well as other ways of being started.

Since this is a pretty resource hungry app (especially memory wise), I would very much want it permanently not running unless/until I actually need it. However, Android keeps starting it all the time - for example, when the connectivity status changes (which for me happens pretty frequently indoors), or GPS/network location changes.

Is there some way of ensuring that Google Maps doesn't start ANY processes, guaranteed, until I click on an icon to deliberately launch it?

Environment: Droid X, running rooted stock Froyo 2.2; I have Autostarts. and Advanced Task Killer, as well as Pro version of Titanium Backup installed.

I'm fairly open to almost any method as long as

  • It's reliable.

  • It lets me use Google Maps with 100% intended functionality once I DO need it, without requiring 5 minutes of work to re-configure.

  • Ideally, doesn't require me to reboot to use it, but this one is not a deal killer.

  • I would STRONGLY prefer a generic method which would be applicable to other applications, NOT just Google Maps.

  • I'm a software developer with a hefty dose of Unix/Linux system administration experience. In other words, solutions which require shell prompt or writing/running shell scripts (or Perl in Android Scripting Environment) are extremely welcome.

    Solutions involving writing my own Java Android app are acceptable as long as they are detailed enough than a total Android development newbie can get at least some work done without being 100% lost.

Things I tried:

  • Killing the processes via Task Killer is NOT working - they come back up, either immediately or in a little while. Probably via Intents but not 100% certain.

  • Standard methods of getting rid of GMaps issues (log out of Latitude/shut down GPS and network locator). This seems to help a lot BUT I find the need to permanently shut down GPS/locator to be unacceptable - e.g. it won't let me run Locale app or locale-based Tasker things.

  • Freeze via Titanium Backup Pro. This requires a reboot and generally not very pleasant.

Possible approaches I thought of (but don't know how to do) are:

  • Somehow FULLY eliminate (turn off) all Intents registered by Google Maps when not needed.

    Problems: First, I don't know what ALL the Intents Google Maps uses.

    Second, the only practical way of doing that that I know of is Autostarts app which is NOT a workable solution - it takes ~5-10 mins to find and re-enable all the intents I am aware of (Autostarts is really poor at per-app intent management - it's centered on per-intent), never mind possible intents that Autostarts does NOT know about (it's a black box, I don't know which intents are missed if any.

  • Have a script which will rename the JARs or whatever the executable files on Android are (entire .APK?) from say GoogleMaps.apk to GoogleMaps.disabled.apk and back.

    Problem: I don't know if this is possible to do on a rooted Froyo. Also, Google Maps was pre-installed on DroidX, so would renaming somehow ONLY affect the update but not the original app?

  • Have a script which will go into the APK and rename/move/empty out manifest file to remove any intents for that app.

    Problem: Would this require a recompile? It definitely requires a reboot which is a minus

share|improve this question
1  
Please note that I'm asking "Is there a way to permanently turn off Google Maps until needed?". I'm not asking "Do I need to permanently stop Google Maps from starting?", or "What are workarounds to keep running GMaps and still keep good battery life". –  DVK Feb 1 '12 at 21:13
    
"Freeze via Titanium Backup Pro. This requires a reboot and generally not very pleasant." That's interesting. Does it do it for all apps, or just something more embedded, like Maps? –  Chance Feb 7 '12 at 18:16
    
@Chance - My impression was that it's for all apps. –  DVK Feb 7 '12 at 18:24
3  
Have you actually tried it? I've used Ti-Bu to freeze apps before, and I haven't had to reboot. –  Chance Feb 7 '12 at 18:28
    
@Chance - My apps that I froze didn't stop re-spawning into memory until I rebooted. May be I was doing it wrong - I only started using TBPro recently. –  DVK Feb 7 '12 at 18:46

7 Answers 7

up vote 1 down vote accepted

From your mentioning of Titanium Backup I assume your device is rooted. So my absolute recommendation here is AutoRun Manager (and yes, you will need the Pro -- second yes, it's worth it). Having that installed, open the app, use the "advanced mode", look for the app you want to modify (in your case: Google Maps). Expand it. ARM will show you all its listeners -- disable them.

That's it. Nothing is waking it up anymore unless you explicitly start it. BUT: Before you start it, you may need to enable those listeners again, or you may experience strange side effects (I did). On the other side, at least this does not require a reboot.

For technical details, you might want to crosscheck with the question How can I manage intent associations with apps, or directly dive into the Intents section of the AOSP developer manuals.

share|improve this answer

First, I suggest you stop using your task killers. They are draining your battery more than saving it. The System is restarting the services when they need to run which is causing battery usage.

Second, you are under the assumption that freeing up memory is a good thing. It is not. Freeing up memory is not going to decrease battery usage. What you really need to look for is the apps that use a lot of CPU cycles. This is what will drain your battery.

Android is based on Linux. Linux always wants to use all the memory available because free memory is wasted memory. The android system will take care of releasing memory of applications that are not in use so other applications can use it when needed.

Even if you try and kill applications that are running and taking up memory, the system will either restart these services/apps, which will cause battery drain because they probably have some syncing that happens when starting up, or just the CPU cycles that are used to initialize the application. Killing the applications will also cause the device to appear slow when trying to start applications because something that normally might be running now needs to be started back up before presenting you with the applications user interface.

Some things that will cause battery drain like GPS, wifi, bluetooth, and data usage are going to use your CPU a lot more to process the data that is being transmitted and received. Turning these off when not in use will save on a lot of battery drain. I have a bad battery in my device, it wont even charge past 94%, but I can get 12 or more hours out of my battery if I turn off these services when I don't need them.

I use google maps all the time, and in my battery stats its not even listed as an app using resources. My highest battery user is the Screen @ 31%, and the lowest shown is GMail @ 3%. I can assure you, google maps is not the cause of your battery drain. Using task killers is more likely the cause. As I said I use google maps for directions almost daily, and it isn't even in the top 10 list of apps that are using my battery.

More information on task killers from the Google Android Developers blog.

A common misunderstanding about Android multitasking is the difference between a process and an application. In Android these are not tightly coupled entities: applications may seem present to the user without an actual process currently running the app; multiple applications may share processes, or one application may make use of multiple processes depending on its needs; the process(es) of an application may be kept around by Android even when that application is not actively doing something.

The fact that you can see an application's process "running" does not mean the application is running or doing anything. It may simply be there because Android needed it at some point, and has decided that it would be best to keep it around in case it needs it again. Likewise, you may leave an application for a little bit and return to it from where you left off, and during that time Android may have needed to get rid of the process for other things.

A key to how Android handles applications in this way is that processes don't shut down cleanly. When the user leaves an application, its process is kept around in the background, allowing it to continue working (for example downloading web pages) if needed, and come immediately to the foreground if the user returns to it. If a device never runs out of memory, then Android will keep all of these processes around, truly leaving all applications "running" all of the time.

Of course, there is a limited amount of memory, and to accommodate this Android must decide when to get rid of processes that are not needed. This leads to Android's process lifecycle, the rules it uses to decide how important each process is and thus the next one that should be dropped. These rules are based on both how important a process is for the user's current experience, as well as how long it has been since the process was last needed by the user.

Once Android determines that it needs to remove a process, it does this brutally, simply force-killing it. The kernel can then immediately reclaim all resources needed by the process, without relying on that application being well written and responsive to a polite request to exit. Allowing the kernel to immediately reclaim application resources makes it a lot easier to avoid serious out of memory situations.

If a user later returns to an application that's been killed, Android needs a way to re-launch it in the same state as it was last seen, to preserve the "all applications are running all of the time" experience. This is done by keeping track of the parts of the application the user is aware of (the Activities), and re-starting them with information about the last state they were seen in. This last state is generated each time the user leaves that part of the application, not when it is killed, so that the kernel can later freely kill it without depending on the application to respond correctly at that point.

In some ways, Android's process management can be seen as a form of swap space: application processes represent a certain amount of in-use memory; when memory is low, some processes can be killed (swapped out); when those processes are needed again, they can be re-started from their last saved state (swapped in).

Here is another article talking about how Task killers will drain your battery.

Do not use Automatic Task Killing Software
To make a long story short, using auto-task killers can cause: excessive battery drain (as if the phone doesn’t drain a battery quick enough already), the phone to overheat often and programs shutting down (crashing) randomly – programs you actually want to use. Stay away from these!

One thing that you could do if you are really set on "stopping maps" until you want to use it is use the Freeze option in titanium backup. This will essentially remove the application from the device and none of the services associated with it will ever start until you un-freeze it.

share|improve this answer
1  
freeing up memory takes my Droid X from crawling extremely slow with ~30-40 MB free to being reasonably responsive and fast with >70MB free, with no apps hogging the CPU in either case. I'm sorry but that's a nice bit of theory that just DOES NOT APPLY in practice. –  DVK Feb 1 '12 at 21:05
    
Also, when Android memory manager kills my web browser losing ALL my open tabs to make space for Google Maps, that's a big productivity hit. –  DVK Feb 1 '12 at 21:06
4  
I am telling you, what you are experiencing is a placebo effect. free memory does not make your device run faster, free CPU does. I have included another reference for you about the topic of task killers (right from google) –  Ryan Conrad Feb 1 '12 at 21:16
2  
Using task killer will cause drain, and I explained why in my answer. On top of that, if you read the entire answer, I give you an exact answer to your problem using titanium by freezing the app. –  Ryan Conrad Feb 1 '12 at 21:20
3  
@Chance no, because if you kill a process that isn't actually running at the time, the system will eventually have to start that process back up and it will do "all of its initialization" which is going to use the CPU. Just because a process is running, doesn't mean that it is actually doing anything at the time. –  Ryan Conrad Feb 7 '12 at 20:17

Have you thought about un-installing and re-installing Maps as a possible solution?

  1. First, get rid of the pre-loaded Maps by deleting the /system/app/Maps.apk file:

    su  
    rm /system/app/Maps.apk
    

    Once a system app is updated, it's useless in the /system/app folder and can be safely deleted.

  2. Then copy the current Maps version to your SD Card:

    cp /data/app/com.google.android.apps.maps*.apk /sdcard/
    
  3. Now uninstall the Maps app:

    pm uninstall -k com.google.android.apps.maps
    

    The "-k" switch keeps the settings for when you re-install the app.

  4. Now to get Maps back simply re-install it from backup:

    pm install -r /sdcard/com.google.android.apps.maps*.apk
    

You can automate these steps via GScript, which allows you to create shortcuts to scripts. So just create one script named "Disable Maps" with the command from step #3, and another one named "Enable Maps" with command from step #4 (check "Needs SU?" for both).

Now you can add 2 GScript shortcuts to your home screen from the scripts you created by using Android's normal "Add Shortcut" method (GScript will be one of the options there.)

The only drawback of this method is that you will most likely lose the Maps shortcut (and/or widget) from your home screen when you uninstall it, requiring you to re-add it after re-installation. You of course will still be able to launch Maps from the app drawer.

share|improve this answer
    
Would this procedure be negatively affected by the fact that Maps was pre-installed on my DroidX? Or that was not in ROM? +1 for excellent idea! –  DVK Feb 1 '12 at 21:28
1  
If you don't remove the system version of the APK first, un-install will fail. Generally, once a system app gets an update from Market, its corresponding APK in /system/app/ folder can safely be deleted. –  Chahk Feb 1 '12 at 21:33
    
@Chank - I assume that, it not being Verizon bloatware, I actually have access to remove the system version as long as I got root? :) –  DVK Feb 1 '12 at 21:39
    
As long as your phone is rooted, you should have no troubles removing Maps.apk from /system/app. –  Chahk Feb 2 '12 at 2:16

I suggest using the Freeze feature of Titanium backup homepage market link. I believe you have to register the app ($6.58) in order to use the feature, but I assure you, it's worth the price if you like to hack your phone. The other main reason to pay for the app (other than to support the developer for writing a fine piece of free software) is to be able to do batch installs (i.e. restoring from backup) of apps and data which you have backed up. Otherwise you have to get through the standard app install dialogs.

From the website about freeze:

App freezer can disable an app (and make it invisible) without un-installing it

Or you can actually do an uninstall and reinstall. You might find there are reasons to do that over freezing, I don't know.

share|improve this answer
    
Sorry, but this isn't helpful. In my question, under "Things I tried", bullet point #3: "Freeze via Titanium Backup Pro. This requires a reboot and generally not very pleasant." –  DVK Feb 7 '12 at 18:12

Beginning with Android 4.0 Ice Cream Sandwich, you can simply disable Google Maps in the system settings. This won't help you if you're still stuck on Froyo, but others may get some benefit from it.

share|improve this answer
    
Does it disable all the associated services? (GM and Latitude etc...)? –  DVK Dec 27 '12 at 19:33
    
It disables that app completely, including everything it brings in. As far as I can tell, that includes Navigation, Latitude, etc. –  Michael Hampton Dec 27 '12 at 19:36

If your phone has the option Settings > Applications > Development > Stop app via long-press, you can always close the Google Maps this way, then this process get killed as well until you open the app again.

share|improve this answer

Root your phone then use the AutoStarts app from Google Play to disable all the events that trigger Maps. It will run fine when manually started but will stay gone when you kill it. Disable anything else you don't need in the After Startup event folder to further reduce memory consumption.

share|improve this answer
1  
Did you read the question carefully? It explicitly states: Second, the only practical way of doing that that I know of is Autostarts app which is NOT a workable solution - it takes ~5-10 mins to find and re-enable all the intents I am aware of (Autostarts is really poor at per-app intent management - it's centered on per-intent), never mind possible intents that Autostarts does NOT know about (it's a black box, I don't know which intents are missed if any. –  DVK Dec 27 '12 at 18:40

protected by Community Feb 20 '13 at 13:48

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.