1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Answers
    2
    Vote Rating
    0
    pwr4563 is on a distinguished road

      0  

    Default Answered: Ext.device.Geolocation in native build not working on iOS

    Answered: Ext.device.Geolocation in native build not working on iOS


    Hi,

    I'm using the Ext.device.Geolocation Class to get the current Location. When I run the app as a web app via safari on iPad 1 everything works fine. If I package the exactly same app as a native app for iOS and deploy this app on my iPad1, then the callback I defined in Ext.device.Geolocation.getCurrentPosition() does not fire. I get no Location. I use the following code:

    Code:
    showMyLocation: function(){
            Ext.device.Geolocation.getCurrentPosition({
                success: function(position){
                    var myPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
                    var map = this.getMapPanel().down('map').getMap();
                     var marker = new google.maps.Marker({
                        position: myPosition
                    });
                    marker.setMap(map);
                },
                failure: function(){
                    Ext.Msg.alert("Fehler", "Positionsbestimmung nicht möglich!", Ext.emptyFn);
                },
                timeout: 10000,
                scope: this
            });
        },

  2. I now use a workaround. Mayby this could help other people facing the same problem like I do. Instead of Ext.device.Geolocation I use Ext.util.Geolocation for getting a Location in the native iOS Build on iPad1.

    The following code I use:
    Code:
    showMyLocation: function(){    	if(Ext.device.Device.platform == 'iPad'){
        		var geo = Ext.create('Ext.util.Geolocation', {
        			autoUpdate: true,
        			listeners: {
        				locationupdate: function(geo){
        					var myPosition = new google.maps.LatLng(geo.getLatitude(), geo.getLongitude());
    						var map = this.getMapPanel().down('map').getMap();
    				 		var marker = new google.maps.Marker({
    							position: myPosition
    				    	});
    				    	if(this.getMapPanel().myLocationMarker != null){
    				    		this.getMapPanel().myLocationMarker.setMap(null);
    				    	}
    				    	marker.setMap(map);
    				    	this.getMapPanel().myLocationMarker = marker;
        				},
        				locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message){
        					Ext.Msg.alert("Error:", message, Ext.emptyFn);
        				},
        				scope: this
        			}
        		});	
        		geo.updateLocation();
        	}else{
    	    	Ext.device.Geolocation.watchPosition({
    	    		callback: function(position){
    					var myPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
    					var map = this.getMapPanel().down('map').getMap();
    			 		var marker = new google.maps.Marker({
    						position: myPosition
    			    	});
    			    	if(this.getMapPanel().myLocationMarker != null){
    			    		this.getMapPanel().myLocationMarker.setMap(null);
    			    	}
    			    	marker.setMap(map);
    			    	this.getMapPanel().myLocationMarker = marker;
    	    		},
    	    		failure: function(){
    	    			Ext.Msg.alert("Fehler", "Positionsbestimmung nicht möglich!", Ext.emptyFn);
    	    		},
    	    		frequency: 10000,
    	    		scope: this
    	    	});
    	    }
        },
    I did not find any other solution that works on iPad1. On Android native Build and in the mobile Safari Browser everthing works fine.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,669
    Answers
    3354
    Vote Rating
    746
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What iOS version?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Answers
    2
    Vote Rating
    0
    pwr4563 is on a distinguished road

      0  

    Default


    5.1 on an iPad1

  5. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Answers
    2
    Vote Rating
    0
    pwr4563 is on a distinguished road

      0  

    Default


    I now use a workaround. Mayby this could help other people facing the same problem like I do. Instead of Ext.device.Geolocation I use Ext.util.Geolocation for getting a Location in the native iOS Build on iPad1.

    The following code I use:
    Code:
    showMyLocation: function(){    	if(Ext.device.Device.platform == 'iPad'){
        		var geo = Ext.create('Ext.util.Geolocation', {
        			autoUpdate: true,
        			listeners: {
        				locationupdate: function(geo){
        					var myPosition = new google.maps.LatLng(geo.getLatitude(), geo.getLongitude());
    						var map = this.getMapPanel().down('map').getMap();
    				 		var marker = new google.maps.Marker({
    							position: myPosition
    				    	});
    				    	if(this.getMapPanel().myLocationMarker != null){
    				    		this.getMapPanel().myLocationMarker.setMap(null);
    				    	}
    				    	marker.setMap(map);
    				    	this.getMapPanel().myLocationMarker = marker;
        				},
        				locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message){
        					Ext.Msg.alert("Error:", message, Ext.emptyFn);
        				},
        				scope: this
        			}
        		});	
        		geo.updateLocation();
        	}else{
    	    	Ext.device.Geolocation.watchPosition({
    	    		callback: function(position){
    					var myPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
    					var map = this.getMapPanel().down('map').getMap();
    			 		var marker = new google.maps.Marker({
    						position: myPosition
    			    	});
    			    	if(this.getMapPanel().myLocationMarker != null){
    			    		this.getMapPanel().myLocationMarker.setMap(null);
    			    	}
    			    	marker.setMap(map);
    			    	this.getMapPanel().myLocationMarker = marker;
    	    		},
    	    		failure: function(){
    	    			Ext.Msg.alert("Fehler", "Positionsbestimmung nicht möglich!", Ext.emptyFn);
    	    		},
    	    		frequency: 10000,
    	    		scope: this
    	    	});
    	    }
        },
    I did not find any other solution that works on iPad1. On Android native Build and in the mobile Safari Browser everthing works fine.

  6. #5
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    4
    Vote Rating
    -1
    joe87 is an unknown quantity at this point

      0  

    Default


    I have the same issue. tested on iOs 5.1.1 (iPodTouch and iPad 2).
    Everything from the Ext.device Collection (Camera, Notification, ...) works except Geolocation. I've build my application with Sencha SDK 2.0 BETA 3 on Windows 7.

    If i use Ext.device.Geolocation the application crash, without any notifcation.

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar