當前位置: 首頁>>代碼示例>>Java>>正文


Java TextSecurePreferences.getLocalRegistrationId方法代碼示例

本文整理匯總了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);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:10,代碼來源:RefreshAttributesJob.java

示例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);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:9,代碼來源:RefreshAttributesJob.java

示例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();
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:53,代碼來源:RegistrationService.java

示例4: getLocalRegistrationId

import org.thoughtcrime.securesms.util.TextSecurePreferences; //導入方法依賴的package包/類
@Override
public int getLocalRegistrationId() {
  return TextSecurePreferences.getLocalRegistrationId(context);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:5,代碼來源:TextSecureIdentityKeyStore.java


注:本文中的org.thoughtcrime.securesms.util.TextSecurePreferences.getLocalRegistrationId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。