-
-
Notifications
You must be signed in to change notification settings - Fork 735
Fix the bug that wrongly use the GCM when GSF is not fully available. #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
By analyzing the blame information on this pull request, we identified @grantland to be a potential reviewer. |
intent.setPackage("com.google.android.gsf"); | ||
List<ResolveInfo> services = getContext().getPackageManager().queryIntentServices(intent, 0); | ||
return services != null && services.size() > 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this method into GcmRegistrar
With this change, we shouldn't need |
@elvishew updated the pull request. |
@elvishew updated the pull request. |
I'm not too familiar with this code, @bnham would you have any insight into this? |
} | ||
|
||
private static boolean isGooglePlayServicesAvailable() { | ||
return Build.VERSION.SDK_INT >= 8 && getPackageInfo("com.google.android.gsf") != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simplify this PR by deleting these two lines here and replacing it with the code you wrote for isGcmRegisterServiceAvailable
?
This looks good, but let's try to minimize the amount of code changed. Can you change your diff so that it just deletes the body of |
@elvishew updated the pull request. |
Pull from official repo
@elvishew updated the pull request. |
Do we still need this PR? |
This PR is very out of date, if OP wants to redo it, feel free. Going to close this one though |
When I am using Parse push notification, I found I always could not receive any push notification if I am using Huawei phones, and finally I found out that the Huawei phone has google service framework, so Parse would choose GCM as push type, but unfortunately, there is no Play Store in the phone, and somehow when Parse try to register the GCM push, it always got GSF_PACKAGE_NOT_AVAILABLE error, so the push notification won't work at all, but if I install Play Store on the phone, the GCM works.
I don't know whether this is a bug of Huawei's OS, or a bug of Parse, I just fix it. If we can not find the GCM register service, we regard the phone as GCM register unavailable.
With this fix, even there is no Play Store installed in Huawei phones, the push can work in a PPNS mode.