Exemplo n.º 1
0
  @Override
  public void onCreate() {
    mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mLBM = LocalBroadcastManager.getInstance(this);

    mLogger.info("WalletService created");

    mApp = (WalletApplication) getApplicationContext();

    mContext = getApplicationContext();
    mRes = mContext.getResources();

    mTimeoutWorker = Executors.newSingleThreadScheduledExecutor();

    final String lockName = getPackageName() + " blockchain sync";
    final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, lockName);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    String fiatRateSource = mPrefs.getString(SettingsActivity.KEY_FIAT_RATE_SOURCE, "");
    setFiatRateSource(fiatRateSource);

    // Register for future preference changes.
    mPrefs.registerOnSharedPreferenceChangeListener(this);

    // Register with the WalletApplication.
    mApp.setWalletService(this);
  }
Exemplo n.º 2
0
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   if (key.equals(SettingsActivity.KEY_FIAT_RATE_SOURCE)) {
     String fiatRateSource = mPrefs.getString(SettingsActivity.KEY_FIAT_RATE_SOURCE, "");
     setFiatRateSource(fiatRateSource);
   }
 }