コード例 #1
0
 @Kroll.setProperty
 @Kroll.method
 public void setPushEnabled(boolean enabled) {
   if (getIsFlying()) {
     if (enabled) PushManager.enablePush();
     else PushManager.disablePush();
   }
 }
コード例 #2
0
  @Override
  public void onCreate() {
    super.onCreate();
    appInstance = this;
    mRequestQueue = Volley.newRequestQueue(this);

    setupLiveLabsApi();
    FacebookSdk.sdkInitialize(getApplicationContext());
    DataHelper.init(getApplicationContext());

    AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
    options.inProduction = !BuildConfig.DEBUG;
    UAirship.takeOff(this, options);
    PushManager.enablePush();
    PushManager.shared().setIntentReceiver(IntentReceiver.class);
    PushPreferences prefs = PushManager.shared().getPreferences();
    Log.i("TAG", " testing My Application onCreate - App APID: " + prefs.getPushId());

    Logger.info("My Application onCreate - App APID: " + prefs.getPushId());
    Log.d(" testing", " testing My Application onCreate - App APID: " + prefs.getPushId());

    myridTypeFace = Typeface.createFromAsset(getAssets(), "MyriadPro-Semibold.otf");

    ImageCacheParams cacheParams = new ImageCacheParams(IMAGE_CACHE_DIR);

    // PhucVM: we need to cast this to LONG because the value can be greater than int maximum => it
    // will be less than 0 if we use int
    long tempMemory =
        1024 * 1024 * (long) (ImageLoaderUtils.getMemoryClass(this.getApplicationContext())) * 8;
    cacheParams.memCacheSize = (int) (tempMemory / 19);

    mImageCache = new ImageCache(this, cacheParams);
    mImageFetcher = new ImageFetcher(this);
    mImageFetcher.setImageCache(mImageCache);
    try {
      application_version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
      application_version = UNDEFINED_VERSION;
    }
  }
コード例 #3
0
  @Override
  public void onCreate() {
    // Load options
    AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);

    // Set options to enable push notifications
    options.transport = "helium";
    options.developmentAppKey = "_7UGKHwnQ2eKFLNNy_pgxw";
    options.developmentAppSecret = "C5n_fo9fQXixZWPVCGJqRg";
    options.productionAppKey = "5wioYYXrS3eykPlh-dxwPg";
    options.productionAppSecret = "C2czYq-wQIqUpQKuQF8i-A";
    options.inProduction = true;

    // Up up and away
    UAirship.takeOff(this, options);

    // Enable push
    PushManager.enablePush();

    // Get APID
    PushPreferences prefs = PushManager.shared().getPreferences();
    Logger.info("My Application onCreate - App APID: " + prefs.getPushId());
  }