protected void setup() { Runnable pageActivityLauncher = new Runnable() { @Override public void run() { if (hasSplashScreenExists()) { splashView = new ImageView(getApplicationContext()); splashView.setScaleType(ScaleType.FIT_CENTER); InputStream stream = getSplashFileStream(); splashView.setImageBitmap(BitmapFactory.decodeStream(stream)); splashView.setBackgroundColor(app.getAppJsonSetting().getSplashBackgroundColor()); try { stream.close(); } catch (Exception e) { } setContentView(splashView); overridePendingTransition( mobi.monaca.framework.psedo.R.anim.monaca_none, mobi.monaca.framework.psedo.R.anim.monaca_slide_close_exit); handler = new Handler(); pageLauncher = new Runnable() { @Override public void run() { Intent intent = createActivityIntent(); startActivity(intent); finish(); } }; handler.postDelayed(pageLauncher, 1000); } else { goNextActivityWithoutSplash(); } } }; if (shouldExtractAsset()) { MyLog.v(TAG, "should extract asset!!!!"); setupLocalFileBootLoaderAndRunProject(pageActivityLauncher); } else { if (!usesLocalFileBootloader) { pageActivityLauncher.run(); LocalFileBootloader.mShouldExtractAssets = false; } else { setupLocalFileBootLoaderAndRunProject(pageActivityLauncher); } } }
protected void registerGCM() { try { String senderId = app.getAppJsonSetting().getSenderId(); // GCM registration process GCMRegistrar.checkDevice(this); GCMRegistrar.checkManifest(this); final String regId = GCMRegistrar.getRegistrationId(this); if (regId.equals("")) { GCMRegistrar.register(this, senderId); } else { ((MonacaApplication) getApplication()).sendGCMRegisterIdToAppAPI(regId); } } catch (Exception e) { MyLog.d(TAG, "this device or application does not support GCM"); e.printStackTrace(); } }