1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    rock_pec is on a distinguished road

      0  

    Default Unanswered: Sencha Touch + Phonegap 1.3 - Not working on Android

    Unanswered: Sencha Touch + Phonegap 1.3 - Not working on Android


    Hi,

    I have a very simple app (more like hello world). It works perfectly in iPhone emulator but on Android I am getting a blank screen. Here is my code -

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
    <meta charset="utf-8">
    <!-- iPad/iPhone specific css below, add after your main css >
            <link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />        
            <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />        
    -->
    <script type="text/javascript" src="lib/phonegap-1.3.0.js"></script>
    <link href="lib/touch/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="lib/touch/sencha-touch.js"></script>
    <link href="stylesheets/styles.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="app/app.js"></script>
    <script type="text/javascript">
      document.addEventListener("deviceready", vocabbuilderapp.launch, false);
    </script>
    </head>
    <body>
    </body>
    </html>
    app.js

    Code:
    Ext.regApplication({
      name: 'vocabbuilderapp',
    
    
      profiles: {
        phoneBlackberry: function() {
         return Ext.is.Blackberry;
        },
        phoneAndroid: function() {
         return Ext.is.Android;
        },
        tabletPortrait: function() {
         return Ext.is.Tablet && Ext.orientation == 'portrait';
        },
        tabletLandscape: function() {
         return Ext.is.Tablet && Ext.orientation == 'landscape';
        }
      },
    
    
      launch: function() {
        this.launched = true;
        this.mainLaunch();
      },
    
    
      mainLaunch: function() {
        if (!device || !this.launched) {return;}
        this.showUI();  
      },
      
      showUI: function() {
        var panel = new Ext.Panel({
          fullscreen: true,
          layout: 'card',
          cls: 'nice',
          html: "Hello!",
          listeners: {
            orientationchange: function(thisPnl, orientation, width, height){
              Ext.Msg.alert("INFO", "Orientation: " + orientation);
            }
          }
        });
    
    
        Ext.Msg.alert("INFO", "Device: " + this.getProfile());
      }
    });
    I am getting no error just a blank white screen in Android. Can anyone please help me. I am really pulling my hair out on this one.

    Thanks

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    rock_pec is on a distinguished road

      0  

    Default I think I got it

    I think I got it


    The phonegap.js is different for iOS and Android. I was running the app on Android with iOS's phonegap.js. App is working now on Android after I changed the js.

    Thanks