UBports Robot Logo

    UBports Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [HowTo] Alternate way of saving battery when using 4G/LTE

    Support
    13
    69
    4273
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      Yoni @c4pp4 last edited by Yoni

      @c4pp4
      I didn't mean flight mode, rather just to have the mobile data turned on and off accordingf to the screen state if possible, if not then according to the phone being locked/unlocked.
      That will be so amzing if you can create such a script!
      Sim slot 1 out of 2 (Xiaomi mi A2)

      c4pp4 1 Reply Last reply Reply Quote 0
      • c4pp4
        c4pp4 @Yoni last edited by c4pp4

        @Yoni
        After all I didn't need to know the sim slot number. 🙂
        Here is your script for testing:

        #!/bin/bash
        
        interface=com.canonical.Unity.Screen
        member=DisplayPowerStateChange
        
        dbus-monitor --system "type=signal,interface='${interface}',member='${member}'" |
        while read -r line; do
        	if [[ ${line} == *"int32 0" ]]; then
        		read
        		dbus-send --type=method_call --dest=com.ubuntu.connectivity1 /com/ubuntu/connectivity1/Private org.freedesktop.DBus.Properties.Set string:com.ubuntu.connectivity1.Private string:MobileDataEnabled variant:boolean:false
        	elif [[ ${line} == *"int32 1" ]]; then
        		read
        		dbus-send --type=method_call --dest=com.ubuntu.connectivity1 /com/ubuntu/connectivity1/Private org.freedesktop.DBus.Properties.Set string:com.ubuntu.connectivity1.Private string:MobileDataEnabled variant:boolean:true
        	fi
        done
        
        D Keneda 2 Replies Last reply Reply Quote 1
        • D
          domubpkm @c4pp4 last edited by

          @c4pp4 Hello. I tested your script : it works half for me (Volla OTA-20) ;

          1. Cellular data is not disabled when the screen locks (and turns off) AUTOMATICALLY after the inactivity time set in the system settings.

          2. The script works when you MANUALLY lock the phone by pressing the dedicated side switch.

          Tested and verified by sending an email to myself: case 1: email received black screen ; case 2: email received only when the screen is turned back on by pressing the side switch, which is normal 🙂

          c4pp4 1 Reply Last reply Reply Quote 1
          • D
            domubpkm last edited by domubpkm

            screenshot20211204_085533538.png

            I don't like to press the side switch unnecessarily (so as to save it) to turn off the screen. It make me think that, in my opinion, it lacks the option in the "system" drop down menu: "lock and turn off screen", there is only currently the "lock" option (there is a delay before the screen turns off
            ), or a small .click program, for example like Lock it : Screen off on android, which would be very useful if a developer is able to build that 😉

            1 Reply Last reply Reply Quote 1
            • Keneda
              Keneda @c4pp4 last edited by

              @c4pp4
              Could you make an app your scripts ?
              I mean a "battery saver" app on openstore would have success 😉

              2015-Now : Meizu MX4 (Stable) for daily use
              Spare : Nexus 5 (Stable)

              c4pp4 1 Reply Last reply Reply Quote 1
              • c4pp4
                c4pp4 @domubpkm last edited by

                @domubpkm said in [HowTo] Alternate way of saving battery when using 4G/LTE:

                1. Cellular data is not disabled when the screen locks (and turns off) AUTOMATICALLY after the inactivity time set in the system settings.

                fixed

                D 1 Reply Last reply Reply Quote 2
                • c4pp4
                  c4pp4 @Keneda last edited by

                  @keneda said in [HowTo] Alternate way of saving battery when using 4G/LTE:

                  Could you make an app your scripts ?

                  I'm sorry, I'm not going to do it now. Maybe someone else.

                  1 Reply Last reply Reply Quote 0
                  • D
                    domubpkm @c4pp4 last edited by

                    @c4pp4 Thank you. It is fully functional now. Mails are retrieved automatically once the screen is turned on and combined with the work of @jezek , any mms not received when the screen is off should also be retrievable (untested) once the screen is turned back on. And that's saving battery: useful script 👍

                    c4pp4 1 Reply Last reply Reply Quote 1
                    • c4pp4
                      c4pp4 @domubpkm last edited by

                      @domubpkm @Yoni
                      I've tried the latest script and found out turning cellular data off is not saving battery in my case. I've stopped the script and turned it off from menu and it was the same - not saving. 🤔
                      I've switched back to saving with 2G script and it works without problem. 🤷🏻♂

                      D Y 2 Replies Last reply Reply Quote 1
                      • D
                        domubpkm @c4pp4 last edited by

                        @c4pp4 ??? 🤔🙂 Weird. In any case, for the Volla, it is the cellular data that consumes battery power. And your script can help.

                        1 Reply Last reply Reply Quote 1
                        • Y
                          Yoni @c4pp4 last edited by

                          @c4pp4
                          Sorry for the late reply.
                          I didn't have time to check the script yet, and I'm quite surprised by your results, but I would like to thank you very much for your script!
                          Are you able to see the signal strengths of 2G and 4G in your area to see if that might account for the lack of battery savings?
                          As you could see in my test turning off the data in 4G quadrupled my battery life when I manually turned it off.

                          c4pp4 1 Reply Last reply Reply Quote 0
                          • c4pp4
                            c4pp4 @Yoni last edited by

                            @yoni There is no lack of battery savings when on 2G. In my case it saves the battery power when using the first script to switch between 4G and 2G. It doesn't save battery power when I turn cellular data off completely. It's weird and I don't know why.

                            Y 2 Replies Last reply Reply Quote 0
                            • Y
                              Yoni @c4pp4 last edited by

                              @c4pp4
                              If you have another Android or iPhone to check the signal strength with the same Sim that you use on your UT, there are apps that can show you the actual reception in dBm, so for me at home 4G is at around -90dBm and 2G is around -70dBm.

                              1 Reply Last reply Reply Quote 0
                              • Referenced by  Y Yoni 
                              • Y
                                Yoni @c4pp4 last edited by

                                @c4pp4
                                Can I also ask how did you conclude that there is no savings without mobile data on, was it during normal use? Are you able to check it during a 12/24 hour period when the phone is just sitting idle and untouched?

                                c4pp4 1 Reply Last reply Reply Quote 0
                                • c4pp4
                                  c4pp4 @Yoni last edited by

                                  @yoni I did that when it was idle.

                                  Y 1 Reply Last reply Reply Quote 0
                                  • Y
                                    Yoni @c4pp4 last edited by Yoni

                                    @c4pp4
                                    Are you able to do some testing for at least 12 hours from a full battery to see the differences please?
                                    And are you able to get the dBm numbers for 2G and 4G if possible please?
                                    Are you using an email/IM (Dekko, Teleports..) client that works in the background?
                                    I'm really preplexed that your'e not getting any improvements in battery life. this method had worked with many phones that I tested including iPhones using 4G.

                                    c4pp4 1 Reply Last reply Reply Quote 0
                                    • D
                                      domubpkm last edited by

                                      This script is useful indeed, but it currently has its limits : don't forget to stop it (STOP script name) when cellular data must remain activated in continuous screen off : RADIO app, OTA update, download.... And then restart it (START script name) when you want to use it again.

                                      Maybe the script can be improved ?

                                      1 Reply Last reply Reply Quote 0
                                      • c4pp4
                                        c4pp4 @Yoni last edited by c4pp4

                                        @yoni Maybe it was something to do with TELEports or RC image because now it's without problem and before the latest test I updated both.
                                        I think it's some kind of bug because I forgot to turn off script and that's why it was saving battery. In my case when 4G is set and turned off cellular data - it's not saving battery. When 2G is set and turned off cellular data - it's saving battery. I think it shouldn't matter what is set. 🤔

                                        @domubpkm I'm not going to do that. Use the first or second script if you need connection.

                                        Y 1 Reply Last reply Reply Quote 0
                                        • Y
                                          Yoni @c4pp4 last edited by

                                          @c4pp4
                                          That is very strange, turning off cellular data should save battery by reducing the amount of outgoing radio transmitions, therefore what you are describing is contrary to all of the tests I had made on every OS, are you able to check that cellular data is actually turned off in 4G?

                                          ? c4pp4 2 Replies Last reply Reply Quote 0
                                          • ?
                                            A Former User @Yoni last edited by

                                            This seems to be a fine thing . Could one also execute VoLte with this script, of which I have no idea? The creation should not be a problem I think. But I'd better be careful before UT crashes again.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post