1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Posts
    63
    Answers
    1
    Vote Rating
    1
    nmcbride is on a distinguished road

      0  

    Default Unanswered: Ext.device.Device.{name,platform,uuid} Unreliable?

    Unanswered: Ext.device.Device.{name,platform,uuid} Unreliable?


    I am currently getting the name/platform/uuid of my android device using the following code:
    Code:
    var devicename = Ext.device.Device.name;
    var deviceplatform = Ext.device.Device.platform;
    var deviceid = Ext.device.Device.uuid;
    
    
    var devicenameTextfield = Ext.ComponentQuery.query('textfield[name=devicename]')[0];
    devicenameTextfield.setValue(devicename);
    
    
    var deviceplatformTextfield = Ext.ComponentQuery.query('textfield[name=deviceplatform]')[0];
    deviceplatformTextfield.setValue(deviceplatform);
    
    
    var deviceidTextfield = Ext.ComponentQuery.query('textfield[name=deviceid]')[0];
    deviceidTextfield.setValue(deviceid);
    Sometimes it works perfectly. Other times it doesn't work at all and I get the values you would get if the singletons weren't supported. When I do not get values back I have to kill the app and restart it until I do.

    I have also tried doing something like the below:

    Code:
    var device = new Ext.device.Device();
    
    
    var devicename = device.name;
    var deviceplatform = device.platform;
    var deviceid = device.uuid;
    
    
    var devicenameTextfield = Ext.ComponentQuery.query('textfield[name=devicename]')[0];
    devicenameTextfield.setValue(devicename);
    
    
    var deviceplatformTextfield = Ext.ComponentQuery.query('textfield[name=deviceplatform]')[0];
    deviceplatformTextfield.setValue(deviceplatform);
    
    
    var deviceidTextfield = Ext.ComponentQuery.query('textfield[name=deviceid]')[0];
    deviceidTextfield.setValue(deviceid);
    In a function I can keep calling until I get values back however this doesn't work at all. Does anyone have any ideas?

    Thanks

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Posts
    63
    Answers
    1
    Vote Rating
    1
    nmcbride is on a distinguished road

      0  

    Default


    Is there a way way to re-initialize Ext.device.Device or something like that?

  3. #3
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Answers
    328
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    This is the first I am hearing of this. Forgive me as I have to ask the obvious, but did you require Ext.device.Device. Whether or not it works does this vary by device or does this happen on the same device?
    You may want to checkout the phonegap implementation to see if you get better results.
    http://docs.phonegap.com/en/edge/cor...md.html#Device
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

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

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

    Need to include a test case use:
    The official Sencha Fiddle

  4. #4
    Sencha User =NR='s Avatar
    Join Date
    Mar 2013
    Location
    Singapore
    Posts
    106
    Answers
    2
    Vote Rating
    0
    =NR= has a little shameless behaviour in the past

      0  

    Default


    Quote Originally Posted by fmoseley View Post
    This is the first I am hearing of this. Forgive me as I have to ask the obvious, but did you require Ext.device.Device. Whether or not it works does this vary by device or does this happen on the same device?
    You may want to checkout the phonegap implementation to see if you get better results.
    http://docs.phonegap.com/en/edge/cor...md.html#Device
    the simple act of requiring the Ext.device.Device will make the app is not working (not moving beyond the launch/loading screen) most likely doesn't even get into the app launch function.

    sencha said that this problem is fixed on version prior to 2.1 but I'm using 2.1.1 yet this problem still exist.
    http://www.sencha.com/forum/showthread.php?196922

    I'm using phonegap/cordova as the packager.
    Which i suppose should be working fine and does not need to be using sencha native packager (what is this thing anyway? why you have another packager when you are kept promoting developer to use phonegap/cordova as the packager)
    http://docs.sencha.com/touch/2.1.1/#!/api/Ext.device.Device-method-openURL

  5. #5
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Answers
    328
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    You can only use openUrl if you are packaging with Sencha native packager.
    See note is documentation
    http://docs.sencha.com/touch/2.3.1/#!/api/Ext.device.device.Sencha-method-openURL

    If you are using phonegap you should use a plugin like
    https://github.com/EddyVerbruggen/La...honeGap-Plugin
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

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

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

    Need to include a test case use:
    The official Sencha Fiddle

  6. #6
    Sencha User =NR='s Avatar
    Join Date
    Mar 2013
    Location
    Singapore
    Posts
    106
    Answers
    2
    Vote Rating
    0
    =NR= has a little shameless behaviour in the past

      0  

    Default


    Quote Originally Posted by fmoseley View Post
    You can only use openUrl if you are packaging with Sencha native packager.
    See note is documentation
    http://docs.sencha.com/touch/2.3.1/#!/api/Ext.device.device.Sencha-method-openURL

    If you are using phonegap you should use a plugin like
    https://github.com/EddyVerbruggen/La...honeGap-Plugin
    yeah its simple thing with phonegap after you figure it out.
    Basically just install inappbrowser plugin for phonegap and use:
    Code:
    window.open("www.yoururlgoeshere.com", "_system");
    there is 3 values for the second parameter:
    _blank: open the url in app
    _system: open the url with system browser (device's browser)
    _self: ....

Thread Participants: 2