Java Code Examples for com.joshdholtz.sentry.Sentry#addBreadcrumb()
The following examples show how to use
com.joshdholtz.sentry.Sentry#addBreadcrumb() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From Sentry-Android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String yourDSN = "your-dsn"; Sentry.init(this, yourDSN); Sentry.debug = true; Sentry.setMaxBreadcrumbs(8); for (int i=0; i<15; i++) { Sentry.addBreadcrumb("Limit Test", Integer.toString(i)); } Sentry.captureMessage("8 breadcrumbs test."); Sentry.addNavigationBreadcrumb("activity.main", "here", "there"); Sentry.addHttpBreadcrumb("http://example.com", "GET", 202); Sentry.captureEvent(new Sentry.SentryEventBuilder() .setMessage("This event has a message and a stacktrace.") .setStackTrace(Thread.currentThread().getStackTrace()) ); }
Example 2
Source File: MainActivity.java From Sentry-Android with MIT License | 6 votes |
public void onClickCapture(View view) { Sentry.addBreadcrumb("button.click", "capture button"); try { crash(); } catch (Exception e) { Map<String, String> tags = new HashMap<>(); tags.put("color", "yellow"); tags.put("shape", "square"); Sentry.captureEvent(new Sentry.SentryEventBuilder() .setException(e) .setMessage("Exception caught in click handler") .setServerName("https://badssl.com/") .setCulprit("https://untrusted-root.badssl.com/") .setLevel(Sentry.SentryEventLevel.WARNING) .setLogger("A logger") .setRelease("f035a895a5167ebd20a597d47761e033995e6689") .setTags(tags)); } }
Example 3
Source File: MainActivity.java From pretixdroid with GNU General Public License v3.0 | 5 votes |
@Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case PERMISSIONS_REQUEST_CAMERA: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Sentry.addBreadcrumb("main.startup", "Permission granted"); if (config.getCamera()) { qrView.startCamera(); } } else { Sentry.addBreadcrumb("main.startup", "Permission request denied"); Toast.makeText(this, R.string.permission_required, Toast.LENGTH_LONG).show(); finish(); } } case PERMISSIONS_REQUEST_WRITE_STORAGE: { try { dataWedgeHelper.install(); } catch (IOException e) { e.printStackTrace(); } } } }
Example 4
Source File: MainActivity.java From pretixdroid with GNU General Public License v3.0 | 5 votes |
private void handleConfigScanned(String s) { Sentry.addBreadcrumb("main.scanned", "Config scanned"); try { JSONObject jsonObject = new JSONObject(s); if (jsonObject.getInt("version") > PretixApi.SUPPORTED_API_VERSION) { displayScanResult(new TicketCheckProvider.CheckResult( TicketCheckProvider.CheckResult.Type.ERROR, getString(R.string.err_qr_version)), null, false); } else { if (jsonObject.getInt("version") < 3) { config.setAsyncModeEnabled(false); } config.setEventConfig(jsonObject.getString("url"), jsonObject.getString("key"), jsonObject.getInt("version"), jsonObject.optBoolean("show_info", true), jsonObject.optBoolean("allow_search", true)); checkProvider = ((PretixDroid) getApplication()).getNewCheckProvider(); displayScanResult(new TicketCheckProvider.CheckResult( TicketCheckProvider.CheckResult.Type.VALID, getString(R.string.config_done)), null, false); triggerSync(); } } catch (JSONException e) { displayScanResult(new TicketCheckProvider.CheckResult( TicketCheckProvider.CheckResult.Type.ERROR, getString(R.string.err_qr_invalid)), null, false); } }
Example 5
Source File: MainActivity.java From pretixdroid with GNU General Public License v3.0 | 5 votes |
private void handleTicketScanned(String s, List<TicketCheckProvider.Answer> answers, boolean ignore_unpaid) { Sentry.addBreadcrumb("main.scanned", "Ticket scanned"); state = State.LOADING; findViewById(R.id.tvScanResult).setVisibility(View.GONE); findViewById(R.id.pbScan).setVisibility(View.VISIBLE); new CheckTask().execute(s, answers, ignore_unpaid); }
Example 6
Source File: MainActivity.java From pretixdroid with GNU General Public License v3.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); if (BuildConfig.SENTRY_DSN != null) { Sentry.init(this, BuildConfig.SENTRY_DSN); } checkProvider = ((PretixDroid) getApplication()).getNewCheckProvider(); config = new AppConfig(this); setContentView(R.layout.activity_main); qrView = (CustomizedScannerView) findViewById(R.id.qrdecoderview); qrView.setResultHandler(this); qrView.setAutoFocus(config.getAutofocus()); qrView.setFlash(config.getFlashlight()); if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { Sentry.addBreadcrumb("main.startup", "Permission request started"); ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, PERMISSIONS_REQUEST_CAMERA); } List<BarcodeFormat> formats = new ArrayList<>(); formats.add(BarcodeFormat.QR_CODE); qrView.setFormats(formats); setVolumeControlStream(AudioManager.STREAM_MUSIC); mediaPlayer = buildMediaPlayer(this); timeoutHandler = new Handler(); blinkHandler = new Handler(); findViewById(R.id.rlSyncStatus).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showSyncStatusDetails(); } }); resetView(); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_logo); dataWedgeHelper = new DataWedgeHelper(this); if (dataWedgeHelper.isInstalled()) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_STORAGE); } else { try { dataWedgeHelper.install(); } catch (IOException e) { e.printStackTrace(); } } } }
Example 7
Source File: AndroidSentryImplementation.java From pretixdroid with GNU General Public License v3.0 | 4 votes |
@Override public void addBreadcrumb(String a, String b) { Sentry.addBreadcrumb(a, b); }
Example 8
Source File: MainActivity.java From Sentry-Android with MIT License | 4 votes |
public void onClickBreak(View view) { Sentry.addBreadcrumb("button.click", "break button"); crash(); }