In cases when the app is running behind a firewall or there is a network outage or some sort of censorship, How can we check using code to see if the app can access the firebase systems?
You should check if Google Play Service is available like this:
/**
* Check the device to make sure it has the Google Play Services APK. If it
* doesn't, display a dialog that allows users to download the APK from the
* Google Play Store or enable it in the device's system settings.
*/
public static boolean checkPlayServices(Context context) {
int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable
(context);
if (resultCode != ConnectionResult.SUCCESS) {
Log.i(TAG, "This device does not support Google Play Services. " +
"Push notifications are not supported");
return false;
}
return true;
}
You need to add the following line to your build.gradle
also.
compile 'com.google.android.gms:play-services-gcm:11.8.0'
I am guessing currently there is no way you can check whether Firebase is available or not from codes inside the app. However you can check if Firebase itself is working fine by checking Firebase Status Dashboard.
In this site you can also find in what date Firebase service was not available or unstable in the past.
Hope it helps in some way.
https://status.firebase.google.com/
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