コード例 #1
1
ファイル: MoSync.java プロジェクト: Vienzzion/MoSync
 @Override
 public void onNewIntent(Intent intent) {
   if (MoSyncNFCService.handleNFCIntent(this, intent)) {
     Log.d("@@@ MoSync", "Discovered tag");
   }
   super.onNewIntent(intent);
 }
コード例 #2
0
ファイル: MoSync.java プロジェクト: Vienzzion/MoSync
  /**
   * Sets screen and window properties. Creates and initializes the MoSync thread Calls the
   * createMoSyncView method and then shows the created view.
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.i("MoSync", "MoSync onCreate");

    super.onCreate(savedInstanceState);

    try {
      // If triggered by an NFC event, must handle it this way.
      MoSyncNFCService.handleNFCIntent(this, getIntent());
      nfcForegroundHandler = MoSyncNFCForegroundUtil.create(this);
    } catch (Throwable t) {
      SYSLOG("No NFC");
    }

    // Initialize.
    mMoSyncView = null;

    // MoSync Android apps do not have a system title bar.
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    // Default screen orientation is portrait mode.
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    try {
      // Create the thread.
      mMoSyncThread = new MoSyncThread(this, new Handler());
    } catch (Exception ex) {
      MoSyncThread.logError("MoSync - Unable to create thread! " + "Application is closed!", ex);
      finish();
      return;
    }

    try {
      // If triggered by a GCM/C2DM message, handle it here.
      // Call this after the MoSyncThread is created.
      if (getIntent()
          .getBooleanExtra(PushNotificationsUtil.MOSYNC_INTENT_EXTRA_NOTIFICATION, false)) {
        Log.e("@@MoSync", "MoSync activity started after a push notification was received");
        PushNotificationsManager.handlePushNotificationIntent(getIntent());
      }
    } catch (Throwable t) {
      SYSLOG("No GCM/C2DM message");
    }

    // Create the view.
    mMoSyncView = createMoSyncView();
    if (null != mMoSyncView) {
      mMoSyncThread.setMoSyncView(mMoSyncView);

      setContentView(mMoSyncView);
    } else {
      finish();
      return;
    }

    registerShutdownListener();
  }