当前位置: 首页>>代码示例>>Java>>正文


Java DirectoryRefreshJob类代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.jobs.DirectoryRefreshJob的典型用法代码示例。如果您正苦于以下问题:Java DirectoryRefreshJob类的具体用法?Java DirectoryRefreshJob怎么用?Java DirectoryRefreshJob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DirectoryRefreshJob类属于org.thoughtcrime.securesms.jobs包,在下文中一共展示了DirectoryRefreshJob类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: schedule

import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob; //导入依赖的package包/类
public static void schedule(Context context) {
  if (!TextSecurePreferences.isPushRegistered(context)) return;

  AlarmManager      alarmManager  = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  Intent            intent        = new Intent(DirectoryRefreshListener.REFRESH_EVENT);
  PendingIntent     pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
  long              time          = TextSecurePreferences.getDirectoryRefreshTime(context);

  if (time <= System.currentTimeMillis()) {
    if (time != 0) {
      ApplicationContext.getInstance(context)
                        .getJobManager()
                        .add(new DirectoryRefreshJob(context));
    }

    time = System.currentTimeMillis() + INTERVAL;
  }

  Log.w("DirectoryRefreshListener", "Scheduling for: " + time);

  alarmManager.cancel(pendingIntent);
  alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);

  TextSecurePreferences.setDirectoryRefreshTime(context, time);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:26,代码来源:DirectoryRefreshListener.java

示例2: onAlarm

import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob; //导入依赖的package包/类
@Override
protected long onAlarm(Context context, long scheduledTime) {
  if (scheduledTime != 0 && TextSecurePreferences.isPushRegistered(context)) {
    ApplicationContext.getInstance(context)
                      .getJobManager()
                      .add(new DirectoryRefreshJob(context));
  }

  long newTime = System.currentTimeMillis() + INTERVAL;
  TextSecurePreferences.setDirectoryRefreshTime(context, newTime);

  return newTime;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:14,代码来源:DirectoryRefreshListener.java

示例3: doInBackground

import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob; //导入依赖的package包/类
@Override
    protected Void doInBackground(Integer... params) {
      Context context = DatabaseUpgradeActivity.this.getApplicationContext();

      Log.w("DatabaseUpgradeActivity", "Running background upgrade..");
      DatabaseFactory.getInstance(DatabaseUpgradeActivity.this)
                     .onApplicationLevelUpgrade(context, masterSecret, params[0], this);

      if (params[0] < CURVE25519_VERSION) {
        IdentityKeyUtil.migrateIdentityKeys(context, masterSecret);
      }

      if (params[0] < NO_V1_VERSION) {
        File v1sessions = new File(context.getFilesDir(), "sessions");

        if (v1sessions.exists() && v1sessions.isDirectory()) {
          File[] contents = v1sessions.listFiles();

          if (contents != null) {
            for (File session : contents) {
              session.delete();
            }
          }

          v1sessions.delete();
        }
      }

      if (params[0] < SIGNED_PREKEY_VERSION) {
        ApplicationContext.getInstance(getApplicationContext())
                          .getJobManager()
                          .add(new CreateSignedPreKeyJob(context));
      }

      if (params[0] < NO_DECRYPT_QUEUE_VERSION) {
        scheduleMessagesInPushDatabase(context);
      }

      if (params[0] < PUSH_DECRYPT_SERIAL_ID_VERSION) {
        scheduleMessagesInPushDatabase(context);
      }

      if (params[0] < MIGRATE_SESSION_PLAINTEXT) {
        new TextSecureSessionStore(context, masterSecret).migrateSessions();
        new TextSecurePreKeyStore(context, masterSecret).migrateRecords();

        IdentityKeyUtil.migrateIdentityKeys(context, masterSecret);
        scheduleMessagesInPushDatabase(context);;
      }

      if (params[0] < CONTACTS_ACCOUNT_VERSION) {
        ApplicationContext.getInstance(getApplicationContext())
                          .getJobManager()
                          .add(new DirectoryRefreshJob(getApplicationContext()));
      }

      if (params[0] < MEDIA_DOWNLOAD_CONTROLS_VERSION) {
        schedulePendingIncomingParts(context);
      }

      if (params[0] < REDPHONE_SUPPORT_VERSION) {
        ApplicationContext.getInstance(getApplicationContext())
                          .getJobManager()
                          .add(new RefreshAttributesJob(getApplicationContext()));
        ApplicationContext.getInstance(getApplicationContext())
                          .getJobManager()
                          .add(new DirectoryRefreshJob(getApplicationContext()));
      }

//      if (params[0] < FINGERPRINTS_NON_BLOCKING_VESRION) {
//        TextSecurePreferences.setBlockingIdentityUpdates(getApplicationContext(), true);
//      }

      return null;
    }
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:76,代码来源:DatabaseUpgradeActivity.java


注:本文中的org.thoughtcrime.securesms.jobs.DirectoryRefreshJob类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。