Could really do with some help, I'm trying to push an alert on an android phone with the help of sencha when a user is near a certain set point of interest.
In my view I have a map
{
xtype: 'map',
id: 'mapOne',
cls: 'center',
flex: 1,
width: '100%',
mapOptions : {
mapTypeControl : false,
navigationControl : true,
streetViewControl : false,
backgroundColor: 'transparent',
disableDoubleClickZoom: true,
zoom: 10,
draggable: true,
keyboardShortcuts: true,
scrollwheel: false,
enableHighAccuracy: true
},
listeners : {
maprender : function(comp, map){
var currentMarker = new google.maps.Marker({
position: new google.maps.LatLng(setlat,setlon),
//title : 'Sencha HQ',
map: map,
icon: image
});
setTimeout( function(){map.panTo (new google.maps.LatLng(markerlat, markerlong));} , 1);
}
}
In my controller I set the following before my map is rendered
var poi = new google.maps.LatLng(markerlat, markerlong);
Then in my controller im initalizing a geolocation object as follows
var geo = Ext.create('Ext.util.Geolocation', {
autoUpdate: true,
frequency :3000,//every 3 seconds
listeners: {
locationupdate: function(geo) {
var curlat = geo.position.coords.latitude;
var curlong = geo.position.coords.longitude;
console.log('New GEO CURRENT: ' + curlat + ' ' + curlong);
var me = new google.maps.LatLng(curlat, curlong);
if (me == poi){
alert("poi found");
}
},
locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
if(bTimeout){
alert('Timeout occurred.');
} else {
alert('Error occurred.');
}
}
}
});
I have also set a geomarker to see if I being detected anyway near the poi.
GeoMarker = new GeolocationMarker(mapOne);
It shows my GeoMarker directly on top of the marker with no alert. I tried a few different similar things with no success like the following....
if (GeoMarker == poi){
alert("poi found");
}
I know my process is wrong here in both cases as my position won't be exactly the same as the poi but I can't figure out how to set the proper proximity of the current position to to alert. I'm finding it hard to find any documentation that shows how to successfully implement something similar with respect to alerting at a poi. Any help or links to documentation that might help would be greatly appreciated.
Thanks in advance