Ejemplo n.º 1
0
    protected Boolean doInBackground(Void... params) {
      // Prevent the onDestroy() method to overlap with initialization:
      synchronized (mShutdownLock) {
        QCAR.setInitParameters(CopyOfQCARInitActivity_xxx.this, mVuforiaFlags);
        do {
          mProgressValue = QCAR.init();
          // Publish the progress value:
          publishProgress(mProgressValue);
        } while (!isCancelled() && mProgressValue >= 0 && mProgressValue < 100);

        return (mProgressValue > 0);
      }
    }
Ejemplo n.º 2
0
  @Override
  protected void onDestroy() {
    DLog.LOGD("onDestroy");
    super.onDestroy();
    SysMng.OnDeInit();
    // Cancel potentially running tasks
    if (mInitVuforiaTask != null
        && mInitVuforiaTask.getStatus() != InitVuforiaTask.Status.FINISHED) {
      mInitVuforiaTask.cancel(true);
      mInitVuforiaTask = null;
    }

    if (mLoadTrackerTask != null
        && mLoadTrackerTask.getStatus() != LoadTrackerTask.Status.FINISHED) {
      mLoadTrackerTask.cancel(true);
      mLoadTrackerTask = null;
    }

    // Ensure that all asynchronous operations to initialize Vuforia
    // and loading the tracker datasets do not overlap:
    synchronized (mShutdownLock) {

      // Do application deinitialization in native code:
      deinitApplicationNative();

      // Unload texture:
      mTextures.clear();
      mTextures = null;

      // Destroy the tracking data set:
      destroyTrackerData();

      // Deinit the tracker:
      deinitTracker();

      // Deinitialize Vuforia SDK:
      QCAR.deinit();
    }

    System.gc();
  }