2016-07-14 47 views
1

如果应用程序在防火墙后面运行或出现网络中断或某种审查情况,我们如何使用代码检查应用程序是否可以访问Firebase系统?如何检查是否提供Firebase服务?

+1

如果downvoter解释了推理,将会有所帮助。 – Yohannes

+0

*不是downvoter *您特别想使用哪些Firebase功能,因为其中许多人的答案可能不同。 –

+0

@FrankvanPuffelen,我使用了很多(auth,database,fcm,storage)。我的问题是代码连续失败,这可能是由于互联网限制(即,它可以与不同的ISP一起工作)。这是我看到我需要处理的情况。 – Yohannes

回答

2

我猜测目前您无法从应用程序内的代码中检查Firebase是否可用。不过,您可以通过检查Firebase状态信息中心来检查Firebase本身是否正常工作。

在此站点中,您还可以找到过去Firebase服务不可用或不稳定的日期。

希望它有助于某种方式。

https://status.firebase.google.com/

0

你应该检查,如果谷歌Play业务是提供这样的:

/** 
* 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; 
} 

你需要下面的行添加到您的build.gradle也。

compile 'com.google.android.gms:play-services-gcm:11.8.0'

相关问题