PINE64
MMS workaround for users with separate APN (works atleast on Manjaro Phosh) - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+---- Forum: Manjaro on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=130)
+---- Thread: MMS workaround for users with separate APN (works atleast on Manjaro Phosh) (/showthread.php?tid=17454)



MMS workaround for users with separate APN (works atleast on Manjaro Phosh) - alaraajavamma - 10-10-2022

Hello!

While we are waiting multiplexing APN support I have tried to find out some workaround so that I don't lose MMS messages.
This is not perfect and many solutions might be wrong but hey at least it is working automated Big Grin
I am using this same script to improve battery life so all "gsettings" parts are not necessary but they make the phone suspend much much faster if screen is locked.

If you wan't to find out more about this original issue see here:
https://gitlab.com/kop316/mmsd/-/issues/5
https://gitlab.freedesktop.org/NetworkMa...issues/958

So first we need two bash scripts and lets call this first one start.sh
(Copy the text above and paste it to gedit and save it to your home folder)
Code:
#!/bin/bash
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 60 & gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 60 && sleep 50 && /home/manjaro/lock.sh

Then we need second one and lets call this lock.sh
(Copy the text above and paste it to gedit and save it to your home folder)
Code:
#!/bin/bash
dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" |
while read x; do
    case "$x" in
    *"boolean true"*) nmcli c up "dna mms" & sleep 2 && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 5 & gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 5;;
    *"boolean false"*) nmcli c up "dna internet" & gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 60 & gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 60;;
    esac
    done
Notice that you have to use your carriers APN names and the names needs to be the same as in System settings and as in Chatty (nmcli c up "dna mms" and nmcli c up "dna internet". If the APN name is only one word you don't need to use these marks "

And then we need to add one file to /home/manjaro/.config/autostart and that will be start.desktop
(Copy the text above and paste it to gedit and save it to /home/manjaro/.config/autostart)
Code:
[Desktop Entry]
Version=1.0
Name=MMS-Switch
Comment=Switch MMS and Data APN regarding the lock screen status
Exec=/home/manjaro/start.sh
Icon=org.gnome.Terminal
Terminal=falce
Type=Application

Then you have to open terminal and paste
Code:
sudo chmod +x /home/manjaro/lock.sh && sudo chmod +x /home/manjaro/start.sh

Then just reboot and now you should have working MMS switch. It will switch to MMS APN when you lock the screen and when you unlock it will switch back to Data APN. And if you don't remove the gsettings parts it will suspend in 5 second when on lock screen and in 60 seconds when you are logged in and using phone Smile

Then there is one funny thing - to get all of this working you most likely need to switch to MMS APN trough System settings and then reboot (needs to do it only once). After latest updates Manjaro Phosh will switch to APN which was selected from System Settings when it resumes from suspend. I have no idea where it is coming from but this is the case at least in my scenario.

I think this should work also with Mobian and Arch but have not tested.
My skills are limited so this is not really good solution but at least it is working and I can trust that I don't miss important messages.

I suggest also to create these shortcut launchers to /home/.local/share/applications. The first one sets APN to MMS and after that starts Chatty so you can send MMS messages also. The second one just changes APN to Data so you can switch back or just relaunch internet connection if needed.
(Copy the text above and paste it to gedit and save it to /home/manjaro/.local/share/applications)
Code:
[Desktop Entry]
Version=1.0
Name=Chatty MMS
Comment=Change to MMS apn and open Chatty
Exec=bash -c 'nmcli c up "dna mms" && chatty'
Icon=sm.puri.Chatty
Terminal=falce
Type=Application
Code:
[Desktop Entry]
Version=1.0
Name=Data On
Comment=Change to Data apn
Exec=bash -c 'nmcli c up "dna internet"'
Icon=org.gnome.Settings-network-symbolic
Terminal=falce
Type=Application


I tried many other ways but this was the only one I got to work automatically. It was so much easier with PMOS where you need to add only one script to one folder Big Grin