Start google maps with sms
Moderator: Martin
Start google maps with sms
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?
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?
Re: Start google maps with sms
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.
? (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.
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];
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), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 16
- Joined: 29 Apr 2016 23:04
Re: Start google maps with sms
Hi Thankx for your post by i have error action not executed succefully. index 0 size 0 expression : find [0] line [0].
Re: Start google maps with sms
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).
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), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 16
- Joined: 29 Apr 2016 23:04
Re: Start google maps with sms
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
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.
-
- Posts: 16
- Joined: 29 Apr 2016 23:04
Re: Start google maps with sms
It would be wise to transfer it directly to Osmand if not googlemaps
Re: Start google maps with sms
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.
Then in the open URL in Browser, instead of choosing google maps, change it to Osmand
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];
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 16
- Joined: 29 Apr 2016 23:04
Re: Start google maps with sms
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
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 (129.21 KiB) Viewed 19012 times
-
- Posts: 16
- Joined: 29 Apr 2016 23:04
Re: Start google maps with sms
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
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 (104.63 KiB) Viewed 19008 times
Re: Start google maps with sms
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
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}
Try this now
Code: Select all
find = findAll(sms_text, 'http://maps.google.com/maps\\?f=q&q=.*', true);
url = find[0][0];
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.