简体   繁体   中英

deploying web app to android without phonegap

I am deploying my Sench touch 2 app to android. I am using PhoneGap to do it. It works fine but is slow. I was trying to deploy the app without PhoneGap to a embedded Webview.

I get the app running but it doesn't get past the sencha loading screen.

here my MainActivity

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView myWebView = (WebView) findViewById(R.id.webView1);
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setAllowFileAccess(true); // i was trying this, dont know if i need it
        myWebView.loadUrl("file:///android_asset/www/index.html");
    }
}

here is my layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" />

</RelativeLayout>

These are the permissions I have enabled

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

I cant seem to figure out what I am missing. Is there something special i have to do to make this run?

Oh and LogCat dosent show any thing ...

If you're not planning on calling any native code (except via Ext.Device), you could also use package your Sencha app using Sencha SDK Tools/ Sencha CMD.

Documentation at:
http://docs.sencha.com/touch/2-0/#!/guide/native_android

Please note Sencha SDK Tools recently got updated to Sencha CMD, for more information and further documentation see the blogpost on the release here:
http://www.sencha.com/blog/all-new-sencha-cmd/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM