How to show select-app dialog through Javascript? - javascript

I'm working with an android wrapped app (using web viewer), and I would like to ask the user which app wants to use when pressing in address from my app.
Example pop-up in android (Spanish): https://puu.sh/EEXBK/388b01494d.png
I have tried using the google API launcher which is: https://www.google.com/maps/dir/?api=1&origin=xxx&destination=xxx&travelmode=driving
But this opens directly maps, without asking if you want to use Waze or not.
It is possible with Javascript?
My targets are Maps and Waze.
Any suggestions?
Thanks.

check this document for opening waze and for google map check this
you can create url for each one
example waze:
https://www.waze.com/ul?ll=40.75889500%2C-73.98513100&navigate=yes&zoom=17
example google maps:
https://www.google.com/maps/#?api=1&map_action=map&center=-33.712206,150.311941&zoom=12&basemap=terrain

You can use these URLs:
appleURL = "http://maps.apple.com/?daddr=\(latitude),\(longitude)"
googleURL = "comgooglemaps://?daddr=\(latitude),\(longitude)&directionsmode=driving"
wazeURL = "waze://?ll=\(latitude),\(longitude)&navigate=false"
For more see this link

Related

Google Maps having directions doesn't work on mobile : "No Routes Found"

I wanted to have a map having directions set to a static destination.
From what i saw, i gave a link as follows:
link
Which opens up a new page with the map.
I haven't been able to replicate this on mobile (Android/Ios) however.
Following error comes up on the mobile: "No Routes Found" .
Can you explain me what am doing wrong?
PS: Am currently using this on a responsive website adding it as a link. I don't want this embedded either.
Thanks.
Try changing the URL like the below one. It might help you.
http://maps.google.com/maps?saddr=Current+Location&daddr=Kochi+Kerala+India
Thanks
The query string format is an older format, so maybe this newer syntax might work:
link
I've found that sometimes Google likes different phrasings for the current location, so if that doesn't work, you could also try something like Your+Location.
I cannot not use coordinates as source address because I send out a link in an email and my clients can be anywhere in the city when they read it.
For me neither of "My+Location" nor "Current+Location" worked. It always set the source address to the official center coordinates of the current city or the official address of the internet provider. Both on mobile or in desktop browser.
Christian explained here why: https://stackoverflow.com/a/59249673/5356216
The recommended and working solution in 2022 which is language independent is this:
https://www.google.com/maps/dir/?api=1&destination=760+West+Genesee+Street+Syracuse+NY+13204

Cordova problems with google map

I'm developing an app whit phonegap (cordova). This app includes a google map with some markers.
The app also has more pages as a list of comerces…
The map shows correctly, but when I change the page, and back to the map page, sometimes the map is displaced and the info windows not open correctly.
Is there any way to put a map and it appears correctly when changing pages?
And I have also seen that the map consuming a lot internet data.
Could someone make me a suggestion?
I hope someone can help me!!
Thanks, and excuse me for my bad english.
I had similar problems with google maps and cordova. I was using jquery-mobile and sometimes if you switch between pages the maps wasn't loaded properly. You can check out different page events and try to "resize" the maps. I was also playing with different version of cordova and jquery-mobile. This could help as well.
$(document).on("pagebeforeshow","#pagetwo",function(){
google.maps.event.trigger(map, 'resize');
});
best
M

Chrome Extension - Pass URL argument (google-chrome http://www.google.com)

I've developed a chrome extension/kiosk app that opens up Google Chrome in a "kiosk mode" with 4 navigation buttons, HOME, RELOAD, BACK and FORWARD. So it's basically an application that opens up Chrome in a window without Omnibox but added 4 buttons.
This is because the user should not be able to change URL or anything else. Just navigate via the web interface and the 4 simple buttons.
Now, this application/extension is packed with a hardcoded URL. Which means you can't change the URL.
in my browser.html I have the following code:
<webview src="http://www.example.com/" style="width:100%; height:100%"></webview>
and in my browser.js I have the following code:
document.querySelector('#home').onclick = function() {
navigateTo('http://www.example.com/');
};
As you can see the URL is hardcoded both in HTML file and the javascript file.
My question is. Can I change the URL so it's not hardcoded in the extension/kiosk app?
So if I type google-chrome --app-id="jlfmnfhdcdmkibjnbeajhedeoahajnfc" http://www.google.com
into a terminal or cmd, I would want google.com to be displayed.
There may be a simple solution or no solution at all. This is my first attempt at making a chrome extension/kiosk app. So I'm an amateur in this area.
If you want to take a look at the source code, then you can find it on github.

Opening safari webpage from Cordova app

I'm working on an APP that consist of HTML and CSS using the Cordova framework.
There is a button that should open a webpage. The problem is that it opens the webpage inside of the app instead of safari.
My knowledge of Objective C is extremely limited (none) so I was hoping there would be a solution using maybe Javascript.
I've looked all over the internet but couldn't find a non-Objective C solution.
The button is pretty straightforward: <img src="img/button.jpg" alt="website">
I thought target="_blank" might do something for me but that (unsurprisingly) didn't work.
You can use inappbrowser plugin
http://cordova.apache.org/docs/en/3.3.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser
Detect click on link using javascript or jquery and use this following code
window.open('http://www.google.com', '_system', 'location=yes');
I found the answer to my problem:
Opening all URL's with Cordova childbrowser
Only problem is that it automatically opens twitter.com because of the share button for some unknown reason. I'm guessing this is because of an api call it's performing upon being loaded.

how to show available chrome cast devices when cast icon is clicked?

I need help on showing list of available chrome cast devices when chrome cast icon is clicked. Just like what youtube does. See image below.
As of now, when I click the cast icon on my HTML5 app, the devices selection pop-ups on Chrome cast extension, see image below.
I want my app to show the cast devices selection like youtube does. Do you have any idea on how to do it?
Let me know. Thanks.
Sample protocol for 'scan' and for 'device' discovery is in this node project
in these classes:
lib/device.js
lib/scanner.js
some sample output:
rob# nodecastor$ bin/chromecast discover
info: + borneoTV (192.168.1.141:8009) [8235f790a1597865d6d2be26728282dc]
Since You use JS, maybe the node stuff helps you??
According to chromecast documentation:
I only can get receiver name after selected the device in chromecast popup, so this function is executed: function onRequestSessionSuccess(e){...}
So, I explored object returned, precisely in attribute: e.receiver.friendlyName
I hope have helped you :)

Categories

Resources