Start google maps with sms

Post your questions and help other users.

Moderator: Martin

edwi
Posts: 1
Joined: 03 Nov 2018 19:35

Start google maps with sms

Post by edwi » 04 Nov 2018 15:37

hi i need help starting google maps with coordinates that i get from gps via sms this is the format
http://maps.google.com/maps?q=+59.63765,+017.07394 Date:2018-11-2 Time:21:14 ID:60280xxxxx Fix:A Speed:0KM/H Bat:5
can someone help?

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: Start google maps with sms

Post by Desmanto » 04 Nov 2018 16:49

Use
Trigger : SMS received
SMS Sender List : Filter for the number you need, or just leave it all
Contains Text : http://maps.google.com/maps?q=
Make sure you have grant Automagic the proper sms permission and no other app is blocking the sms.

Then add script to filter and parse the sms content using regex.

Code: Select all

find = findAll(sms_text, '(http://maps.google.com/maps\\?q=.*) Date:.*', true);
url = find[0][1];
? (question mark is special char, need to be escaped using double backslah. The bracket surrounding the map link is to capture the link. url access the capture group 1.

Then use url in the action Open URL in browser
URL : {url}
Use defined app, choose google map.

Other method is to use start activity, but you have to parse the coordinate first. So it is easier to just use action Open URL in browser.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

younesetre
Posts: 16
Joined: 29 Apr 2016 23:04

Re: Start google maps with sms

Post by younesetre » 24 Apr 2019 13:39

Hi Thankx for your post by i have error action not executed succefully. index 0 size 0 expression : find [0] line [0].

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: Start google maps with sms

Post by Desmanto » 24 Apr 2019 17:51

It is caused by the sms doesn't contains the exact link as the regex. {find} will result in empty and error when accessed by index. Most likely the link has changed, and AFAIK, google map now is using https for the default link.

Do you have the same sms format as edwi has above? Or can you post example of your sms format you use? (use dummy location coordinate for your privacy).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

younesetre
Posts: 16
Joined: 29 Apr 2016 23:04

Re: Start google maps with sms

Post by younesetre » 24 Apr 2019 18:29

Thank you for your quick reply
Excuse my English
Here is my text message:
lat: 11.123456 lon: -1.123456
speed: 0.11
T: 19/04/24 14:15
http://maps.google.com/maps?f=q&q=11.12 ... 23456&z=11
Last edited by younesetre on 24 Apr 2019 19:19, edited 2 times in total.

younesetre
Posts: 16
Joined: 29 Apr 2016 23:04

Re: Start google maps with sms

Post by younesetre » 24 Apr 2019 18:35

It would be wise to transfer it directly to Osmand if not googlemaps

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: Start google maps with sms

Post by Desmanto » 25 Apr 2019 10:22

Your format now change a bit, previous one is
http://maps.google.com/maps?q=+59.63765,+017.07394

Now is
http://maps.google.com/maps?f=q&q=11.12 ... 23456&z=11

There is additional url field "f=q&". So we need modify the regex to support it too.

Code: Select all

find = findAll(sms_text, '(http://maps.google.com/maps\\?f=q&q=.*) Date:.*', true);
url = find[0][1];
Then in the open URL in Browser, instead of choosing google maps, change it to Osmand
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

younesetre
Posts: 16
Joined: 29 Apr 2016 23:04

Re: Start google maps with sms

Post by younesetre » 25 Apr 2019 19:32

I still have the same problem, the same mistake.
I enclose the script as an attached file to see where the error is

Thank you
Attachments
Screenshot_2019-04-25-21-01-59-118_ch.gridvision.ppam.androidautomagic.png
Screenshot_2019-04-25-21-01-59-118_ch.gridvision.ppam.androidautomagic.png (129.21 KiB) Viewed 896 times

younesetre
Posts: 16
Joined: 29 Apr 2016 23:04

Re: Start google maps with sms

Post by younesetre » 25 Apr 2019 22:10

I tried everything but without results here is my flow in file attached
I still have the same problem "Action not executed successfully index 0 size 0 expression : find 0 line1
Attachments
Screenshot_2019-04-25-23-03-45-738_ch.gridvision.ppam.androidautomagic.png
Screenshot_2019-04-25-23-03-45-738_ch.gridvision.ppam.androidautomagic.png (104.63 KiB) Viewed 892 times

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: Start google maps with sms

Post by Desmanto » 26 Apr 2019 03:18

Sorry, I thought you lat lon you have above is just your sample. Turns out it is your whole text message. The regex I provided only works for edwi's format. Different message format, require another regex. Example, the above has "Date" after the map link, but yours doesn't end with it.

Try this now

Code: Select all

find = findAll(sms_text, 'http://maps.google.com/maps\\?f=q&q=.*', true);
url = find[0][0];
The url should now contains your map link. If it is still error, please add condition debug dialog after it, and show the content of {sms_text}
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

Post Reply