Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy coordinates and link to map #152

Open
Abyss777 opened this issue Apr 23, 2015 · 29 comments
Open

Copy coordinates and link to map #152

Abyss777 opened this issue Apr 23, 2015 · 29 comments

Comments

@Abyss777
Copy link

It would be nice have possibility to copy device coordinates and link to map in mobile version (and may be in full)

Something like this:
example

The first button copies formated device parameters:

Время: 2015-04-23 09:16:51
Широта: 
Долгота: 
Скорость: 0.00 km/h
Курс: 112.00
protocol: wondex
satellites: 10
event: 37
battery: 4.12
input: 1
Геозона: Работа

The second one copies link to map like this:

http://www.openstreetmap.org/?mlat=56.8386&mlon=60.6072#map=16/56.8386/60.6072

If you like, I can send button pictures source.

@vitalidze
Copy link
Owner

I think it's better to use buttons with text instead of buttons with pictures. Will add this function once I finish current higher priority tasks.

@vitalidze
Copy link
Owner

I wanted to do this but cannot find a way to copy to clipboard in mobile browser with javascript. If anyone can suggest how to do this, I will try to implement this function in mobile UI.

@Abyss777
Copy link
Author

Oh, I've asked something unreal I think. It seems impossible about clipboard.

But there is "Share..." button in mobile version of m.youtube.com.
It calls appropriate applications in Android devices (may be in iOS too)

This solution fits my tasks: Quick send device coordinates via sms or email.

@vitalidze
Copy link
Owner

According to this document iOS does not support message text in SMS URLs. However, it supports subject and body in Email URLs. According to this blog post some devices support both. So what should we do? I am thinking about four buttons:

  • send data by SMS
  • send data by Email
  • send link by SMS
  • send link by Email

SMS options will be hidden on iOS devices.

@Abyss777
Copy link
Author

It would be nice to add four buttons, but we shouldn't forget about design. If you can do it compact and prettily it would be cool. This buttons shouldn't overload design and be very noticeable.
If you are dubting, we can kill two birds with one stone: send all (data and link) in one message via sms or email, therefore you can leave two buttons.

@vitalidze
Copy link
Owner

Maybe we can add two buttons like these:

email sms

And then when button is clicked show a 'popover' with selection of what to send - link or data, see this for an example.

@Abyss777
Copy link
Author

Very nice, I like popover.
But you didn't want to use pictures on buttons... :)

@vitalidze
Copy link
Owner

Well, if we think about it as a 'share' function then I guess it is a common practice to have pictures. Will try to do my best to implement it in near future.

@Abyss777
Copy link
Author

vitalidze added a commit that referenced this issue May 15, 2015
vitalidze added a commit that referenced this issue May 15, 2015
vitalidze added a commit that referenced this issue May 15, 2015
@vitalidze
Copy link
Owner

Implemented, written news, updated latest and demo versions.

@johnnyrlq
Copy link

Nice feature,
I noticed, sending URL by SMS the longitude is not showed

@vitalidze
Copy link
Owner

HM, actually it generates same URL with same function as it does while sending EMails. How does your issue look like?

@johnnyrlq
Copy link

By using chrome in Android mobile, when I access to demo page (http://d.traccar.litvak.su/m/), I can email URL like this: "http://www.openstreetmap.org/?mlat=-12.134655&mlon=-76.955914" but when send URL by SMS the pre-formatted message is: "http://www.openstreetmap.org/?mlat=-12.134655" (Long parameter is missing)

And when I use the default browser of my Android (HTC M8) the message of URL is always (with email or SMS) Longitude parameter missing, example: "http://www.openstreetmap.org/?mlat=-12.134655"

@johnnyrlq
Copy link

I think the symbol "&" should be formatted with ASCII, or something like that

@vitalidze
Copy link
Owner

Ok, will look into this issue today. Unfortunately (or maybe fortunately :)), I don't have an android phone, so I have just tested this function only in desktop browser and in iPhone and iPad email only. Will check this in android simulator.

@vitalidze vitalidze reopened this May 18, 2015
@Abyss777
Copy link
Author

I can confirm the problem. It is truncated before "&" symbol in sms.

@vitalidze
Copy link
Owner

This is a bug in android, see this one https://code.google.com/p/android/issues/detail?id=12142 I think I have worked it out by placing %26 instead of ampersand before doing URL encoding. It works in android emulator for me. Please try latest version. I updated demo version as well.

@Abyss777
Copy link
Author

It's seems working now.
There is "%26" in email and "&" in sms.
PS: Nexus 4, Android 5.1

@vitalidze
Copy link
Owner

Thanks for testing. On my iPhone I get correct results in email, i.e. it shows ampersand & symbol in email. I can actually leave '%26' double-escaped when sending SMS only, so email will remain with ampersand, but per @johnnyrlq words there is a problem in emails too on some devices.

Does the link with %26 in email work?

@Abyss777
Copy link
Author

Hm, no it doesn't work in email.
It opens whole world map. If i replace "%26" to "&" in address string back then it works.

@vitalidze
Copy link
Owner

Thanks again for testing. This android is a buggy mess :( Let's wait for @johnnyrlq response to see whether it works on his devices.

@johnnyrlq
Copy link

I have tested email and SMS notifications and worked fine in my android mobile.

Congrats and thank you for this new feature.

@vitalidze
Copy link
Owner

Thanks for testing. However, sending URL by email does not work for @Abyss777 now because the URL is wrong and does not point to the correct location. @johnnyrlq please confirm that such URLs are working fine for you (show you correct location when opened in mobile (or any other) web browser).

Also can you please tell me Android versions on your devices? Maybe I could stick to android version somehow when processing emails.

@johnnyrlq
Copy link

The URL sent by email and SMS works fine.
I have tested with chrome and the default browser in my android device: Android 4.4.2 - HTC ONE M8

Link sent: http://www.openstreetmap.org/?mlat=-12.081185&mlon=-77.008223

Lat&long data is right

vitalidze added a commit that referenced this issue May 19, 2015
@vitalidze
Copy link
Owner

I have hard coded %26 for emails only for Android 4.4.2. But in emulators all other versions cut off email body at all (Just subject remains), and I don't have any clue how to deal with it. Can you please check if it works for you now, @Abyss777 @johnnyrlq ? (I have updated both latest and demo versions)

@Abyss777
Copy link
Author

Latest version works correctly for me.

My config:
Pure Android 5.1 on Nexus 4
Chrome browser (it's default)
Gmail as application for email sending
SMS/MMS default application for sms sending (not Hangouts)

Applications for opening links to openstreetmap.org are Chrome and OsmAnd+, both open correctly

PS: OsmAnd+ opened links with "%26" correctly but Chrome didn't.

@vitalidze
Copy link
Owner

Thank you very much for testing, appreciate your help.

@johnnyrlq
Copy link

Some observations
My config:
Android 4.4.2 on HTC one M8
Gmail as application for email sending
SMS/MMS default application for sms sending (not Hangouts)

  1. The demo URL (http://d.traccar.litvak.su/m/) is opened by the default browser of HTC (not Chrome)
  1. The demo URL (http://d.traccar.litvak.su/m/) is opened by Chrome

The URL with "%26" does not work correctly in chrome neither default browser.

@vitalidze
Copy link
Owner

Thanks a lot for testing and such a detailed report. This all sounds like I should place these '%26' instead of ampersand only on default browser and only on android 4.4.2. Will do my best to work it out in nearest future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants