Skip to content

Conversation

@Jawnnypoo
Copy link
Member

For 1.17.0, the way you setup push changes for using FCM instead of GCM.

This also removes references to setting up the app in the Android Manifest in favor of setting it up in the Application class, using the builder.

@Jawnnypoo
Copy link
Member Author

@rogerhu Do you mind taking a look?

android:value="id:YOUR_SENDER_ID" />;
```groovy
dependencies {
implementation 'com.parse:parse-android-fcm:latest.version.here'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set to 1.17.0 so it's ready to go!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something that would replace the 1.17.0 with the later version when we do a new release? Otherwise, I think it is probably pretty annoying to have to edit these files all the time when there is a new release. Maybe just making this always say latest.version.here would be easier to maintain?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use https://api.bintray.com/packages/parse/maven/com.parse:parse-android/images/download.svg for our badge version..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Trying to figure that out took 10 mins!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean we would include the badge below that line of text or something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's always hard to figure out where to find the latest version is..

```
Then, follow Google's docs for [setting up an Firebase app](https://firebase.google.com/docs/android/setup). Although the steps are different for setting up FCM with Parse, it is also a good idea to read over the [Firebase FCM Setup](https://firebase.google.com/docs/cloud-messaging/android/client).

Change the `android:name` attribute of `<category>` element above to match your application's package name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also should mention the migration from GCM to FCM link (https://developers.google.com/cloud-messaging/android/android-migrate-fcm)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could potentially mention it in the README for GCM, but not here, since hopefully most won't need to care about it.

#### Configure Broadcast Receiver and Permissions
#### FCM Push Setup

Add the following service and broadcast receiver definitions to `AndroidManifest.xml` immediately before the *closing* `</application>` tag:
Copy link
Contributor

@rogerhu rogerhu May 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're also forgetting that we need to add the app to the Firebase console, download the google-services.json and applying the apply plugin: 'com.google.gms.google-services' statement too?

https://firebase.google.com/docs/android/setup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is mentioned below, in the "Then, follow Google's docs for setting up an Firebase app" text

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I found it confusing what to do given there are some steps that aren't necessary.

See: https://github.com/rogerhu/Parse-SDK-Android/blob/3748a0872f9a1263145a9b299210089101b64707/README.md#migrating-to-firebase

.server("http://localhost:1337/parse/")
.build()
);
}
Copy link
Contributor

@rogerhu rogerhu May 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have to do ParseFCM.register(this); in the Application instance if we want push?

(Or ParseGCM.register(this)) for an older version..)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it is not required for FCM. I think we will leave the GCM instructions out of here, only mentioning it at the bottom, so that people will move away from it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was playing with it last night but couldnt get stuff to fire unless I did the register command with FCM...you sure it works without it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I was putting a breakpoint on the wrong place. Works fine!

Copy link
Contributor

@rogerhu rogerhu May 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my updates about how a JobService is scheduled to run when the app starts:

https://github.com/parse-community/Parse-SDK-Android/pull/817/files
image

<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="id:YOUR_SENDER_ID_1,YOUR_SENDER_ID_2,YOUR_SENDER_ID_3" />;
```
The Parse library provides push notifications using Firebase Cloud Messaging (FCM) if Google Play Services are available. Learn more about Google Play Services [here](https://firebase.google.com/docs/cloud-messaging/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section should include the fact that calling ParseFCM.register(this) automatically passes the Installation object to the Parse server as a GCM token type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user should never have to call this manually given our setup. Do you think we should still mention that it is happening?

@Jawnnypoo
Copy link
Member Author

I think this should be good to go, other than the latest.version.here bit, if we want it to have a badge that show the latest version. I have a PR to test this out in the main repo parse-community/Parse-SDK-Android#815

@rogerhu
Copy link
Contributor

rogerhu commented May 2, 2018 via email

super.onCreate();
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("YOUR_APP_ID")
.clientKey("YOUR_CLIENT_KEY")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client key can be null, as it is by default

```groovy
dependencies {
implementation 'com.parse:parse-android:1.16.7'
implementation 'com.parse:parse-android:latest.version.here'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should put a comment about adding the FCM package here as optional

implementation 'com.parse:parse-fcm-android:latest.version.here'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe we should have a note about push somewhere in the README, but there are plenty of people/apps that use Parse Android without using any form of push, so I think it might be confusing here.

@rogerhu
Copy link
Contributor

rogerhu commented May 4, 2018

I'm pushing and tagging 1.17.0 the Android SDK right now...can you help tweak up these changes so we can have it ready? Thanks!

@rogerhu
Copy link
Contributor

rogerhu commented May 6, 2018

pull requested #523 -- I had to revert 6a49413 because it breaks the npm build.

Can someone tell me why markup stops showing up on the local dev?

@Jawnnypoo Jawnnypoo closed this Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants