One-Click Maps enable/disable script *needs root*

Search This thread

asianftw

Senior Member
Nov 28, 2010
103
50
For those that are experiencing battery drain because Maps app keeps opening in the background no matter how many times you force close it, I made a very simple script to completely freeze it (and defrost it if it's already frozen) with one click(technically two lol).

Attached Files:
freeze-maps -- it auto detects if Maps is already enabled or disabled, and does the opposite.
maps-disable -- it simply runs the disable Maps command, won't hurt even if the maps is already disabled
maps-enable -- it enables Maps, won't do any harm if Maps is already enabled

Instruction:

1. Download and Install Script Manager in the market (there's a free version)
2. Download the attached freeze-maps.sh.txt and put it in your SD card, say under Documents
3. Open Script Manager, locate the file (freeze-maps.sh.txt) you just downloaded, open it by long press and open as... Script/Executable
Check "run as root", check "Configure as favorite", Click Save and click Exit
4. You can now quit the Script Manager app
5. On your preferred launcher, create a new widget, choose script manager, and then the freeze-maps.sh.txt script (it should be there, since you bookmarked it at step 3).
6. Now you can enable/disable Maps with just using the widget on your Launcher!



************************************************
For those getting an error with freeze-maps.sh.txt, it means your "pm" command doesn't support filter and it won't function as intended. You can either use maps-disable/maps-enable as two separate widgets

or you can do the following(at your own risk):

I attached a copy of my own "pm" executable file that was found in my device, you just gotta replace yours with it.

How-to:
1. Download the attached file - pm.zip
2. Use root explorer and go to /system/bin
3. mount it as writable by pressing the little button says "Mount R/W", it will change to "Mount R/O"
4. rename your pm to pm.bak (for backup) and replace it with the file pm found in pm.zip
5. Long click on the pm file you just extracted here and choose permissions:
Owner = Read/Write/Execute
Group = Read/Execute
Others = Read/Execute
Click Ok
5. Mount your system back to read only by pressing "Mount R/O" and you should be set
******************************************

PS: please let me know if there's any error since this is the very first Android script I wrote, Thanks for Looking ;-)

*Disclaimer: As usual, I am not responsible for any damage to your device, it's do it at your own risk. I will try my best to help though.


PPS: The geeky stuff - you can of course edit the script or run the command "pm" in a terminal and use it to enable/disable any annoying process, but you need to know what you are doing!!!! I personally froze the market updater and twitter app and some other bloatwares that came with the streak.
 

Attachments

  • freeze-maps.sh.txt
    328 bytes · Views: 186
  • maps-disable.sh.txt
    73 bytes · Views: 87
  • maps-enable.sh.txt
    71 bytes · Views: 64
  • pm.zip
    273 bytes · Views: 62
Last edited:

asianftw

Senior Member
Nov 28, 2010
103
50
I am running this fine on streadriod 2.3 by fards, let me check and get back to you

But the new additional attached files at the first post should solve your problem for now.
it wont detect if you have maps enabled or disabled, but it will do what it's file name implied respectively.

Just use Script Manager to Run it, you can also make two Widgets for enabling/disabling.
 
Last edited:
  • Like
Reactions: haynesteve

asianftw

Senior Member
Nov 28, 2010
103
50
Shows
# Error: unknown option: -d
+
(loads a stuff)
+
Maps is now disabled

Maps disappears off my Apps list - I re-run the script, same message, and still no maps. How do I get Maps back ?

if you have a terminal installed, try to run this > ( === enter means hit enter)
su === enter
pm list packages -d === enter

and let me know the result.
 

asianftw

Senior Member
Nov 28, 2010
103
50
Again shows Error: unknown option: -d
(list usage perameters)

Using Streakin v1.1

Oh that's probably why.. Because Streakin is mostly based on stock rom and I guess -d is some kind of option that only available in the custom roms like on DJ steve's or fard's


If it's not too much trouble, it would be great if you can message me the output of the command so I will see if i can write a working script for the stock rom accordingly

just type(in terminal):
su
pm

and in your terminal software, there's an option "email to". just copy and paste the contents in to a private message via xda.

Thanks so much
 

hshah

Senior Member
Dec 24, 2005
2,193
395
Samsung Galaxy S23 Ultra
Thanks for this script, it works brilliantly.

I am trying to modify this script to check of com.facebook.katana is running and do the same for Facebook, but I am not sure how to check if that service is running.
 

asianftw

Senior Member
Nov 28, 2010
103
50
Thanks for this script, it works brilliantly.

I am trying to modify this script to check of com.facebook.katana is running and do the same for Facebook, but I am not sure how to check if that service is running.

i did it for some of those apps that have the tendency to stay in the background even you force close it.

you can check if it's running by going to Setting -> application -> running service
you can also check what apps are occupying your resource with an app called "Betterbatterystat"
 

asianftw

Senior Member
Nov 28, 2010
103
50
Sorry, I meant via a script to replace "pm list packages -d".

you can look into using pid or look here for some similar info
i can get back to you when I have more time in hand.

But what i can ensure you is: if you have facebook installed, it IS running in the background, period. 100% of the time. It's not using much of my battery though, so I just leave it as that.
 

Razak RK

Senior Member
Jun 24, 2013
90
8
Kuala Lumpur
@asianftw & @hshah,
These are great! Thank you. Will try them soon. :)
Can you add more apps for this.
And can you make it into auto-mode? Meaning any apps will be freeze when not in use, but will be turned ON when user click those app OR triggered by incoming update (like FB) or at least, set to a fix frequencies to check for update (say every 30 minutes / hourly / "x" hours). If it is possible, this will be a must have app. :D

Dell Streak | InnerSD 8GB | ExternalSD 32GB | LXdroid 0.2
 

Top Liked Posts

  • There are no posts matching your filters.
  • 9
    For those that are experiencing battery drain because Maps app keeps opening in the background no matter how many times you force close it, I made a very simple script to completely freeze it (and defrost it if it's already frozen) with one click(technically two lol).

    Attached Files:
    freeze-maps -- it auto detects if Maps is already enabled or disabled, and does the opposite.
    maps-disable -- it simply runs the disable Maps command, won't hurt even if the maps is already disabled
    maps-enable -- it enables Maps, won't do any harm if Maps is already enabled

    Instruction:

    1. Download and Install Script Manager in the market (there's a free version)
    2. Download the attached freeze-maps.sh.txt and put it in your SD card, say under Documents
    3. Open Script Manager, locate the file (freeze-maps.sh.txt) you just downloaded, open it by long press and open as... Script/Executable
    Check "run as root", check "Configure as favorite", Click Save and click Exit
    4. You can now quit the Script Manager app
    5. On your preferred launcher, create a new widget, choose script manager, and then the freeze-maps.sh.txt script (it should be there, since you bookmarked it at step 3).
    6. Now you can enable/disable Maps with just using the widget on your Launcher!



    ************************************************
    For those getting an error with freeze-maps.sh.txt, it means your "pm" command doesn't support filter and it won't function as intended. You can either use maps-disable/maps-enable as two separate widgets

    or you can do the following(at your own risk):

    I attached a copy of my own "pm" executable file that was found in my device, you just gotta replace yours with it.

    How-to:
    1. Download the attached file - pm.zip
    2. Use root explorer and go to /system/bin
    3. mount it as writable by pressing the little button says "Mount R/W", it will change to "Mount R/O"
    4. rename your pm to pm.bak (for backup) and replace it with the file pm found in pm.zip
    5. Long click on the pm file you just extracted here and choose permissions:
    Owner = Read/Write/Execute
    Group = Read/Execute
    Others = Read/Execute
    Click Ok
    5. Mount your system back to read only by pressing "Mount R/O" and you should be set
    ******************************************

    PS: please let me know if there's any error since this is the very first Android script I wrote, Thanks for Looking ;-)

    *Disclaimer: As usual, I am not responsible for any damage to your device, it's do it at your own risk. I will try my best to help though.


    PPS: The geeky stuff - you can of course edit the script or run the command "pm" in a terminal and use it to enable/disable any annoying process, but you need to know what you are doing!!!! I personally froze the market updater and twitter app and some other bloatwares that came with the streak.
    1
    I am running this fine on streadriod 2.3 by fards, let me check and get back to you

    But the new additional attached files at the first post should solve your problem for now.
    it wont detect if you have maps enabled or disabled, but it will do what it's file name implied respectively.

    Just use Script Manager to Run it, you can also make two Widgets for enabling/disabling.
    1
    Thank you

    enable script has 1st line as

    pm enable com.google.android.apps.maps\

    which doesn't work - however after removing the slash, works perfectly. Thank you
    1
    Sent you a PM (not easy as Emulator kept FC - lol)
    1
    Sent you a PM (not easy as Emulator kept FC - lol)

    Thanks for your help !! I see your version of the pm command is missing the filter option, hence rendering the detection error.

    I updated my OP