Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.

Commit aeb199c

Browse files
author
Georgi Prodanov
committed
#326190 Update plugin version and supported platforms.
1 parent 6041a16 commit aeb199c

2 files changed

Lines changed: 3 additions & 87 deletions

File tree

README.md

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -313,87 +313,3 @@ In case the application doesn't work as expected. Here are some things you can v
313313
In order to use the plugin with Telerik Backend Services take a look at the official sample:
314314

315315
[Telerik Backend Services NativeScript Push Sample](https://github.com/NativeScript/sample-push-plugin)
316-
317-
318-
## FCM migration changes testing cheatsheet
319-
320-
0. Run "tns doctor" and make sure everything is up to date
321-
322-
1. Install the plugin
323-
- go into package.json at the root of the project (most probably push sample) and set the dir to "absolute/path/to/pushpluginrepo"
324-
325-
2. Amend build.gradle to include the google-services gradle plugin and apply it
326-
- open projectRoot/platforms/android/build.gradle
327-
- find the following piece of code (it's at the top)
328-
329-
```groovy
330-
buildscript {
331-
repositories {
332-
jcenter()
333-
}
334-
335-
dependencies {
336-
classpath "com.android.tools.build:gradle:2.1.2"
337-
classpath "com.google.gms:google-services:3.0.0" // <<== This line will not be there. Add it.
338-
}
339-
}
340-
```
341-
342-
- add | classpath "com.google.gms:google-services:3.0.0" | as a dependency (as shown above)
343-
- add | apply plugin: "com.google.gms.google-services" | at the very bottom of the file
344-
345-
3. google-services.json
346-
To use FCM, you need this file. It contains configurations and credentials for your Google/Firebase project. To get one...
347-
348-
- visit http://firebase.google.com.
349-
- create a Firebase project or migrate an existing Google project
350-
- in the project "overview" page click "Add Firebase to your Android app" in the top middle of the page.
351-
- type in package name (for the push sample project "com.telerik.PushNotificationApp")
352-
- leave the other fields empty (it's just a test app) and click "Add app" - this will download your google-services.json
353-
- place the google-services.json file into projectroot/App_Resources/Android
354-
355-
If something goes wrong, try this - https://firebase.google.com/docs/android/setup
356-
357-
4. The Firebase Server key
358-
You need a Server key to send messages.
359-
360-
- go to the project you created/migrated in 3) "overview" page
361-
- in the top left of the page (under the Firebase logo), click the gear icon and select "project settings"
362-
- from the tabs at the top of the newly opened page, click "cloud messaging"
363-
- copy the "Server key" into the "Push Settings" page of Backend Services as "Google API Key"
364-
- copy the Sender ID and use it to register with the push plugin (for the push sample app, paste it where it asks for google project number)
365-
366-
5. tns run android
367-
368-
- test the push plugin
369-
370-
371-
### Things that have changed
372-
373-
- When you send a notification through Backend Services, the value of the "Android" key can now have both "data" and "notification" keys.
374-
- Notification messages are Data, Notification or Mixed
375-
- The "data" key should function just like before:
376-
- its "message", "title", "color", "smallIcon", "largeIcon" (etc..) keys should be respected
377-
- the onMessageReceived callback is called each time a "data" notification is received with the same arguments
378-
- when in background mode, a notification is created in the tray (otherwise, it is not). tapping that notification launches the app and invokes the onMessageReceived callback with the same arguments
379-
- The "notification" key is new. It functions like the native FCM implementation... more or less :)
380-
- notification messages support all FCM key/values
381-
- if the app is in foreground, it invokes the onMessageReceived callback with arguments (message, dataAsJson) - this may change, according to what you and Dobrev figure out, ask him
382-
- if the app is in background, a notification is put in the tray. When tapped, it launches the app, but does not invoke the onMessageReceived callback
383-
- mixed messages are supported. when a mixed message is received and....
384-
- the app is in foreground, the onMessageReceived callback is invoked with params (message, dataAsJson)
385-
- the app is in background, the onMessageReceived callback is not invoked
386-
- the app is in background, and the notification in the tray is tapped, the "data" part of the mixed message is available in the extras of the intent of the launched activity - these can be accessed with through nativescript, like they would in Java
387-
- we have removed the default large icon because it forced you to have a large icon and this wasnt the behaviour of FCM notifications
388-
- default color and icon for FCM messages can be set in the AndroidManifest.xml of the project using this XML, inside the "application" tag:
389-
390-
```xml
391-
<meta-data
392-
android:name="com.google.firebase.messaging.default_notification_icon"
393-
android:resource="@drawable/ic_stat_ic_notification" />
394-
<meta-data
395-
android:name="com.google.firebase.messaging.default_notification_color"
396-
android:resource="@color/colorAccent" />
397-
```
398-
399-
For more info: https://firebase.google.com/docs/cloud-messaging/android/topic-messaging#edit-the-app-manifest

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name" : "nativescript-push-notifications",
3-
"version": "0.0.19",
3+
"version": "0.1.0",
44
"main" : "push-plugin.js",
55
"repository": {
66
"type": "git",
@@ -9,8 +9,8 @@
99
"license": "Apache-2.0",
1010
"nativescript": {
1111
"platforms": {
12-
"ios": "2.3.0",
13-
"android": "2.3.0"
12+
"ios": "2.4.0",
13+
"android": "2.4.1"
1414
}
1515
}
1616
}

0 commit comments

Comments
 (0)