• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Sentry类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.joshdholtz.sentry.Sentry的典型用法代码示例。如果您正苦于以下问题:Java Sentry类的具体用法?Java Sentry怎么用?Java Sentry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Sentry类属于com.joshdholtz.sentry包,在下文中一共展示了Sentry类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onRequestPermissionsResult

点赞 3

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@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();
            }
        }
    }
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:21,
代码来源:MainActivity.java

示例2: onCreate

点赞 3

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@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())
    );

}
 

开发者ID:joshdholtz,
项目名称:Sentry-Android,
代码行数:26,
代码来源:MainActivity.java

示例3: onClickCapture

点赞 3

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
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));
    }
}
 

开发者ID:joshdholtz,
项目名称:Sentry-Android,
代码行数:20,
代码来源:MainActivity.java

示例4: onCreate

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@Override
public void onCreate()
{
    super.onCreate();

    Sentry.init(this, BuildConfig.SENTRY_DSN);
    Sentry.captureMessage("NGM3 Sentry is init.", Sentry.SentryEventLevel.DEBUG);

    NgsAndroidJni.initLogger();
    Log.d(ConstantsUI.TAG, "NGS version: " + Api.ngsGetVersionString(null));

    updateFromOldVersion();

    initNgs();
}
 

开发者ID:nextgis,
项目名称:android_nextgis_mobile,
代码行数:16,
代码来源:MainApplication.java

示例5: asset_dialog

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
private void asset_dialog(@RawRes int htmlRes, @StringRes int title) {
    final View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_about, null, false);
    final AlertDialog dialog = new AlertDialog.Builder(getActivity())
            .setTitle(title)
            .setView(view)
            .setPositiveButton(R.string.dismiss, null)
            .create();

    TextView textView = (TextView) view.findViewById(R.id.aboutText);

    String text = "";

    StringBuilder builder = new StringBuilder();
    InputStream fis;
    try {
        fis = getResources().openRawResource(htmlRes);
        BufferedReader reader = new BufferedReader(new InputStreamReader(fis, "utf-8"));
        String line;
        while ((line = reader.readLine()) != null) {
            builder.append(line);
        }

        text = builder.toString();
        fis.close();
    } catch (IOException e) {
        Sentry.captureException(e);
        e.printStackTrace();
    }

    textView.setText(Html.fromHtml(text));
    textView.setMovementMethod(LinkMovementMethod.getInstance());

    dialog.show();
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:35,
代码来源:SettingsFragment.java

示例6: handleConfigScanned

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
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)));
        } 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)));

            triggerSync();
        }
    } catch (JSONException e) {
        displayScanResult(new TicketCheckProvider.CheckResult(
                TicketCheckProvider.CheckResult.Type.ERROR,
                getString(R.string.err_qr_invalid)));
    }
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:30,
代码来源:MainActivity.java

示例7: handleTicketScanned

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
private void handleTicketScanned(String s) {
    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);
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:9,
代码来源:MainActivity.java

示例8: onCreate

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@Override
public void onCreate() {
    Sentry.init(this, BuildConfig.SENTRY_DSN);
    Sentry.captureMessage("NGM2 Sentry is init.", Sentry.SentryEventLevel.DEBUG);

    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    updateFromOldVersion();

    GoogleAnalytics.getInstance(this).setAppOptOut(!mSharedPreferences.getBoolean(KEY_PREF_GA, true));
    GoogleAnalytics.getInstance(this).setDryRun(DEBUG_MODE);
    getTracker();
    setExceptionHandler();

    super.onCreate();
}
 

开发者ID:nextgis,
项目名称:android_gisapp,
代码行数:16,
代码来源:MainApplication.java

示例9: onCreate

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@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);
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:51,
代码来源:MainActivity.java

示例10: addHttpBreadcrumb

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@Override
public void addHttpBreadcrumb(String url, String method, int statusCode) {
    Sentry.addHttpBreadcrumb(url, method, statusCode);
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:5,
代码来源:AndroidSentryImplementation.java

示例11: addBreadcrumb

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@Override
public void addBreadcrumb(String a, String b) {
    Sentry.addBreadcrumb(a, b);
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:5,
代码来源:AndroidSentryImplementation.java

示例12: captureException

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
@Override
public void captureException(Throwable t) {
    Sentry.captureException(t);
}
 

开发者ID:pretix,
项目名称:pretixdroid,
代码行数:5,
代码来源:AndroidSentryImplementation.java

示例13: onClickBreak

点赞 2

import com.joshdholtz.sentry.Sentry; //导入依赖的package包/类
public void onClickBreak(View view) {
    Sentry.addBreadcrumb("button.click", "break button");
    crash();

}
 

开发者ID:joshdholtz,
项目名称:Sentry-Android,
代码行数:6,
代码来源:MainActivity.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)