Closed SwiftyWang closed 8 years ago
You can register an event capture listener to do this:
// CALL THIS BEFORE CALLING Sentry.init
// Sets a listener to intercept the SentryEventBuilder before
// each capture to set values that could change state
Sentry.setCaptureListener(new SentryEventCaptureListener() {
@Override
public SentryEventBuilder beforeCapture(SentryEventBuilder builder) {
// Needs permission - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
// Sets extra key if wifi is connected
try {
builder.getExtra().put("wifi", String.valueOf(mWifi.isConnected()));
builder.getTags().put("tag_1", "value_1");
} catch (JSONException e) {}
return builder;
}
});
Very helpful!! Thank you very much!!!
@marcomorain Thanks for answering this for me! 😊 You da 💣
💥
I have found the tag in capture Exception. But I cannot find this feature in unhandler exception sending. Can I add tags when app crash(unhandler Exception) use your library?