You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: docs/MESSAGING.md
+5-10Lines changed: 5 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,17 +26,8 @@ Open `app/App_Resources/iOS/Info.plist` and add this to the bottom:
26
26
#### Provisioning hell
27
27
Follow [this guide](https://firebase.google.com/docs/cloud-messaging/ios/certs) to the letter. Once you've done it run `tns run ios` and upon starting the app it should prompt you for notification support. That also works on the simulator, but actually receiving notifications is _only_ possible on a real device.
28
28
29
-
#### Don't receive the "Allow app to receive notifications" prompt?
30
-
Make sure your `app.js` has this before `application.start();`:
31
-
32
-
```js
33
-
var firebase =require("nativescript-plugin-firebase");
34
-
```
35
-
36
-
Delete and re-add your app after you've added this.
37
-
38
29
### Handling a notification
39
-
To listen to received notifications while in the foreground or when your app moves from the background to the foreground, add a handler `init`.
30
+
To listen to received notifications while in the foreground or when your app moves from the background to the foreground, add a handler to `init`.
40
31
41
32
Any pending notifications (while your app was not in the foreground) will trigger the `onMessageReceivedCallback` handler.
42
33
@@ -53,6 +44,8 @@ Any pending notifications (while your app was not in the foreground) will trigge
53
44
54
45
You don't _have_ to provide the handler during `init` - you can also do it through a dedicated function.
55
46
47
+
One scenario where you want to do this is if you don't want the "This app wants to send push notifications" popup during init, but delay it until you call this function.
48
+
56
49
```js
57
50
firebase.addOnMessageReceivedCallback(
58
51
function(message) {
@@ -95,3 +88,5 @@ curl -X POST --header "Authorization: key=SERVER_KEY" --Header "Content-Type: ap
95
88
* DEVICE_TOKEN: the one you got in `addOnPushTokenReceivedCallback` or `init`'s `onPushTokenReceivedCallback`
96
89
97
90
<imgsrc="images/push-server-key.png"width="459px"height="220px"alt="Push server key"/>
// making this conditional to avoid http://stackoverflow.com/questions/37428539/firebase-causes-issue-missing-push-notification-entitlement-after-delivery-to ?
0 commit comments