GooglePlayServicesUtil vs GoogleApiAvailability

后端 未结 6 561
慢半拍i
慢半拍i 2020-11-28 20:25

I am trying to use Google Play Service in my Android app. As Google document says, we need to check if the Google API is available before using it. I have searched some way

6条回答
  •  自闭症患者
    2020-11-28 21:06

    You will have to use GoogleApiAvailability instead:

    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance(); 
    int errorCode = googleApiAvailability.isGooglePlayServicesAvailable(this);
    

    this represents the context.

提交回复
热议问题