-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
FCM Support - GCM Module #800
Conversation
/** | ||
* Parse Logger | ||
*/ | ||
public class PLog { |
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.
Had to make this public to allow for logging in the other modules
Codecov Report
@@ Coverage Diff @@
## master #800 +/- ##
============================================
+ Coverage 53.35% 54.57% +1.22%
+ Complexity 1749 1716 -33
============================================
Files 132 124 -8
Lines 10268 9874 -394
Branches 1426 1384 -42
============================================
- Hits 5478 5389 -89
+ Misses 4337 4042 -295
+ Partials 453 443 -10
Continue to review full report at Codecov.
|
fcm/README.md
Outdated
|
||
You will then need to register some things in your manifest, specifically: | ||
```xml | ||
<service |
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.
The parse-android-fcm should include this service in its AndroidManifest.xml file. There should be manifest merging when building it as an AAR.
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.
The problem is the balance between registering these services and allowing users to have their own. If we register it in the app module, it will not allow users to override and potentially send tokens to another server or save them elsewhere. Its similar to the reason why we do not automatically register the ParsePushReceiver in the Parse SDK library. Does that make sense? I think a user would be able to use tools:remove in the manifest to remove the library ones, but that might be more complex them just asking the user to add the registration (which is what you do in the normal FCM setup)
|
||
```xml | ||
<service | ||
android:name=".MyFirebaseMessagingService"> |
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.
same here too?
gcm/README.md
Outdated
android:permission="com.google.android.c2dm.permission.SEND" > | ||
<intent-filter> | ||
<action android:name="com.google.android.c2dm.intent.RECEIVE" /> | ||
<category android:name="com.your.package.name.here" /> |
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.
You should be able to use so you don't need to worry about mistyping. Gradle swaps in the correct package name.
<!-- ${packageName} is substituted for the package name declared above. -->
<permission android:protectionLevel="signature" android:name="${packageName}.permission.C2D_MESSAGE" />
<uses-permission android:name="${packageName}.permission.C2D_MESSAGE" />```
|
||
<application> | ||
|
||
<service |
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.
move ParseGCMListenerService and ParseGCMInstanceIDListenerService here too?
@Jawnnypoo you can setup to build artifacts for different projects, this happens already with https://github.com/parse-community/ParseUI-Android |
Thanks for working on this! |
Constraint.ON_ANY_NETWORK | ||
) | ||
.setService(ParseFirebaseJobService.class) // the JobService that will be called | ||
.setTag("upload-token") // uniquely identifies the job |
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 set as a constant?
gcm/README.md
Outdated
implementation 'com.parse:parse-android:latest.version.here' | ||
implementation 'com.parse:parse-android-gcm:latest.version.here' | ||
|
||
implementation "com.google.android.gms:play-services-gcm:latest.version.here" |
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.
this shouldn't be necessary given you declared play-services-gcm as an api dependency
Okay @rogerhu Feedback has been addressed. Let me know if my comment above makes sense about not registering the services and receivers in the library projects. I think the reasoning would be the same as why it is not done automatically in the normal FCM implementation either, outlined here: https://firebase.google.com/docs/cloud-messaging/android/client Basically, only one instance ID and messaging service is allowed per app, and forcing the Parse ones to already be registered would not allow users to define their own. |
Something else to note is that I cannot update the build to use Gradle 4.4, with gradle build tools |
@Jawnnypoo you'll just need to add https://github.com/rogerhu/Parse-SDK-Android/blob/070c3afd1aec31efaf466da6877fd6cb6f0c84dc/Parse/build.gradle#L214-L262 to both the fcm and gcm directories. https://github.com/parse-community/Parse-SDK-Android/pull/804/files simplifies the Gradle statements |
Rebase too :) I suggest we use a common version share between the fcm and gcm version as well |
Do you mean for the FCM/GCM dependencies? |
Yeah see commonLibVersion in https://github.com/parse-community/ParseUI-Android/blob/master/build.gradle |
Okay, added the common lib version to all modules. I am not sure which parts of the Parse/build.gradle I need to apply to the |
Parse/build.gradle
Outdated
@@ -5,7 +5,7 @@ apply plugin: 'com.github.kt3k.coveralls' | |||
apply plugin: 'com.jfrog.bintray' | |||
|
|||
group = 'com.parse' | |||
version = '1.16.8-SNAPSHOT' | |||
version = rootProject.ext.commonLibVersion |
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.
keep this version? i think we don't need to have the same version tied to the gcm/fcm plugins...
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.
Do you plan to distribute the plugins separately? having everything at the same version helps understanding issues :)
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.
Yeah good point. We can tie the versions together as it's done with the OkHttp3 library...
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.
I believe it will be simpler to keep track of changes. Also that's what we do on the iOS SDK now that we moved everything as a mono repo.
Yeah feel free to extract it out and use the |
Nice work @Jawnnypoo ! You should now remove PushServiceApi26 from Parse/manifest. Speaking about cleanup, I remember being tempted to rip off PushRouter and PushHistory. PushHistory seems to be doing legacy operations, and PushRouter seem to exist only to deal with the history. Is it worth to take a look? |
@natario1 they are used for de-duplication (https://github.com/parse-community/Parse-SDK-Android/blob/master/Parse/src/main/java/com/parse/PushRouter.java#L28) |
@mmimeault feel free to have a look at it too :) we could beta test on our side as well. |
For the PushRouter and PushHistory, I think maybe previously there was duplication due to the fact that the Parse Android SDK was registering for GCM push tokens via a custom implementation instead of relying on the Google Play Services version. I would venture to guess that now that we use the Google Play Services library for registration and message receiving, it probably takes care of these nuances. |
I don't think so...I've seen cases of dup pushes. I'd leave it in.
…On Fri, Apr 13, 2018, 6:19 PM John Carlson ***@***.***> wrote:
For the PushRouter and PushHistory, I think maybe previously there was
duplication due to the fact that the Parse Android SDK was registering for
GCM push tokens via a custom implementation instead of relying on the
Google Play Services version. I would venture to guess that now that we use
the Google Play Services library for registration and message receiving, it
probably takes care of these nuances.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#800 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAT8yRASVff5uPA0F3CjIHXHh7HcshJjks5toU6EgaJpZM4TRRR6>
.
|
@rogerhu Can you take a look at the maven setup I did within the gradle folder? I am not sure if it is correct. (Latest commit) |
Any ideas why the build may have failed here @rogerhu ? Looks like it is related to the codecov setup? |
@Jawnnypoo no it's the Gradle 3.1.1 upgrade that caused stuff to break. If I downgrade your current stuff seems to build. |
If you do gradlew build --stacktrace:
https://issuetracker.google.com/issues/77236219 It seems like |
Nice @rogerhu Looks like that worked. Anything else we need to get this merged? |
Can we update the readme with upgrade instructions? (Also the build.gradle should put a big fat warning) Also the parse docs draft too Is there a way to detect if either package is included and throwing a parse debug log that push is not enabled? |
build.gradle
Outdated
|
||
supportLibVersion = '27.0.1' | ||
commonLibVersion = "1.17.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.
this should be snapshot
downgrade for now change to snapshot delete this line add back in update tab
This ended up being a pretty large effort and a substantial set of changes.
The good news is that now that GCM is not anywhere in the core SDK, it removes quite a bit of code and allows us to lean more on the Google Play Services library to do the implementation.
So, this update will not be backwards compatible, and will require us to solve the problem of shipping multiple artifacts with the library. I think maybe you have more experience with this process, @rogerhu ? I once again would advocate for switching over to jitpack.io to make the releases easy and doable by anyone who can tag a release. But I digress.
I have tested the
gcm
andfcm
modules in a sample project with a standard setup. Everything seems to work fine. Note that the instructions for setting up can be found in the README of thegcm
andfcm
modules respectively. We will need to update http://docs.parseplatform.org/tutorials/android-push-notifications/ to either reflect the changes, or point users to the FCM and GCM docs, leaning them more toward FCM since GCM is going away.Somewhat unrelated, but I think with these changes bumping us to a 1.17.0, we should consider removing or deprecating any other things we think need to be removed or deprecated. I for one think that we need to get rid of parsing the server url and application id and client key from the Android Manifest. It seems like as we add more and more methods to the Parse.Configuration.Builder, we would just want people to use this instead.