Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit fe7c354

Browse files
Feature Request: Support In-App Messaging #1112
1 parent 45990d6 commit fe7c354

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/IN_APP_MESSAGING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<img src="https://raw.githubusercontent.com/EddyVerbruggen/nativescript-plugin-firebase/master/docs/images/features/inappmessaging.png" height="85px" alt="In-App Messaging"/>
2+
3+
> Added in plugin version 8.2.0
4+
5+
## In-App Messaging?
6+
Engage active app users with contextual messages.
7+
8+
[Learn more here..](https://firebase.google.com/docs/in-app-messaging/)
9+
10+
## Want to see a demo?
11+
Check out the (code of the) [Vue demo](demo-vue)!
12+
13+
## Enabling Cloud Functions
14+
To add this feature to your project, either:
15+
16+
* Remove `firebase.nativescript.json` from the root of the project and run `npm i`, or
17+
* Edit that file and add `"in_app_messaging": true`.
18+
19+
In both cases, remove the `/platforms` folder afterwards so the required native library will be added upon the next build.
20+
21+
## API
22+
There's nothing you have to do code-wise if you only want to display messages.
23+
If you want to capture a 'button clicked' event however, read on.
24+
25+
### `onMessageClicked`
26+
27+
```typescript
28+
import { inappmessaging } from "nativescript-plugin-firebase/inappmessaging";
29+
30+
inappmessaging.onMessageClicked(message => {
31+
console.log("Clicked a button for Campaign: " + message.campaignName);
32+
});
33+
```
34+
35+
### `onMessageImpression`
36+
You can also get notified if a message is being shown to a user:
37+
38+
```typescript
39+
import { inappmessaging } from "nativescript-plugin-firebase/inappmessaging";
40+
41+
inappmessaging.onMessageImpression(message => {
42+
console.log("A message belonging to this campaign is being shown: " + message.campaignName);
43+
});
44+
```
38.7 KB
Loading

0 commit comments

Comments
 (0)