@Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   // Start polling service
   PollingUtils.startPollingService(this, 10 * 60, PollingService.class, PollingService.ACTION);
 }
Пример #2
0
 @SuppressLint("JavascriptInterface")
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   File dir = this.getExternalFilesDir(null);
   if (dir == null) {
     dir = this.getFilesDir();
   }
   Db.get().init(dir.toString());
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_wuyun);
   this.webView = ((WebView) findViewById(R.id.webView));
   this.webView.getSettings().setJavaScriptEnabled(true);
   this.webView.addJavascriptInterface(new MyJavaScriptInterface(this), "backend");
   this.webView.setWebChromeClient(new WebChromeClient() {});
   this.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
   this.webView.requestFocus();
   this.webView.setWebViewClient(new MyWebViewClient(null));
   this.webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
   this.webView.loadUrl("file:///android_asset/index.html");
   new PollingService.PollingThread().start();
   PollingUtils.startPollingService(this, 600, PollingService.class, PollingService.ACTION);
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   // Stop polling service
   PollingUtils.stopPollingService(this, PollingService.class, PollingService.ACTION);
 }