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

preferGoogleMaps is not working #25

Open
chrisalexqm opened this issue Mar 10, 2019 · 10 comments
Open

preferGoogleMaps is not working #25

chrisalexqm opened this issue Mar 10, 2019 · 10 comments

Comments

@chrisalexqm
Copy link

I set preferGoogleMaps: true, in iOS options but it doesnt open Google Maps App (Google Maps is installed) instead it opens iOS Maps App.

Maybe I am wrong, help me please :D

PD: Only when I set an array in to: it opens Google Maps with way points (I think this is because open the web url)

@EddyVerbruggen
Copy link
Owner

Hmm, that's strange, because the demo app in this repo does open Google Maps with that preference passed in. Can you confirm that?

git clone https://github.com/EddyVerbruggen/nativescript-directions
cd nativescript-directions/src
npm run demo.ios.device

Then hit the 'from address to coord' button (last button).

If that works, then what you can try in your project:

@chrisalexqm
Copy link
Author

@EddyVerbruggen Hello and thanks for answering :D

I couldnt replicate demo app because I am working in Windows with NativeScript SideKick but I could run this issue in the NS Playground: https://play.nativescript.org/?template=play-vue&id=L4M2rY

As you can see I set preferGoogleMaps as true. Hope you can replicate this issue.

@EddyVerbruggen
Copy link
Owner

Ha, you're running the app inside the Playground app, which doesn't have nativescript-directions installed. I saw you added it yourself (good thinking!), but the only piece missing is the plist entry that allows the app to query the OS whether or not the Google Maps app is installed:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
</array>

Since it can't determine that without this plist entry, it falls back to Apple Maps. The waypoint overrides that behavior, but that's a different issue really.

So I think your code is correct, and once you run it as a standalone app it'll probably work just fine.

@chrisalexqm
Copy link
Author

chrisalexqm commented Mar 11, 2019

Ohhh well, I added comgooglemaps to my Info.plist and it still opening Maps from iOS. I can use directly the functions inside plugin but I want to contribute to the community by solving this issue and improving the plugin 😸 . I will try removing platform/ios folder and I'll tell you.

Thanks for your time!

@EddyVerbruggen
Copy link
Owner

THANK YOU! I'd be happy to merge any code/doc you want to PR.

@chrisalexqm
Copy link
Author

I test with fb:// appAvailability and it is returning false, the same with comgooglemaps://. I have installed both of those applications. I added this to my Info.plist

comgooglemaps
fb
twitter

I am doing something bad?

@EddyVerbruggen
Copy link
Owner

That’s hard to tell without the actual code. Can you share a minimal repo?

@chrisalexqm
Copy link
Author

I uploaded this https://github.com/chrisalexqm/directionstest tell me if you can run it

@EddyVerbruggen
Copy link
Owner

EddyVerbruggen commented Mar 12, 2019

@chrisalexqm Runs fine. I didn't have Google Maps on my iPad so it opened Apple Maps. Then I installed the Google Maps apps and this prompt was shown (as expected):

IMG_0100

In Dutch: "Directions wants to open Google Maps. [Cancel / Open]"

After accepting this (one-time) prompt it opened Google Maps. So all is working fine with your app for me.

@chrisalexqm
Copy link
Author

Well, definitely I don't know what is happening... Uhmm could be the way how SideKick build the app 🤔

Repository owner deleted a comment from krishna949 Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants