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

Android (Samsung Note 2) Device Orientation Change

6 Answers 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike Graham
Top achievements
Rank 1
Mike Graham asked on 06 Apr 2014, 12:29 PM
I was going out of my mind trying to get the device orientation change to work on my (Verizon) Samsung Note 2.

I ended up with the attached code (that seems to work) and am posting to get feedback and help anyone else with the same struggle.

I started with the Kendo Mobile sample app, upgraded the files to 2014 Q1, added a NavBar to the header in the layout, and then added the following to the app.js:

01.(function (global) {
02.    var mobileSkin = "",
03.        app = global.app = global.app || {};
04. 
05.    document.addEventListener('deviceready', function () {
06.        navigator.splashscreen.hide();
07.        $(document.body).height(window.innerHeight);
08.    }, false);
09. 
10.    kendo.onResize(function () {
11.        setTimeout(function () {
12.            $(document.body).height(window.innerHeight);
13.            window.scrollTo(0, 0);
14.        }, 400);
15.    });

6 Answers, 1 is accepted

Sort by
0
Mike Graham
Top achievements
Rank 1
answered on 06 Apr 2014, 01:06 PM
The above is causing problems:

1. when i try to debug in the simulator, the simulator crashes
2. the esri map control i'm using isn't resizing

Long day...
0
Mike Graham
Top achievements
Rank 1
answered on 06 Apr 2014, 03:12 PM
Debugger still crashing:  steps tried:  crash after each step:

Reversed out the code: debugger still crashes
Uninstalled Xamarin (installed yesterday to get free c# t-shirt)
Rebooted
Rebooted again

Finally decided to run the debugger and see if I could learn anything.

Apparently, there is a missing file:
C:\Users\Mike\AppData\Local\Telerik\BlackDragon\Cache\WebBrowserPackage-2014.1.313.2\WebBrowser\devtools.html

I also attached some images that show the exception and the missing file.

Where did the file go ???  How do I get it back ???  Will keep posting about the exciting saga ;)
0
Mike Graham
Top achievements
Rank 1
answered on 06 Apr 2014, 03:13 PM
More notes:

I uninstalled the App Builder visual studio extension
I reinstalled the App Builder visual studio extension

Earlier today, I ran the click-once App Builder app and it updated itself. Could it have removed the critical file ???

Stay tuned...
0
Mike Graham
Top achievements
Rank 1
answered on 06 Apr 2014, 03:22 PM
Now we're getting somewhere:

following this post: http://www.telerik.com/forums/debugging-in-simulator-crashing-the-simulator

I ended the simulator processes and deleted the contents of the cache from:
C:\Users\Mike\AppData\Local\Telerik\BlackDragon\Cache

YES !!!  the debugger runs again.  Now I can pop off the last few items in the task stack and get back to the original problem.  more soon :)
0
Mike Graham
Top achievements
Rank 1
answered on 06 Apr 2014, 04:06 PM
looks like it is all working.  here's the resize code (no delay needed) that makes the NavBar resize on Android (Verizon Samsung Note 2):

kendo.onResize(function () {
    $(document.body).height(window.innerHeight);
    window.scrollTo(0, 0);
});

And if you happen to be using the ESRI map control, this is the code (located in map.js after creating the esri map) that makes the map resize properly:

// if the user changes the device orientation, this will cause the esri map to pick up the new size
kendo.onResize(function () {
    map.resize();
    map.reposition();
});
0
Petyo
Telerik team
answered on 08 Apr 2014, 08:13 AM
Hello Mike,

Thank you very much for sharing your findings - please let us know if you need any help with the problem in question. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Mike Graham
Top achievements
Rank 1
Answers by
Mike Graham
Top achievements
Rank 1
Petyo
Telerik team
Share this question
or