本文整理汇总了Java中org.thoughtcrime.securesms.util.TextSecurePreferences.getLocalRegistrationId方法的典型用法代码示例。如果您正苦于以下问题:Java TextSecurePreferences.getLocalRegistrationId方法的具体用法?Java TextSecurePreferences.getLocalRegistrationId怎么用?Java TextSecurePreferences.getLocalRegistrationId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.thoughtcrime.securesms.util.TextSecurePreferences
的用法示例。
在下文中一共展示了TextSecurePreferences.getLocalRegistrationId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRun
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
@Override
public void onRun() throws IOException {
String signalingKey = TextSecurePreferences.getSignalingKey(context);
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
boolean video = TextSecurePreferences.isWebrtcCallingEnabled(context);
boolean fetchesMessages = TextSecurePreferences.isGcmDisabled(context);
signalAccountManager.setAccountAttributes(signalingKey, registrationId, true, video || fetchesMessages, fetchesMessages);
}
示例2: onRun
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
@Override
public void onRun() throws IOException {
String signalingKey = TextSecurePreferences.getSignalingKey(context);
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
boolean fetchesMessages = true;
signalAccountManager.setAccountAttributes(signalingKey, registrationId, fetchesMessages);
}
示例3: handleSmsRegistrationIntent
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
private void handleSmsRegistrationIntent(Intent intent) {
markAsVerifying(true);
String number = intent.getStringExtra(NUMBER_EXTRA);
boolean supportsGcm = intent.getBooleanExtra(GCM_SUPPORTED_EXTRA, true);
int registrationId = TextSecurePreferences.getLocalRegistrationId(this);
boolean supportsVideo = TextSecurePreferences.isWebrtcCallingEnabled(this) || !supportsGcm;
if (registrationId == 0) {
registrationId = KeyHelper.generateRegistrationId(false);
TextSecurePreferences.setLocalRegistrationId(this, registrationId);
}
String password = Util.getSecret(18);
String signalingKey = Util.getSecret(52);
try {
initializeChallengeListener();
setState(new RegistrationState(RegistrationState.STATE_CONNECTING, number));
SignalServiceAccountManager accountManager = AccountManagerFactory.createManager(this, number, password);
accountManager.requestSmsVerificationCode();
setState(new RegistrationState(RegistrationState.STATE_VERIFYING, number));
String challenge = waitForChallenge();
accountManager.verifyAccountWithCode(challenge, signalingKey, registrationId, true, supportsVideo, !supportsGcm);
handleCommonRegistration(accountManager, number, password, signalingKey, supportsGcm);
markAsVerified(number, password, signalingKey);
setState(new RegistrationState(RegistrationState.STATE_COMPLETE, number));
broadcastComplete(true);
} catch (ExpectationFailedException efe) {
Log.w("RegistrationService", efe);
setState(new RegistrationState(RegistrationState.STATE_MULTI_REGISTERED, number));
broadcastComplete(false);
} catch (UnsupportedOperationException uoe) {
Log.w("RegistrationService", uoe);
setState(new RegistrationState(RegistrationState.STATE_GCM_UNSUPPORTED, number));
broadcastComplete(false);
} catch (AccountVerificationTimeoutException avte) {
Log.w("RegistrationService", avte);
setState(new RegistrationState(RegistrationState.STATE_TIMEOUT, number, password));
broadcastComplete(false);
} catch (IOException e) {
Log.w("RegistrationService", e);
setState(new RegistrationState(RegistrationState.STATE_NETWORK_ERROR, number));
broadcastComplete(false);
} finally {
shutdownChallengeListener();
}
}
示例4: getLocalRegistrationId
import org.thoughtcrime.securesms.util.TextSecurePreferences; //导入方法依赖的package包/类
@Override
public int getLocalRegistrationId() {
return TextSecurePreferences.getLocalRegistrationId(context);
}