PhoneGap not running in Android

后端 未结 2 1712
暗喜
暗喜 2020-12-08 12:46

I\'m trying to run PhoneGap first time on Android device (Samsung Galaxy S II); however, it doesn\'t seem to work.

Here the code I try so far:



        
2条回答
  •  抹茶落季
    2020-12-08 13:15

    First create one Android application with Eclipse and then

    Follow this Steps :

    1 Import cordova-2.2.0.jar file into your project.

    [2] Add cordova-2.2.0.js file into your assets/www folder.

    [3] Copy xml folder came with cordova source into res folder

    [4] Replace your activity with this.

    package com.cordovatest;
    
    import org.apache.cordova.DroidGap;
    
    import android.os.Bundle;
    
    public class MainActivity extends DroidGap {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            super.setIntegerProperty("loadUrlTimeoutValue", 60000);        
            super.loadUrl("file:///android_asset/www/index.html",1000);
        }
    
    
    }
    

    [5] Add index.html file into assets/www folder with this content.

    
    
      
        Contact Example
    
        
        
      
      
        

    Example

    Display Contacts

    [6] Add following permissions into your Manifest file.

        
        
        
        
        
        
        
        
        
        
        
           
           
        
        
        
    

    That's It.

    You will have your contacts details on your screen.

    Hope it helps you.

    Thanks.

提交回复
热议问题