@Override
  public void onReceive(Context context, Intent intent) {
    MwmApplication.get().initCounters();
    // parse & send referrer to Aloha
    try {
      if (intent.hasExtra("referrer")) {
        final String referrer = intent.getStringExtra("referrer");
        final String referrerSplitted[] = referrer.split("&");
        if (referrerSplitted.length != 0) {
          final String[] parsedValues = new String[referrerSplitted.length * 2];
          int i = 0;
          for (String referrerValue : referrerSplitted) {
            String keyValue[] = referrerValue.split("=");
            parsedValues[i++] = keyValue[0];
            parsedValues[i++] = keyValue.length == 2 ? keyValue[1] : "";
          }

          org.alohalytics.Statistics.logEvent(AlohaHelper.GPLAY_INSTALL_REFERRER, parsedValues);
        } else org.alohalytics.Statistics.logEvent(AlohaHelper.GPLAY_INSTALL_REFERRER, referrer);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    intent.setComponent(null);
    // now send intent to myTracker
    CampaignReceiver receiver = new CampaignReceiver();
    receiver.onReceive(context, intent);
  }
Example #2
0
  private void showDisclaimer(final MapObject startPoint, final MapObject endPoint) {
    StringBuilder builder = new StringBuilder();
    for (int resId :
        new int[] {
          R.string.dialog_routing_disclaimer_priority, R.string.dialog_routing_disclaimer_precision,
          R.string.dialog_routing_disclaimer_recommendations,
              R.string.dialog_routing_disclaimer_borders,
          R.string.dialog_routing_disclaimer_beware
        }) builder.append(MwmApplication.get().getString(resId)).append("\n\n");

    new AlertDialog.Builder(mContainer.getActivity())
        .setTitle(R.string.dialog_routing_disclaimer_title)
        .setMessage(builder.toString())
        .setCancelable(false)
        .setNegativeButton(R.string.cancel, null)
        .setPositiveButton(
            R.string.ok,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dlg, int which) {
                Config.acceptRoutingDisclaimer();
                prepare(startPoint, endPoint);
              }
            })
        .show();
  }