本文整理汇总了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);
}
示例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;
}
示例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;
}