com.crashlytics.android.answers.Answers.getInstance()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中com.crashlytics.android.answers.Answers.getInstance()方法的一些代码示例,展示了Answers.getInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Answers.getInstance()方法的具体详情如下:
包路径:com.crashlytics.android.answers.Answers
类名称:Answers
方法名:getInstance

Answers.getInstance介绍

暂无

代码示例

代码示例来源:origin: jakehilborn/speedr

public void versionOnClick(View view) {
  new AlertDialog.Builder(this)
      .setTitle(R.string.changelog_dialog_title)
      .setMessage(R.string.changelog_content)
      .setCancelable(true)
      .setNegativeButton(R.string.close_dialog_button, null)
      .show();
  Answers.getInstance().logCustom(new CustomEvent("Viewed changelog"));
}

代码示例来源:origin: jakehilborn/speedr

private void missingOpenStreetMapLimitOnClick() {
  new AlertDialog.Builder(this)
      .setTitle(R.string.missing_open_street_map_limit_dialog_title)
      .setMessage(R.string.missing_open_street_map_limit_dialog_content)
      .setCancelable(true)
      .setPositiveButton(R.string.settings_dialog_button, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int id) {
          startActivity(new Intent(MainActivity.this, SettingsActivity.class));
        }
      })
      .show();
  Answers.getInstance().logCustom(new CustomEvent("Viewed missing OpenStreetMaps limit"));
}

代码示例来源:origin: jakehilborn/speedr

public void onClick(final DialogInterface dialog, final int id) {
    launchWebpage("https://www.linkedin.com/in/jakehilborn");
    Answers.getInstance().logCustom(new CustomEvent("Launched LinkedIn"));
  }
})

代码示例来源:origin: GrossumUA/TAS_Android_Boilerplate

public void logEvent(AnalyticsEvent event) {
    Answers.getInstance().logCustom(new CustomEvent(event.label));
  }
}

代码示例来源:origin: jakehilborn/speedr

private void devInfoOnClick() {
  new AlertDialog.Builder(this)
      .setTitle(R.string.developed_by_jake_hilborn_dialog_title)
      .setCancelable(true)
      .setNeutralButton(R.string.github_link_text, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int id) {
          launchWebpage("https://github.com/jakehilborn/speedr");
          Answers.getInstance().logCustom(new CustomEvent("Launched GitHub"));
        }
      })
      .setNegativeButton(R.string.linkedin_link_text, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int id) {
          launchWebpage("https://www.linkedin.com/in/jakehilborn");
          Answers.getInstance().logCustom(new CustomEvent("Launched LinkedIn"));
        }
      })
      .setPositiveButton(R.string.email_link_text, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int id) {
          Intent intent = new Intent(Intent.ACTION_SENDTO);
          intent.setData(Uri.parse("mailto: jakehilborn@gmail.com"));
          startActivity(Intent.createChooser(intent, getString(R.string.email_speedr_developer_chooser_text)));
        }
      })
      .show();
  Answers.getInstance().logCustom(new CustomEvent("Viewed developer info"));
}

代码示例来源:origin: mooshim/Mooshimeter-AndroidApp

public static void logNullMeterEvent(String addr) {
  // For unknown reasons, getDeviceWithAddress sometimes returns null
  // This should be impossible.  But to prevent it crashing the app
  Answers.getInstance().logCustom(new CustomEvent("ReceivedNullMeter")
                  .putCustomAttribute("StackTrace", Log.getStackTraceString(new Exception()))
                  .putCustomAttribute("MeterAddress", addr));
}

代码示例来源:origin: jakehilborn/speedr

public void privacyAndTermsOnClick(View view) {
  Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "privacyAndTermsOnClick()");
  String content = getString(R.string.privacy_policy_content);
  String localizedTerms = getString(R.string.speedr_terms_content);
  String englishTerms = "Speedr is for informational purposes only. Its function is to quantify how much time, or how little time, one saves when speeding in their car to help the user decide if speeding is worth the safety, monetary, and legal risks. Speeding is illegal and dangerous. By accepting these terms you absolve the Speedr developers, speed limit providers, and all other parties of any responsibility for accidents, legal consequences, and any and all other outcomes. The data presented by Speedr is not guaranteed to be accurate. Outdated/incorrect speed limit data and inaccurate GPS sensors may produce faulty data. Pay attention to the posted speed limits of roads as Speedr may not present accurate speed limits and pay attention to your vehicle's speedometer as Speedr may not present accurate current speed readings.";
  //These terms are important. Always show original in addition to localized terms since we can't rely on translators to correctly word this.
  if (!localizedTerms.equals(englishTerms)) {
    content += "<br><br>" + localizedTerms + "<br><br>" + englishTerms;
  } else {
    content += "<br><br>" + englishTerms;
  }
  ((TextView) new AlertDialog.Builder(this)
      .setTitle(R.string.privacy_policy_title)
      .setMessage(Html.fromHtml(content))
      .setCancelable(true)
      .setNegativeButton(R.string.close_dialog_button, null)
      .show()
      .findViewById(android.R.id.message)) //These 2 lines make the hyperlinks clickable
      .setMovementMethod(LinkMovementMethod.getInstance());
  Answers.getInstance().logCustom(new CustomEvent("Viewed privacy policy"));
}

代码示例来源:origin: jakehilborn/speedr

public void onClick(final DialogInterface dialog, final int id) {
    Prefs.setUpdateAcknowledged(MainActivity.this, true);
    Answers.getInstance().logCustom(new CustomEvent("MainActivity update later"));
  }
})

代码示例来源:origin: jakehilborn/speedr

public void onClick(final DialogInterface dialog, final int id) {
    Prefs.setUpdateAcknowledged(MainActivity.this, true);
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://jakehilborn.github.io/speedr")));
    Answers.getInstance().logCustom(new CustomEvent("MainActivity update download"));
  }
})

代码示例来源:origin: jakehilborn/speedr

public void openStreetMapDonateOnClick(View view) {
  launchWebpage("https://donate.openstreetmap.org");
  Answers.getInstance().logCustom(new CustomEvent("Launched OpenStreetMap donate"));
}

代码示例来源:origin: jakehilborn/speedr

public void keepScreenOnClick(View view) {
  Answers.getInstance().logCustom(new CustomEvent(keepScreenOnSwitch.isChecked() ? "Keep screen on enabled" : "Keep screen on enabled"));
}

代码示例来源:origin: jakehilborn/speedr

private void showUpdateDialog() {
  //Only show dialog for side-loaded installs. If a store installed the app installer package name will be non-null.
  if (this.getPackageManager().getInstallerPackageName(this.getPackageName()) != null) {
    Answers.getInstance().logCustom(new CustomEvent("Installed via: " + this.getPackageManager().getInstallerPackageName(this.getPackageName())));
    return;
  }
  new AlertDialog.Builder(this)
      .setTitle(R.string.new_update_available)
      .setMessage(R.string.update_available_content_main_activity)
      .setCancelable(true)
      .setPositiveButton(R.string.download_button_text, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int id) {
          Prefs.setUpdateAcknowledged(MainActivity.this, true);
          startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://jakehilborn.github.io/speedr")));
          Answers.getInstance().logCustom(new CustomEvent("MainActivity update download"));
        }
      })
      .setNegativeButton(R.string.later_button_text, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int id) {
          Prefs.setUpdateAcknowledged(MainActivity.this, true);
          Answers.getInstance().logCustom(new CustomEvent("MainActivity update later"));
        }
      })
      .show();
}

代码示例来源:origin: jakehilborn/speedr

private boolean checkPlayServicesPrereq() {
  GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
  int result = googleAPI.isGooglePlayServicesAvailable(this);
  if (result != ConnectionResult.SUCCESS) {
    if (googleAPI.isUserResolvableError(result)) {
      googleAPI.getErrorDialog(this, result, 0).show();
      Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices update required");
      Answers.getInstance().logCustom(new CustomEvent("PlayServices update required"));
    } else {
      playServicesErrorToast.show();
      Crashlytics.log(Log.ERROR, MainActivity.class.getSimpleName(), "PlayServices incompatible");
      Answers.getInstance().logCustom(new CustomEvent("PlayServices incompatible"));
    }
    return false;
  }
  Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices compatible");
  return true;
}

代码示例来源:origin: jakehilborn/speedr

public void updateAvailableOnClick(View view) {
  Prefs.setUpdateAcknowledged(this, true);
  launchWebpage("https://jakehilborn.github.io/speedr");
  Answers.getInstance().logCustom(new CustomEvent("Settings update download"));
}

代码示例来源:origin: sregg/spotify-tv

@Override
public void onCreate(Bundle savedInstanceState) {
  Log.d(TAG, "onCreate");
  super.onCreate(savedInstanceState);
  Intent intent = getActivity().getIntent();
  mPlaylistId = intent.getStringExtra(PlaylistActivity.ARG_PLAYLIST_ID);
  mUserId = intent.getStringExtra(PlaylistActivity.ARG_USER_ID);
  loadPlaylist();
  Answers.getInstance().logContentView(new ContentViewEvent()
      .putContentName(Constants.ANSWERS_CONTENT_NAME)
      .putContentType(Constants.ANSWERS_CONTENT_TYPE)
      .putContentId(mPlaylistId));
}

代码示例来源:origin: jakehilborn/speedr

private void startMainService() {
  Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService start chain");
  if (checkPlayServicesPrereq() && hasAcceptedTerms() && requestLocationPermission() && checkGPSPrereq() && checkNetworkPrereq()) {
    styleStartStopButton(true);
    reset.setVisibility(View.INVISIBLE);
    startService(new Intent(this, MainService.class));
    bindService(new Intent(this, MainService.class), mainServiceConn, BIND_AUTO_CREATE);
    driveTimeHandler.postDelayed(driveTimeRunnable, DRIVE_TIME_REFRESH_FREQ);
    Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService started");
    Answers.getInstance().logCustom(new CustomEvent(useHereMaps ? "Using HERE" : "Using Overpass"));
    Answers.getInstance().logCustom(new CustomEvent(Prefs.isUseKph(this) ? "Using kph" : "Using mph"));
  } else {
    Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService not started");
  }
}

代码示例来源:origin: NightscoutFoundation/xDrip

public static void sendFirmwareReport() {
  try {
    if (JoH.ratelimit("firmware-capture-report", 50000)) {
      Log.d(TAG, "SEND Firmware EVENT START");
      if (Pref.getBooleanDefaultFalse("enable_crashlytics") && Pref.getBooleanDefaultFalse("enable_telemetry")) {
        if (DexCollectionType.getDexCollectionType() == DexcomG5) {
          final String version = Ob1G5StateMachine.getRawFirmwareVersionString(getTransmitterID());
          if (version.length() > 0) {
            Answers.getInstance().logCustom(new CustomEvent("GFirmware")
                .putCustomAttribute("Firmware", version));
          }
        }
      }
    }
  } catch (Exception e) {
    Log.e(TAG, "Got exception sending Firmware Report");
  }
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

@Override
  protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);
    MainActivity activity = mRefActivity.get();
    if (activity == null) return;
    /*
     * If root or busybox/toybox are not available,
     * launch text activity which let the user know
     * what the problem is.
     */
    if (!mHasRoot || !mHasBusybox) {
      Intent intent = new Intent(activity, TextActivity.class);
      intent.putExtra(TextActivity.MESSAGE_INTENT, activity.getString(mHasRoot ?
          R.string.no_busybox : R.string.no_root));
      intent.putExtra(TextActivity.SUMMARY_INTENT,
          mHasRoot ? "https://play.google.com/store/apps/details?id=stericson.busybox" :
              "https://www.google.com/search?site=&source=hp&q=root+"
                  + Device.getVendor() + "+" + Device.getModel());
      activity.startActivity(intent);
      activity.finish();
      if (!BuildConfig.DEBUG) {
        // Send problem to analytics to collect stats
        Answers.getInstance().logCustom(new CustomEvent("Can't access")
            .putCustomAttribute("no_found", mHasRoot ? "no busybox" : "no root"));
      }
      return;
    }
    activity.launch();
  }
}

代码示例来源:origin: sregg/spotify-tv

@Override
public void onCreate(Bundle savedInstanceState) {
  Log.d(TAG, "onCreate");
  super.onCreate(savedInstanceState);
  Intent intent = getActivity().getIntent();
  mAlbumId = intent.getStringExtra(AlbumActivity.ARG_ALBUM_ID);
  loadAlbum();
  Answers.getInstance().logContentView(new ContentViewEvent()
      .putContentName(Constants.ANSWERS_CONTENT_ALBUM)
      .putContentType(Constants.ANSWERS_CONTENT_TYPE)
      .putContentId(mAlbumId));
}

代码示例来源:origin: jamorham/xDrip-plus

public static void sendFirmwareReport() {
  try {
    if (JoH.ratelimit("firmware-capture-report", 50000)) {
      Log.d(TAG, "SEND Firmware EVENT START");
      if (Pref.getBooleanDefaultFalse("enable_crashlytics") && Pref.getBooleanDefaultFalse("enable_telemetry")) {
        if (DexCollectionType.getDexCollectionType() == DexcomG5) {
          final String version = Ob1G5StateMachine.getRawFirmwareVersionString(getTransmitterID());
          if (version.length() > 0) {
            Answers.getInstance().logCustom(new CustomEvent("GFirmware")
                .putCustomAttribute("Firmware", version));
          }
        }
      }
    }
  } catch (Exception e) {
    Log.e(TAG, "Got exception sending Firmware Report");
  }
}

相关文章