کار این تابع اینه که چک میکنه که الان وضعیت گوگل پلی سرویس در چه حالتی هست که اگر SUCCESS اتفاق بیافته میتونیم کارهای مربوط به پوش نوتیفیکیشن رو انجام بدیم
هنوز حالتهای دیگه هم داره که تو این تابع نیست:
کد:
GoogleApiAvailability avail;
int PLAY_SERVICE_STATUS = avail.isGooglePlayServicesAvailable(this);
checkPlayService(PLAY_SERVICE_STATUS);private void checkPlayService(int PLAY_SERVICE_STATUS)
{
switch (PLAY_SERVICE_STATUS)
{
case ConnectionResult.API_UNAVAILABLE:
//API is not available
break;
case ConnectionResult.NETWORK_ERROR:
//Network error while connection
break;
case ConnectionResult.RESTRICTED_PROFILE:
//Profile is restricted by google so can not be used for play services
break;
case ConnectionResult.SERVICE_MISSING:
//service is missing
break;
case ConnectionResult.SIGN_IN_REQUIRED:
//service available but user not signed in
break;
case ConnectionResult.SUCCESS:
break;
}
}