Page 1 of 1

How to invoke Google Service Method

Posted: Mon Jul 21, 2014 11:18 am
by Vincent

i'm following the tutorial, Using the Google Maps API, and trying to invoke a public method. http://developer.android.com/referenc...

I've tried to invoke in initialize, but it does not work.

function initialize(){
console.log('Initializing...');

Code: Select all

 map = Apperyio("google_map").gmap; 
 map.setMyLocationEnabled(true); 
 if (!map) 
 { 
     setDelay(); 
 } 
 else 
 { 
     directionsDisplay = new google.maps.DirectionsRenderer(); 

 } 

}


How to invoke Google Service Method

Posted: Mon Jul 21, 2014 11:52 am
by Kateryna Grynko

Hi Vincent,

The map is not ready yet when you call setMyLocationEnabled. Please move this code:premap.setMyLocationEnabled(true); /preBefore or after:predirectionsDisplay = new google.maps.DirectionsRenderer();/pre


How to invoke Google Service Method

Posted: Mon Jul 21, 2014 4:43 pm
by Vincent

Hi,

I've shifted the code to after, but a Uncaught TypeError: undefined is not a function is triggered:

function initialize(){
console.log('Initializing...');

Code: Select all

 map = Apperyio("google_map").gmap; 
 // 
 if (!map) 
 { 
     setDelay(); 
 } 
 else 
 { 
     directionsDisplay = new google.maps.DirectionsRenderer(); 
     map.setMyLocationEnabled(true); 

 }

How to invoke Google Service Method

Posted: Mon Jul 21, 2014 11:55 pm
by Yurii Orishchuk

Hi Vincent,

Please give us your app public link and describe steps to reproduce this issue.

Regards.


How to invoke Google Service Method

Posted: Tue Jul 22, 2014 3:33 am
by Vincent

http://appery.io/app/mobile-frame?src...

followed tutorial Using the Google Maps API.

Added to GoogleMapJS:

function initialize(){
console.log('Initializing...');

Code: Select all

 map = Apperyio("google_map").gmap; 
 // 
 if (!map) 
 { 
     setDelay(); 
 } 
 else 
 { 
     console.log('generating map'); 
     directionsDisplay = new google.maps.DirectionsRenderer(); 
     console.log('generating mylocation'); 
     map.setMyLocationEnabled(true); 

 } 

}


How to invoke Google Service Method

Posted: Tue Jul 22, 2014 11:28 pm
by Yurii Orishchuk

Hi Vincent,

Unfortunatly, you can not use "setMyLocationEnabled" method cause of there is no such method in Google Maps Javascript API V3.

Please see more about this avaliable API here: https://developers.google.com/maps/do...

Also if you can not manage to fix this problem please describe what exactly you want to implement.

Regards.


How to invoke Google Service Method

Posted: Wed Jul 23, 2014 3:05 am
by Vincent

Hi,

I would like to have the my location button as per google maps app in screenshot. Ive seen this in other non google app, just that im not sure if its V2 or V3.Image


How to invoke Google Service Method

Posted: Thu Jul 24, 2014 12:25 am
by Yurii Orishchuk

Hi Vincent,

Please pass following tutorial to understand how to implement "my location" button.

http://devcenter.appery.io/tutorials/...

Regards.