Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Vote Rating
    0
    insomnix is on a distinguished road

      0  

    Default Update data based on geolocation

    Update data based on geolocation


    I'm working on my first app, been on it for a while. I want the app data store to update whenever the mobile device is moving or, if the device is idle, update on a timer. It might seem odd to do both, but the timer could run every 20 minutes or so, while if the device updates when moving it might update multiple times in 20 minutes. I've tried several different things, like watchPosition and setInterval, with no luck.

    Here are my current functions from the controller:
    Code:
        getLocation: function(callback) {
            if (navigator && navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function(position) {
                    callback(position);
                }, function(error) {
                    // give a warning for error
                });
            }
        },
    
        getItems: function(location, callback) {
            var store = Ext.data.StoreManager.lookup('ItemStore'),
            url = 'http://myapp.co/searchapi.js' +
            '?distance=20' +
            '&lat=' + location.coords.latitude +
            '&long=' + location.coords.longitude;
    
            store.getProxy().setUrl(url);
    
            store.load(function() {
                callback(store);
            });
        },
    
        launch: function() {
            var me = this;
    
            Ext.Viewport.setMasked({ message: 'Loading...' });
            // get the location...
            me.getLocation(function (location) {
    
                // get Items
                me.getItems(location, function (store) {
    
                    // then bind data to list and show it
                    me.getDataList().setStore(store);
    
                    Ext.Viewport.setMasked(false);
                });
            });
        }
    On a side note, I want my app to have the option to run in the background like a windows service. I don't know what that is called in terms of iphone or android, but I want my app to be able to pop up under certain conditions with a either the app or a window with a link to open the full app. Any ideas? I could use them.

    Thanks

  2. #2
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    118
    Vote Rating
    3
    clifficious is on a distinguished road

      0  

    Default


    Hey, not sure if this helps. But I build a tiny app where I use the locationUpdate.
    Here is the code

    Code:
    geo = Ext.create('Ext.util.Geolocation', {
            autoUpdate: true,
            allowHighAccuracy: true,
            frequency: 5000,
            timeout: 30000,
            listeners: {
                locationupdate: function(geo) {
                    // Do something with the location, I print it on the screen here
                    Ext.getCmp('positionLabel').setValue('Lat: ' + geo.getLatitude() + ' Lon: '+geo.getLongitude());
                    Ext.getCmp('accspeed').setValue('Acc: '+geo.getAccuracy() + ' Speed: '+geo.getSpeed());
    
                    // or set a marker at the current location
                    var map = Ext.getCmp('map');
                    latlon = new google.maps.LatLng(geo.getLatitude(), geo.getLongitude());
    
                    marker = new google.maps.Marker({
                        position: latlon,
                        map: map.getMap()
                    });
                },
                locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
                    if(bTimeout){
                        alert('Timeout occurred.');
                    } else {
                        alert('Error occurred.'+message);
                    }
                }
            }
        });
    Unfortunately, there seems to be a bug with the sencha sdk using the GPS location. So the location is more based on network and wifi. I did a workaround with phoneGap to use the accurate GPS location.

    I'm not sure if you can realize your app as a background service. But would be happy if anybody has a idea.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Vote Rating
    0
    insomnix is on a distinguished road

      0  

    Default


    So do I just drop that chunk into the launch function?

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    118
    Vote Rating
    3
    clifficious is on a distinguished road

      0  

    Default


    Not sure if it runs in the launch or initialize function. Just try it. I have this triggered on a button handler. So the user can decide when the tracking starts and when it stops.

Thread Participants: 1