Previously we used to rely on Firebase Console for crash reports. It was working pretty good but then Google also announced the official support for Crash reporting through Crashlytics and we went ahead with Crashlytics integration. The only problem being, we can't see the country code for a Crash anymore.
So, is there any way, we can have the country information for a Crash in Crashlytics?
Mike from Fabric here. By default, we don't capture country information for crashes. However, you can set this via a custom key.
On Android, use:
Crashlytics.setString("Country_Code", "Canada");
On iOS, use:
# Objective-C
[CrashlyticsKit setObjectValue:@"Canada" forKey:(@"Country_Code")];
# Swift
Crashlytics.sharedInstance().setObjectValue("Canada", forKey: "Country_Code")
To add on to what Mike have posted, you can get the Locale of the machine as a "guess" of the country.
It is not exactly accurate, but should suffice as an approximation of the app's distribution. (if you do not want to use the Location permission)
some thing like the following:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
logCountry();
setContentView(R.layout.activity_main);
}
private void logCountry() {
Crashlytics.setString("Locale", Locale.getDefault().toString());
}
}
you will get to see the locale/country under the "KEYS" tab in the firebase console.
Would have been a lot cleaner if that information is in the "DATA" tab, but guess we have to make do with what's provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With