sencha touch + Cordova 生成打包 解决安卓4.1之上启动系统白屏问题

直接代码,搬运...

 1 package com.example.jy110;
 2 
 3 import org.apache.cordova.DroidGap;
 4 
 5 import android.annotation.TargetApi;
 6 import android.os.Bundle;
 7 
 8 
 9 public class Jy110Activity extends DroidGap {
10     private int retryCount = 0;
11     @Override
12     public void onCreate(Bundle savedInstanceState) {
13         super.onCreate(savedInstanceState);
14         super.setIntegerProperty("splashscreen", R.drawable.splash);
15         super.init();
16         if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
17             fixJellyBeanIssues();
18         }
19         super.loadUrl("file:///android_asset/www/index.html",5000);
20     }
21 
22     @TargetApi(16)
23     protected void fixJellyBeanIssues() {
24         System.out.println(super.appView.toString());
25         try {
26             super.appView.getSettings().setAllowUniversalAccessFromFileURLs(true);
27         } catch(NullPointerException e) {
28             System.out.println(e.toString());
29         }
30     }
31 
32     @Override
33     public void onReceivedError( int errorCode, String description, String failingUrl)
34     {
35         if(retryCount < 3) {
36             retryCount++;
37             super.loadUrl("file:///android_asset/www/index.html");
38         } else {
39             super.loadUrl("file:///android_asset/www/fail.html");
40         }
41         return;
42     }
43 
44 }

 

你可能感兴趣的:(Sencha Touch)