本文整理汇总了Java中com.crashlytics.android.Crashlytics.log方法的典型用法代码示例。如果您正苦于以下问题:Java Crashlytics.log方法的具体用法?Java Crashlytics.log怎么用?Java Crashlytics.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.crashlytics.android.Crashlytics
的用法示例。
在下文中一共展示了Crashlytics.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DatabaseHandler
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
private DatabaseHandler(Context context, String databaseName) throws SQLException {
String base = QuranFileUtils.getQuranDatabaseDirectory(context);
if (base == null) return;
String path = base + File.separator + databaseName;
Crashlytics.log("opening database file: " + path);
try {
database = SQLiteDatabase.openDatabase(path, null,
SQLiteDatabase.NO_LOCALIZED_COLLATORS, new DefaultDatabaseErrorHandler());
} catch (SQLiteDatabaseCorruptException sce) {
Crashlytics.log("corrupt database: " + databaseName);
throw sce;
} catch (SQLException se){
Crashlytics.log("database file " + path +
(new File(path).exists()? " exists" : " doesn't exist"));
throw se;
}
schemaVersion = getSchemaVersion();
matchString = "<font color=\"" +
ContextCompat.getColor(context, R.color.translation_highlight) +
"\">";
}
示例2: logExceptionToFabric
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
public static void logExceptionToFabric(Throwable ex, String tag) {
if (ex == null) {
return;
}
try {
ex.printStackTrace();
} catch (StackOverflowError ignored) {
Crashlytics.log("StackOverflowError in Logger " + ignored);
return;
}
if (Fabric.isInitialized() && !TextUtils.isEmpty(ex.getMessage())) {
Crashlytics.logException(ex);
}
}
示例3: showHereMapsTerms
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
private void showHereMapsTerms() {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "showHereMapsTerms()");
WebView webView = new WebView(this);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(getString(R.string.here_maps_terms_url));
new AlertDialog.Builder(this)
.setView(webView)
.setCancelable(true)
.setPositiveButton(R.string.accept_terms_button_text, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int id) {
Prefs.setHereMapsTermsAccepted(SettingsActivity.this, true);
limitProviderSelectorHandler(true); //Set limit provider now that terms have been accepted
Answers.getInstance().logCustom(new CustomEvent("Enabled HERE"));
}})
.setNegativeButton(R.string.reject_terms_button_text, null)
.show();
}
示例4: getKeyPair
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
@NotNull
private KeyPair getKeyPair() {
if (keyPair == null) {
final Context context = assetSenderView.getContext();
try {
keyPair = KeyPair.getKeyPair(context);
} catch (NoSuchPaddingException | UnrecoverableKeyException | NoSuchAlgorithmException
| KeyStoreException | InvalidKeyException | IOException e) {
Log.e(TAG, "getKeyPair: ", e);
Crashlytics.log(Log.ERROR, AssetSenderPresenter.TAG, e.getMessage());
assetSenderView.showError(ErrorMessageFactory.create(context, e));
return new KeyPair("", "");
}
}
return keyPair;
}
示例5: privacyAndTermsOnClick
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
public void privacyAndTermsOnClick(View view) {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "privacyAndTermsOnClick()");
String content = getString(R.string.privacy_policy_content).replace("HERE_TERMS_PLACEHOLDER", getString(R.string.here_maps_terms_url));
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 innaccurate 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 vehicles' 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"));
}
示例6: onOptionsItemSelected
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.dev_info_appbar_button:
devInfoOnClick();
return true;
case android.R.id.home:
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "AppBar Home pressed");
if (newHereCredentials()) {
return true;
} else {
return super.onOptionsItemSelected(item);
}
default:
return super.onOptionsItemSelected(item);
}
}
示例7: registerFailure
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
private void registerFailure(Throwable throwable) {
accountRegisterView.hideProgress();
KeyPair.delete(accountRegisterView.getContext());
Context c = accountRegisterView.getContext();
if (NetworkUtil.isOnline(c)) {
Crashlytics.log(Log.ERROR, AccountRegisterPresenter.TAG, throwable.getMessage());
accountRegisterView.showError(ErrorMessageFactory.create(c, throwable));
} else {
accountRegisterView.showError(ErrorMessageFactory.create(c, new NetworkNotConnectedException()));
}
}
示例8: onReceivedError
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
Crashlytics.log(5, "KolibriWebView",
"onReceivedError() called with: request = [" + request + "], error = [" + error + "]");
// We ignore errors regarding assets loading,
// so in this case we check if the request url and webview url are same
if (request.getUrl().toString().equals(view.getUrl()) || request.isForMainFrame()) {
for (KolibriWebViewClient webClient : webClients) {
webClient.onReceivedError(view, request, error);
}
}
}
示例9: requestLocationPermission
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
private boolean requestLocationPermission() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION);
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "Request location permission");
return false; //Short circuit startMainService() call, it will be recalled onRequestPermissionsResult()
}
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "Location permission granted");
return true;
}
示例10: openStreetMapCoverageOnClick
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
public void openStreetMapCoverageOnClick(View view) {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "openStreetMapCoverageOnClick()");
final String mapOfUnitedStates = "http://product.itoworld.com/map/124?lat=37.77557&lon=-100.44588&zoom=4";
if (ContextCompat.checkSelfPermission(SettingsActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
googleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
@SuppressWarnings("MissingPermission")
public void onConnected(Bundle bundle) {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "Coverage map with location");
String uri;
Location lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
if (lastLocation != null) {
uri = "http://product.itoworld.com/map/124?lat=" + lastLocation.getLatitude() + "&lon=" + lastLocation.getLongitude() + "&zoom=14";
} else {
uri = mapOfUnitedStates;
}
launchWebpage(uri);
googleApiClient.disconnect();
}
@Override
public void onConnectionSuspended(int i) {}
})
.addApi(LocationServices.API)
.build();
googleApiClient.connect();
} else {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "Coverage map without location");
launchWebpage(mapOfUnitedStates);
}
Answers.getInstance().logCustom(new CustomEvent("Launched OpenStreetMap coverage"));
}
示例11: destroy
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
public void destroy(Context context) {
Crashlytics.log(Log.INFO, LimitFetcher.class.getSimpleName(), "destroy()");
if (overpassSubscription != null) overpassSubscription.unsubscribe();
if (hereMapsSubscription != null) hereMapsSubscription.unsubscribe();
if (hereMapsError != null) hereMapsError.cancel();
Prefs.setPendingHereActivation(context, false); //Set to false so the next time MainService is started the pending activation notice does not show
}
示例12: log
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
@Override
protected void log(int priority, String tag, String message, Throwable t) {
Crashlytics.log(priority, message, tag);
if (t != null) {
Crashlytics.logException(t);
}
// If this is an error or a warning, log it as a exception so we see it in Crashlytics.
if (priority >= Log.ERROR) {
Crashlytics.logException(new Throwable(message));
}
}
示例13: stopMainService
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
private void stopMainService() {
if (mainService != null) {
mainService.stopTime = System.nanoTime();
mainService.setCallback(null);
}
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "Stopping MainService");
styleStartStopButton(false);
finalizeSessionInUI();
unbindService(mainServiceConn);
stopService(new Intent(this, MainService.class));
mainService = null;
driveTimeHandler.removeCallbacks(driveTimeRunnable);
showHereSuggestion();
}
示例14: onStart
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
@Override
protected void onStart() {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "onStart()");
String versionString = getString(R.string.version_text) + " " + BuildConfig.VERSION_NAME;
version.setText(versionString);
if (BuildConfig.VERSION_CODE < Prefs.getLatestVersion(this)) {
findViewById(R.id.update_available_section).setVisibility(View.VISIBLE);
findViewById(R.id.update_available).setVisibility(View.VISIBLE);
}
super.onStart();
}
示例15: launchWebpage
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
private void launchWebpage(String uri) {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "launchWebpage()");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
}