Android Crashlytics – restrict network access

  • A+

I've been working for a while around a lack of ability to restrict Crashlytics network usage under certain conditions. For example - on roaming , on metered networks and so on..

According to SDK documentation , only two options I found addressing somehow this:

  • "Opt Out" on runtime by simply not initialize Crashlytics

  • built in User consent dialog before sending crash report

This API's are very limited, because:

  • Not initialize Crashlytics not only prevents network access, but also prevents any chance Crashlytics will save locally the crash report, so that eventually the event will be sent. Not to mention there is no good way to opt out in runtime, besides overriding brutally the Thread.setUncaughtExceptionHandler

  • consent dialog not making any sense to user if crash happens in background.

My question basically: Am I missing something? Is there any way to restrict Crashlytics network access?

My motivation comes from a need to prevent situation my app uses network bandwidth potentially can cost money to the user under certain conditions, although "cellular network" or "use data over roaming" device settings are enabled.


There is not a way to restrict the internet usage for Crashlytics in an application. But how I would fix it is to either give the user information that Crashlytics is using roaming or just save the crash report locally and send them once the user in connected with a wifi network. Also you could give the user the choice if he prefers to save the crash reports locally or send them right away over roaming.

  1. Save the ErrorLog locally on the device
  2. Upload the ErrorLog once a connection with a wifi is established

You should be able to use the ConnectivityManager to get the state of the Wi-Fi adapter. From there you can check if it is connected or even available.

ConnectivityManager connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);  if (mWifi.isConnected()) {     // post error logs } 


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: