@Kroll.setProperty
 @Kroll.method
 public void setPushId(String id) {
   if (getIsFlying()) {
     PushManager.shared().getPreferences().setPushId(id);
   }
 }
 @Kroll.setProperty
 @Kroll.method
 public void setVibrateEnabled(boolean enabled) {
   if (getIsFlying()) {
     PushManager.shared().getPreferences().setVibrateEnabled(enabled);
   }
 }
 @Kroll.setProperty
 @Kroll.method
 public void setAlias(String alias) {
   if (getIsFlying()) {
     PushManager.shared().setAlias(alias);
   }
 }
 @Kroll.getProperty
 @Kroll.method
 public String getPushId() {
   if (getIsFlying()) {
     return PushManager.shared().getPreferences().getPushId();
   }
   return null;
 }
 @Kroll.getProperty
 @Kroll.method
 public boolean getVibrateEnabled() {
   if (getIsFlying()) {
     return PushManager.shared().getPreferences().isVibrateEnabled();
   }
   return false;
 }
 @Kroll.getProperty
 @Kroll.method
 public Object[] getTags() {
   if (getIsFlying()) {
     return PushManager.shared().getTags().toArray();
   }
   return null;
 }
 @Kroll.setProperty
 @Kroll.method
 public void setTags(Object[] rawTags) {
   if (getIsFlying()) {
     HashSet<String> tags = new HashSet<String>();
     for (Object rawTag : rawTags) {
       tags.add(rawTag.toString());
     }
     PushManager.shared().setTags(tags);
   }
 }
  @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;
    }
  }
  private static void airshipTakeOff() {
    Log.i(LCAT, "Airship taking off");
    try {
      AirshipConfigOptions options =
          AirshipConfigOptions.loadDefaultOptions(TiApplication.getInstance());

      // NOTE: In-App Purchasing is not currently supported in this module
      // Remove this next statement once we implement iap
      options.iapEnabled = false;

      // Attempt takeoff
      UAirship.takeOff(TiApplication.getInstance(), options);

      // Airship has successfully taken off. Set up the notification handler
      PushManager.shared().setIntentReceiver(IntentReceiver.class);
    } catch (Exception e) {
      Log.e(LCAT, "Error occurred during takeoff!!!");
    }
  }
  @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());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.v(TAG, "onCreate()");

    this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    setContentView(R.layout.conversation);

    mContext = ConversationsActivity.this;

    mRes = this.getResources();

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

    if (mReceiver == null) {
      mReceiver = new Receiver();

      if (filter == null) {
        filter = new IntentFilter("com.anoni.PUSHER_MESSAGE_CONV");
        this.registerReceiver(mReceiver, filter);
      }
    }

    PackageManager manager = this.getPackageManager();
    PackageInfo info = null;
    try {
      info = manager.getPackageInfo(this.getPackageName(), 0);
    } catch (NameNotFoundException e) {
      e.printStackTrace();
    }
    // Custom Title Bar------------------------------------------------------------
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);
    mTextViewProgressLoading = (TextView) findViewById(R.id.tv_titlebar_loading);
    mTextViewProgress = (TextView) findViewById(R.id.tv_titlebar);
    //	mTextViewProgress.setText(getTitle()+" "+info.versionName);
    mTextViewProgress.setText(getTitle());
    titleProgressBar = (ProgressBar) findViewById(R.id.leadProgressBar);
    titleProgressBar.setProgress(0);
    // ----------------------------------------------------------------------------

    // Toast.makeText(mContext, "App is onCreate()", Toast.LENGTH_SHORT).show();

    SharedPreferences prefs = getSharedPreferences(Const.PREFS_NAME, 0);
    mId = prefs.getString(Const.PREFS_ID, "");

    Intent messageservice = new Intent(this, MessageService.class);
    messageservice.putExtra("channel", "user-");
    startService(messageservice);

    bLaunch = prefs.getBoolean(Const.FIRST_LAUNCH, false);

    // Get Screen resolution
    Utils.getScreenSize(mContext);

    Log.v(TAG, "mId " + mId);
    Log.v(TAG, TAG);

    et_search_text = (EditText) findViewById(R.id.et_search_text);
    et_search_text.setHint("search conversations");
    // 231
    et_search_text.addTextChangedListener(
        new TextWatcher() {
          private int state = 0;

          @Override
          public void afterTextChanged(Editable arg0) {
            if (et_search_text.getText().toString().length() > 0) {
              // mConver.clear();
              String str = et_search_text.getText().toString();

              mAnoni = searchEngine(str);
              adapter =
                  new ConversationsAdapter(
                      mContext,
                      ConversationsActivity.this,
                      R.layout.row_event,
                      filterHideConvs(mAnoni),
                      mProfiles);
              ConversationsActivity.this.setListAdapter(adapter);
            } else {
              if (state == 1) {
                mAnoni = new CommonQueries(mContext).queryGetAllAnoni();
                adapter =
                    new ConversationsAdapter(
                        mContext,
                        ConversationsActivity.this,
                        R.layout.row_event,
                        filterHideConvs(mAnoni),
                        mProfiles);
                ConversationsActivity.this.setListAdapter(adapter);
              }
            }

            if (adapter != null) adapter.notifyDataSetChanged();
          }

          @Override
          public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            if (arg0.length() == 0) state = 0;
            else state = 1;
          }

          @Override
          public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {}
        });

    mResume = false;

    // its not a first start
    if (bLaunch == false) {
      mAnoni = new CommonQueries(mContext).queryGetAllAnoni();
      mProfiles = new CommonQueries(mContext).queryGetAllUsersProfiles();
    }

    if (mAnoni != null)
      if (mAnoni.size() > 0) {
        Collections.sort(mAnoni, new AnoniComparator());

        adapter =
            new ConversationsAdapter(
                mContext,
                ConversationsActivity.this,
                R.layout.row_event,
                filterHideConvs(mAnoni),
                mProfiles);
        ConversationsActivity.this.setListAdapter(adapter);

        if (adapter != null) {
          adapter.notifyDataSetChanged();
        }
      }

    bQuit = false;

    /*
    if(bLaunch == false) {
          	SharedPreferences.Editor editor = prefs.edit();
          	editor.putBoolean(Const.FIRST_LAUNCH, true);
          	editor.commit();
    	new PopUpText(mContext).showPopUp();

    	requestGetConversations();



       	//task = new AsyncRequest();
    	//task.execute();
    } else {
    	task_second = new AsyncRequestSecond();
    	task_second.execute();
    }
    */
    // Correct

    if (bLaunch == true) {
      SharedPreferences.Editor editor = prefs.edit();
      editor.putBoolean(Const.FIRST_LAUNCH, false);
      editor.commit();

      Log.v(TAG, "getConvsFirstStart()");
      // getConvsFirstStart();

      task = new AsyncRequest();
      task.execute();
    } else {
      // getConvsSecondStart();

      task_second = new AsyncRequestSecond();
      task_second.execute();
    }
  }