Im using PhoneGap to build an app. In this app I'want to create a geo link. PhoneGap does open a map with the right location on it, but the map is not Google Maps or Apple maps. Instead it opens a weird looking map.
I'm using AngularJS as a Framework
Right now I'm using this:
View on Google Maps
Is there a way that the app will open up the Google Maps downloaded from the Play Store?
Thanks!
Try to add the following to config.xml
<access origin="geo:*" launch-external="yes"/>
And try this:
Create a custom function in JS and use it to open default Maps App on the device
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
openNativeAppWindow: function(data) {
window.open(data, '_system');
}
};
The place where you are invoking Maps links then pass on your custom url with data and let it open the native browser window which in turn will push the native Maps App to handle the special urls.
Few example:
<input type="button" onClick="app.openNativeAppWindow('http://google.com')" value="Open Google"/>
<br><br><a onClick="app.openNativeAppWindow('geo://0,0?q=dallas')" data-rel="external">google maps</a>
<br><br><a onClick="app.openNativeAppWindow('geo:0,0?q=Bacau')">Geolocation Test</a>
<br><br><a onClick="app.openNativeAppWindow('geo:0,0?q=34.99,-106.61(Treasure)')">longitude & latitude with a string label</a>
<br><br><a onClick="app.openNativeAppWindow('geo:0,0?q=1600+Amphitheatre+Parkway%2C+CA')">street address Test</a>
Related
I am attemtping to implement a file explorer using the Amazon S3 Explorer Plugin from here: https://github.com/awslabs/aws-js-s3-explorer/tree/v2-alpha within a Django Project.
The 'placeholders' for the template in the HTML page are the same Django uses so I am getting errors while attempting to render the template with the same code provided in the index.html file. When I used Vue a bit ago I remember being able to change the selectors from {{ }} to whatever I wanted, how can I do this here?
This is Angular.js code.
I have tried to do this here without success:
angular.module('aws-js-s3-explorer', [], function($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
}).factory('SharedService', SharedService)
.controller('ErrorController', ErrorController)
.controller('ViewController', ViewController)
.controller('AddFolderController', AddFolderController)
.controller('InfoController', InfoController)
.controller('SettingsController', SettingsController)
.controller('UploadController', UploadController)
.controller('TrashController', TrashController);
You need a config() block for configuring $interpolateProvider
angular.module('aws-js-s3-explorer', [])
.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
}).factory...
I need to launch to launch an external url / website in Onsen Ui without leaving the app. I can use an iframe I guess between the ons-page tags where I need it but not very reliable perhaps.
Its my first Onsen Ui project.
Jimmy
Simply using the method below on OnsenUI
Link
will destroy and replace the whole app (web view) with external HTML resources.
Solution: so you may need the helps of cordova-plugin-inappbrowser plugin.
In your case,
launch an external url / website in Onsen Ui without leaving the app,
you need "_self" or "_blank" ("_blank" is used for example codes below)
// opts is optional depend on your requirements
var opts = 'location=yes';
var ref = cordova.InAppBrowser.open('http://www.example.com', '_blank', opts);
or you can use ngCordova's $cordovaInAppBrowser
angular.module('app')
.controller('ctrl', ['$cordovaInAppBrowser', function($cordovaInAppBrowser) {
var opts = {location: 'yes'};
$cordovaInAppBrowser.open('http://www.example.com', '_blank', opts);
}]);
i faced the same problem and i use this method its not fancy but it workes for me
<a class="name" href="#" onclick="window.open('https://www.youtube.com/watch?v=_OOWhuC_9Lw', '_system', 'location=yes'); return false;">
Watch
</a>
I want open a web page in my app, I know I should use ngCordova InAppBrowser plugin, but how can I open the webpage in $ionicModal ? like twitter, facebook mobile apps and ...
I have this button :
<button class="button button-block button-assertive" ng-click="doPay()">Pay</button>
and in doPay() I have :
$scope.doPay = function(){
window.open(url, '_system', 'location=no');
};
but this code use external app (Safari), I want open in my application.
To open the web inside your app you have to use the _blank option instead of _system
$scope.doPay = function(){
window.open(url, '_blank', 'location=no');
};
Edit: window.open no longer works as default, to re enable it you’ll need to add this code
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
window.open = cordova.InAppBrowser.open;
}
Or use cordova.InAppBrowser.open instead of window.open
I tried to handle Google maps event in a Sencha Touch app. When I tested the application in Chrome, Google maps events (click, double click, mousedown...) work fine. However, when I generated the Android application version, none of those events are working anymore on the Android version. How can I correct this bug such that I can handle at least the click and double click events on the Android APK version?
The following are functions that I used to handle Google maps events:
google.maps.event.addListener(map, 'click', function(event) {
Ext.Msg.alert("click", "lat" + event.latLng.lat());
});
google.maps.event.addListener(map, 'dblclick', function(event) {
Ext.Msg.alert("dblclick", "lat" + event.latLng.lat());
});
google.maps.event.addListener(map, 'mousedown', function(event) {
Ext.Msg.alert("mousedown", "mousedown");
});
I need to open a backbone template in a new window. Is this possible? Currently I've got a template that is being displayed within a div but I need this content to display in a new window? I thought using a route might be the way to go but I'm not sure.
I'm a noob to backbone so there's probably a better way to do this.
In my view I've got:
events:
{
'click #active-bets' : 'loadActiveBetsPage',
}
loadActiveBetsPage: function(e)
{
var MyApp = new Backbone.Router();
MyApp.navigate('activebets', {trigger: true});
// , {trigger: true, target: "_blank"}
},
I thought I might get lucky and be able to pass a target: "_blank" parameter here.
in my routes sections:
var AppRouter = Backbone.Router.extend({
routes: {
":activebets" : "renderActiveBets",
"*actions" : "defaultRoute"
} });
app_router.on('route:renderActiveBets', function () {
$this.activeBetsView = new ActiveBetsView( { el: $this.elAccountInfo });
$this.activeBetsView.render();
/* thought something like this might help possibly
if ($(event.currentTarget).prop('target') === '_blank') {
return true;
}
*/
});`
Thank you in advance for any help on this one.
No, this is not possible and especially not with the Backbone Router directly.
The only ways to open new browser windows from a webpage are using the window.open javascript method. It will open a new browser window that directs to the URL specified. Note that the the page you have created and the page you started at are independent of each other and there is no way to communicate between them via javascript.
The other way is to have an anchor tag with the target -attribute, which results in clicking the link opening a new window/tab.
What you can do:
Use a dialog created with html to simulate a new window, e.g. jQuery UI Dialog
Create a separate webpage to display this information, open a new browser window and direct the new window to this webpage.
Update based on last comment:
"...there is no way to communicate between them via javascript."
Since HTML5, the solution for this is HTML5 Web Storage.
window.localStorage
is API that can communicate with all open tabs and windows in browser.