@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LOG.Log(Module.GUI, "onCreate"); // GUI initialization code getWindow().requestFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); disableThumbnails = checkUnityProperty("Unity_DisableThumbnails"); // security reasons; don't allow screen shots while this window is displayed /* not valid for builds under level 14 */ if (disableThumbnails && Build.VERSION.SDK_INT >= 14) { getWindow() .setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); } appView = new WebView(this); appView.enablePlatformNotifications(); setGlobalProxy(); appView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); appView.setId(APPVIEW_ID); appView.setWebViewClient(new UnityWebViewClient()); appView.getSettings().setJavaScriptEnabled(true); appView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); appView.getSettings().setAllowFileAccess(true); appView.getSettings().setSupportZoom(false); appView.getSettings().setAppCacheEnabled(false); appView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); appView.getSettings().setAppCacheMaxSize(0); appView.getSettings().setSavePassword(false); appView.getSettings().setSaveFormData(false); appView.getSettings().setDefaultTextEncodingName("UTF-8"); appView.getSettings().setGeolocationEnabled(true); appView.getSettings().setLightTouchEnabled(true); appView.getSettings().setRenderPriority(RenderPriority.HIGH); appView.getSettings().setDomStorageEnabled(true); // [MOBPLAT-129] enable HTML5 local storage appView.setVerticalScrollBarEnabled(false); // Required settings to enable HTML5 database storage appView.getSettings().setDatabaseEnabled(true); String databasePath = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); appView.getSettings().setDatabasePath(databasePath); webChromeClient = new WebChromeClient() { // Required settings to enable HTML5 database storage @Override public void onExceededDatabaseQuota( String url, String databaseIdentifier, long currentQuota, long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) { quotaUpdater.updateQuota(estimatedSize * 2); }; @Override public void onReachedMaxAppCacheSize( long spaceNeeded, long totalUsedQuota, android.webkit.WebStorage.QuotaUpdater quotaUpdater) { quotaUpdater.updateQuota(0); }; @Override public boolean onConsoleMessage(ConsoleMessage cm) { LOG.Log( Module.GUI, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId()); return true; } }; appView.setWebChromeClient(webChromeClient); // create the application logger LogManager.setDelegate(new AndroidLoggerDelegate()); // save the context for further access AndroidServiceLocator.setContext(this); // initialize the service locator activityManager = new AndroidActivityManager(this, appView); // killing previous background processes from the same package activityManager.killBackgroundProcesses(); AndroidServiceLocator serviceLocator = (AndroidServiceLocator) AndroidServiceLocator.GetInstance(); serviceLocator.RegisterService( this.getAssets(), AndroidServiceLocator.SERVICE_ANDROID_ASSET_MANAGER); serviceLocator.RegisterService( activityManager, AndroidServiceLocator.SERVICE_ANDROID_ACTIVITY_MANAGER); startServer(); /* THIS COULD NOT BE CHECKED ON API LEVEL < 11; NO suchmethodexception boolean hwAccelerated = appView.isHardwareAccelerated(); if(hwAccelerated) LOG.Log(Module.GUI,"Application View is HARDWARE ACCELERATED"); else LOG.Log(Module.GUI,"Application View is NOT hardware accelerated"); */ final IntentFilter actionFilter = new IntentFilter(); actionFilter.addAction(android.net.ConnectivityManager.CONNECTIVITY_ACTION); // actionFilter.addAction("android.intent.action.SERVICE_STATE"); registerReceiver(new AndroidNetworkReceiver(appView), actionFilter); final Activity currentContext = this; new Thread( new Runnable() { public void run() { currentContext.runOnUiThread( new Runnable() { public void run() { appView.loadUrl(WEBVIEW_MAIN_URL); } }); } }) .start(); holdSplashScreenOnStartup = checkUnityProperty("Unity_HoldSplashScreenOnStartup"); hasSplash = activityManager.showSplashScreen(appView); RemoteNotificationIntentService.loadNotificationOptions(getResources(), appView, this); LocalNotificationReceiver.initialize(appView, this); }