Android (Samsung Note 2) Device Orientation Change

7 posts, 0 answers
  1. Mike Graham
    Mike Graham avatar
    29 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 Link to this post

    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.    });
  2. Mike Graham
    Mike Graham avatar
    29 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 in reply to Mike Graham Link to this post

    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...
  3. Kendo UI is VS 2017 Ready
  4. Mike Graham
    Mike Graham avatar
    29 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 in reply to Mike Graham Link to this post

    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 ;)
  5. Mike Graham
    Mike Graham avatar
    29 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 in reply to Mike Graham Link to this post

    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...
  6. Mike Graham
    Mike Graham avatar
    29 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 in reply to Mike Graham Link to this post

    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 :)
  7. Mike Graham
    Mike Graham avatar
    29 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 in reply to Mike Graham Link to this post

    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();
    });
  8. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 08 Apr 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready