Ejemplo n.º 1
0
  private void retrievePTN() {
    if (retryIntervals != null && retryIntervals.length > 0) {
      TnTelephonyManager.getInstance().startMMSAtBackground(destination, token);

      while (retryCount < retryIntervals.length) {
        if (isCancelled) break;

        synchronized (mutex_get_ptn) {
          try {
            writeLog(
                "DimProvider - retry time:"
                    + retryCount
                    + ", interval:"
                    + retryIntervals[retryCount]
                    + "ms");
            mutex_get_ptn.wait(retryIntervals[retryCount]);
          } catch (InterruptedException e) {
            Logger.log(this.getClass().getName(), e);
          }
        }

        if (isCancelled) break;

        writeLog("DimProvider - retry time:" + retryCount + ", start request PTN !!!");

        dimProxy =
            (JsonDimProxy)
                ServerProxyFactory.getInstance()
                    .createDimProxy(null, CommManager.getInstance().getComm(), this, null);
        dimProxy.requestGetPtn(token, isPtnEncrypted, (byte) 0, 30000);

        synchronized (mutex_retry) {
          try {
            writeLog(
                "DimProvider - retry time:" + retryCount + ", request work wait:" + timeout + "ms");
            mutex_retry.wait(timeout);
          } catch (InterruptedException e) {
            Logger.log(this.getClass().getName(), e);
          }
        }

        dimProxy.cancel();

        writeLog("DimProvider - retry time:" + retryCount + ", request work wait, wake up now!!!");

        retryCount++;
      }
    }
    notifyDimFinish();
  }
 public void initTelephony() {
   if (TnTelephonyManager.getInstance() == null) {
     TnTelephonyManager.init(
         new AndroidTelephonyManager(AndroidPersistentContext.getInstance().getContext()));
   }
 }