This is a migrated thread and some comments may be shown as answers.

Geolocation in Icenium

10 Answers 143 Views
Feedback & Suggestions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mvbaffa
Top achievements
Rank 1
mvbaffa asked on 28 Feb 2013, 05:25 PM
Hi,

I have changed the sample-geolocation example to work in a KendoUI Mobile simple application I have developed.

It seems to working ok on my desktop, the watchPosition gets peridically the current position and generates the onSucces event. My project works with RequireJs, KendoUI Mobile and the Kendo MVVM. Is seems OK.

If I run on device the problems starts to happen. The main view is displayed, the first position event, generated by watchPosition, is fired, but the position events stpped to be fired. It seems that the program crashed.

When I generate the APK and deployied it manually to my Galaxy S Beam the Icenium Splash screen is displayed and after that a white screen, no content, appears and nothing happens.

One more thing if I export the project and build with PhoneGap Build the apk is incredibly larger, in Icenium it takes 390Kb in Phonegap Build 1.6 MB. But when I deploy the apk to the device the same thing accurs. A white View is displayed.

Is this a known issue ? Can you help me ?

Thanks in advance

10 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 01 Mar 2013, 12:46 PM
Hello,

Can you help us to reproduce the issue by providing a sample that we can use to reproduce that. Maybe you can insulate the issue in single html code snippet?
 

Greetings,
Jordan
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
mvbaffa
Top achievements
Rank 1
answered on 01 Mar 2013, 03:05 PM
Hi Jordan,

I have a Module that does collect the dataPoints with watchLocation and a ViewModel File. As soon as I can have access to my development machine send you the source file.

The deploy on device is working, but the APK still shows a white screen.

Thanks
0
mvbaffa
Top achievements
Rank 1
answered on 06 Mar 2013, 08:38 PM
It is very difficult in one file. If there is a way to send the zip generated by Icenium it would be better.

Anyway this is main class that gets the geolocation:

define("GeoLocation", ["kendo", "app/viewModel/vmHome"], function (kendo, vmHome) {
    
    var _numCollection = 1;
    
    function GeoLocation() {
        
        this._watchID = null;
        this._currPosition = {numCollection: 0, description: ""};
    };
    
    GeoLocation.prototype.run = function() {
        var that = this;
        _handleWatch.apply(that, arguments);
    };
    
    var _handleWatch = function() {
        
        var that = this;
        
        if (that._watchID != null) {
_setResults("");
navigator.geolocation.clearWatch(that._watchID);
//that._watchID = null;
            _setResults("Start Geolocation Watch");
}
else {
_setResults("Waiting for geolocation information...");
// Update the watch every second.
var options = {
maximumAge:10000, timeout:10000,
enableHighAccuracy: true
};
that._watchID = navigator.geolocation.watchPosition(function() {
_onSuccess.apply(that, arguments);
}, function() {
_onError.apply(that, arguments);
}, options);
            _setResults("Clear Geolocation Watch");
}
    };
        
    var _onSuccess = function(position) {
        
        _numCollection++;
        _setResults("Collecting Data" + ', Coleta: ' + _numCollection.toString());
        
        //var _geocoder = new GClientGeocoder();
        //var _point = new GLatLng(position.coords.latitude, position.coords.longitude);
        //_geocoder.getLocations(_point, _showAddress);
        
        var geocoder = new google.maps.Geocoder();
        var _point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
        geocoder.geocode( {'latLng': _point}, _showAddressV3 );
    };
    
    var _showAddressV3 = function(results, status) {
        
        var _currPosition = {numCollection: 0, description: ""};
        
        if (status == google.maps.GeocoderStatus.OK) {
            if (results[1]) {
                _currPosition.numCollection = _numCollection;
                _currPosition.description = (_numCollection).toString() + ") " +
                                            "<b>latlng:</b>&nbsp;" + results[0].geometry.location.ib.toString() + "," + results[0].geometry.location.jb.toString() + "<br/>" +
                                            "<b>Address:</b>&nbsp;" + results[0].formatted_address;
                vmHome.viewModel.addPoint(_currPosition); 
                }
        } else {
             _currPosition.numCollection = _numCollection;
            _currPosition.description = (_numCollection).toString() + ")&nbsp;" +
                                        "Error Code:" + status;
            vmHome.viewModel.addPoint(_currPosition);
        }
    }
    
    var _showAddress = function(response) {
        
        var _currPosition = {numCollection: 0, description: ""};
        
        if (!response || response.Status.code != 200) {
            _currPosition.numCollection = _numCollection;
            _currPosition.description = (_numCollection).toString() + ")&nbsp;" +
                                        "Error Code:" + response.Status.code;
            vmHome.viewModel.addPoint(_currPosition);
        } else {
            var _place = response.Placemark[0];
            _currPosition.numCollection = _numCollection;
            _currPosition.description = (_numCollection).toString() + ")&nbsp;" +
                                        "<b>latlng:</b>&nbsp;" + response.name + "<br/>" +
                                        "<b>Address:</b>&nbsp;" + _place.address;
            vmHome.viewModel.addPoint(_currPosition);
        }
    };
    
    var _onError = function(error) {

        _setResults('code: ' + error.code + '<br/>' +
'message: ' + error.message + '<br/>');
    };
    
    var _setResults = function (value) {
        if (!value) {
vmHome.viewModel.set("message", "");
}
else {
            vmHome.viewModel.set("message", value);
}
    };

    return GeoLocation;
});
    
0
Steve
Telerik team
answered on 07 Mar 2013, 09:26 AM
Hello,

Thank you for the code snippets you've provided, but we would need more than that.

We have transferred your forum thread to our support system, so you can attach a sample we can use to replicate the problem you've encountered. Once we review it, we would be able to provide you with more information on the matter.

Regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
mvbaffa
Top achievements
Rank 1
answered on 08 Mar 2013, 06:56 PM
Hi Jordan

I am sending yoy the zip generate by Icenium Export. <FILE REMOVED BY ADMIN FOR PRIVACY>

Thanks in advance
0
Jordan
Telerik team
answered on 13 Mar 2013, 08:15 AM
<THREAD CONVERTER TO FORUM POST FOR COMMUNITY REFERENCE>

Hello Markus,

I just found the issue with your project the problem is that pats have to be case-sensitive and relative too. In your case it is GeoLocation with lowercase 'l'. Please rename file to be with uppercase 'L'.



Good news is that with next release in a week or so in Mist simulator we will catch that and will return:
... My%20way/scripts/app/model/GeoLocation.js 404 (Mobile application path must be case-sensitive.)

Greetings,
Jordan
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
mvbaffa
Top achievements
Rank 1
answered on 13 Mar 2013, 01:29 PM
Thanks Jordan

It worked.

But I have two other questions:
1) How can we treat the android back hardware button. My application has two tabs if I navigate and press the backbutton it returns to the other tab. How can I drive the back button event  to avoid this;

2) Is there a place where I can learn how the View events work. The init event is only fired when the tab that contains the view is first opened. The events of KendoMobile are a little bit confused.

Can you help me ???
Thanks in advance
0
Steve
Telerik team
answered on 14 Mar 2013, 01:58 PM
Hi Markus,

Glad we were able to narrow down the original problem. Up to your new questions:
  1. In general the back button behavior in Android is pretty much undetermined and it acts differently in different scenarios. Since you have not shared what you expect to happen, can you elaborate? You can take a look at the backbutton event docs and see if that makes any difference for your scenario.
  2. Take a look at the following articles:

Regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
mvbaffa
Top achievements
Rank 1
answered on 14 Mar 2013, 02:08 PM
Thanks Steve,

I will check it out.
0
Jan-Dirk
Top achievements
Rank 1
answered on 15 Mar 2013, 09:51 AM
I have this in my onDeviceReady:

document.addEventListener("backbutton", onBackKeyDown, false);



and function onBackKeyDown:

    function onBackKeyDown() {

        if (detailPageActive == 0) {

            navigator.notification.confirm('Exit App?', onConfirmExit, '', 'No, Yes');

        }

        else {

            detailPageActive = 0;

            history.back();

        }

    }



My app has tabs with listviews and detailpages with details of the items
in these listviews. When a detailpage is active (value 1) then I do a
history back and set detailpage to 0. If detailpage is already 0, then I
know I am on a tab and the user get a confirm box which asks if I want
to exit.



    function onConfirmExit(button) {

         navigator.app.exitApp();   

    }



Works very well for me this way, I have this in multiple apps
Tags
Feedback & Suggestions
Asked by
mvbaffa
Top achievements
Rank 1
Answers by
Jordan
Telerik team
mvbaffa
Top achievements
Rank 1
Steve
Telerik team
Jan-Dirk
Top achievements
Rank 1
Share this question
or