cordova-plugin-reteno 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/docs/Cordova/Action Buttons/README.md +62 -0
- package/docs/Cordova/AppInbox/README.md +55 -0
- package/docs/Cordova/AppLifeCycleEvents/README.md +80 -0
- package/docs/Cordova/Ecommerce/README.md +144 -0
- package/docs/Cordova/InAppMessages/README.md +72 -0
- package/docs/Cordova/Push notification/README.md +129 -0
- package/docs/Cordova/Recommendations/README.md +62 -0
- package/docs/Cordova/SetupGuide/Android.md +135 -0
- package/docs/Cordova/SetupGuide/IOS.md +325 -0
- package/docs/Cordova/SetupGuide/README.md +91 -0
- package/docs/Cordova/Tracking user behaviour/README.md +52 -0
- package/docs/Cordova/Tracking user information/README.md +112 -0
- package/docs/Ionic/Action Buttons/README.md +66 -0
- package/docs/Ionic/AppInbox/README.md +61 -0
- package/docs/Ionic/AppLifeCycleEvents/README.md +77 -0
- package/docs/Ionic/Ecommerce/README.md +139 -0
- package/docs/Ionic/InAppMessages/README.md +65 -0
- package/docs/Ionic/Push notification/README.md +133 -0
- package/docs/Ionic/Recommendations/README.md +46 -0
- package/docs/Ionic/SetupGuide/Android.md +173 -0
- package/docs/Ionic/SetupGuide/IOS.md +354 -0
- package/docs/Ionic/SetupGuide/README.md +167 -0
- package/docs/Ionic/Tracking user behaviour/README.md +31 -0
- package/docs/Ionic/Tracking user information/README.md +98 -0
- package/package.json +1 -1
- package/plugin.xml +20 -2
- package/scripts/ios-podfile-use-modular-headers.js +109 -0
- package/scripts/validate-install.js +37 -9
- package/src/android/app/build.gradle +1 -1
- package/src/android/app/src/main/java/com/reteno/plugin/RetenoPlugin.java +29 -9
- package/src/android/reteno.gradle +19 -9
- package/src/ios/RetenoPlugin.swift +37 -5
- package/src/ios/RetenoPluginBootstrap.m +117 -0
- package/types/index.ts +1 -1
- package/docs/android.md +0 -264
- package/docs/api.md +0 -734
- package/docs/ios.md +0 -495
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Android
|
|
2
|
+
|
|
3
|
+
### Getting started with Reteno Plugin for Android
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
> Requirement: `cordova-android >= 12.0.0`. Older Cordova Android platforms will refuse to install the plugin.
|
|
8
|
+
|
|
9
|
+
1. Install plugin from the project root:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
cordova plugin add cordova-plugin-reteno --variable RETENO_ACCESS_KEY=YOUR_KEY
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Configure via config.xml (Cordova)
|
|
16
|
+
|
|
17
|
+
If you prefer to keep the access key in your Cordova app config (instead of passing `--variable` during installation), configure plugin variables in `config.xml`:
|
|
18
|
+
|
|
19
|
+
```xml
|
|
20
|
+
<widget ...>
|
|
21
|
+
<plugin name="cordova-plugin-reteno" spec="cordova-plugin-reteno">
|
|
22
|
+
<variable name="RETENO_ACCESS_KEY" value="YOUR_KEY" />
|
|
23
|
+
</plugin>
|
|
24
|
+
</widget>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Notes:
|
|
28
|
+
|
|
29
|
+
- Access-key precedence: `RETENO_ACCESS_KEY` -> deprecated `SDK_ACCESS_KEY` -> AndroidManifest meta-data injected by the plugin. New integrations should use `RETENO_ACCESS_KEY`.
|
|
30
|
+
- If you changed plugin variables, usually you need reinstall/re-add:
|
|
31
|
+
- `cordova plugin rm cordova-plugin-reteno && cordova plugin add ...`
|
|
32
|
+
- or `cordova platform rm android && cordova platform add android`
|
|
33
|
+
|
|
34
|
+
2. Reteno Android dependency is added automatically by the plugin Gradle hook.
|
|
35
|
+
|
|
36
|
+
3. Android 13+ (`targetSdkVersion >= 33`) requires runtime permission for notifications.
|
|
37
|
+
The plugin injects `POST_NOTIFICATIONS` into manifest, but you still must request it in runtime:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
RetenoPlugin
|
|
41
|
+
.requestNotificationPermission()
|
|
42
|
+
.then((grantedInt) => {
|
|
43
|
+
// 1 - granted, 0 - declined
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
console.error(err);
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
4. Initialize SDK once on app startup.
|
|
51
|
+
|
|
52
|
+
For the full `init(...)` reference (options, platform matrix, `deviceready` wrapper) see [Initialize the SDK](./README.md#initialize-the-sdk).
|
|
53
|
+
|
|
54
|
+
> **Note**: in Cordova apps the UI runs inside a single WebView, so native automatic screen tracking is usually not meaningful. For screen analytics use `RetenoPlugin.logScreenView('ScreenName')` manually.
|
|
55
|
+
|
|
56
|
+
5. Set up Firebase Cloud Messaging (FCM):
|
|
57
|
+
|
|
58
|
+
- Download `google-services.json` from Firebase console.
|
|
59
|
+
- Place it to your Cordova project root or `resources/android/`.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
- Copy your Firebase key and finish Reteno panel setup.
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+

|
|
68
|
+
|
|
69
|
+

|
|
70
|
+
|
|
71
|
+
Follow official guides:
|
|
72
|
+
|
|
73
|
+
- [Setting up Firebase for FCM](https://docs.reteno.com/reference/setting-up-your-firebase-application-for-firebase-cloud-messaging)
|
|
74
|
+
- [Connect your mobile app in Reteno](https://docs.reteno.com/docs/connect-your-mobile-app)
|
|
75
|
+
|
|
76
|
+
## Push notification listeners
|
|
77
|
+
|
|
78
|
+
The plugin provides listener-based API for Android push events.
|
|
79
|
+
|
|
80
|
+
- `setOnRetenoPushDismissedListener(listener)` for dismissed (swiped) pushes.
|
|
81
|
+
- `setOnRetenoCustomPushReceivedListener(listener)` for custom push payloads.
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
const onDismissed = (payload) => {
|
|
85
|
+
console.log('Push dismissed', payload);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const onCustomReceived = (payload) => {
|
|
89
|
+
console.log('Custom push received', payload);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
RetenoPlugin.setOnRetenoPushDismissedListener(onDismissed);
|
|
93
|
+
RetenoPlugin.setOnRetenoCustomPushReceivedListener(onCustomReceived);
|
|
94
|
+
|
|
95
|
+
// later:
|
|
96
|
+
RetenoPlugin.removeOnRetenoPushDismissedListener(onDismissed);
|
|
97
|
+
RetenoPlugin.removeOnRetenoCustomPushReceivedListener(onCustomReceived);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Without Firebasex (Cordova)
|
|
101
|
+
|
|
102
|
+
If you do not need `cordova-plugin-firebasex` features, you can still use Reteno Push on Android.
|
|
103
|
+
For FCM to work, your Cordova Android project must have:
|
|
104
|
+
|
|
105
|
+
1. `google-services.json` from Firebase Console.
|
|
106
|
+
2. Google Services Gradle plugin (`com.google.gms.google-services`) applied.
|
|
107
|
+
|
|
108
|
+
How to verify:
|
|
109
|
+
|
|
110
|
+
- `platforms/android/app/google-services.json` exists.
|
|
111
|
+
- `platforms/android/app/build.gradle` contains `com.google.gms.google-services`.
|
|
112
|
+
- Build logs do not contain `google-services.json not found`.
|
|
113
|
+
|
|
114
|
+
### Warning: Reteno + Firebasex (Android)
|
|
115
|
+
|
|
116
|
+
If your app also uses `cordova-plugin-firebasex`, be aware that Firebasex may register its own `FirebaseMessagingService`.
|
|
117
|
+
On Android, only one service receives `com.google.firebase.MESSAGING_EVENT`, so Firebasex can prevent Reteno callbacks.
|
|
118
|
+
|
|
119
|
+
Recommendation: do not install Firebasex only for push delivery if Reteno handles push in your app.
|
|
120
|
+
|
|
121
|
+
## Custom FCM service (optional)
|
|
122
|
+
|
|
123
|
+
Most Cordova apps do not need a custom `FirebaseMessagingService`.
|
|
124
|
+
If you add one for your own native logic, extend `RetenoFirebaseMessagingService` (not `FirebaseMessagingService`) and call `super` methods.
|
|
125
|
+
|
|
126
|
+
Official references:
|
|
127
|
+
|
|
128
|
+
- https://docs.reteno.com/reference/android-sdk-setup
|
|
129
|
+
- https://docs.reteno.com/reference/android-push-handling
|
|
130
|
+
|
|
131
|
+
## Deeplinks in push payloads
|
|
132
|
+
|
|
133
|
+
Reteno push notifications can include deeplinks. In Cordova apps, routing to a specific WebView route usually requires an app-level deeplink solution (custom URL scheme, App Links, or a provider such as Branch).
|
|
134
|
+
|
|
135
|
+
In practice, Reteno delivers the link in payload, but opening the exact destination screen should be handled by your app deeplink layer.
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# Cordova iOS SDK Setup
|
|
2
|
+
|
|
3
|
+
Official guide: https://docs.reteno.com/reference/ios
|
|
4
|
+
|
|
5
|
+
## Minimum SDK Requirements
|
|
6
|
+
|
|
7
|
+
- iOS 15.0+
|
|
8
|
+
- Xcode 15.0+
|
|
9
|
+
- Swift 5.7+
|
|
10
|
+
|
|
11
|
+
## Add plugin and configure preferences
|
|
12
|
+
|
|
13
|
+
In `config.xml` add (or verify):
|
|
14
|
+
|
|
15
|
+
```xml
|
|
16
|
+
<!-- Required: Reteno iOS SDK supports iOS 15.0+ -->
|
|
17
|
+
<preference name="deployment-target" value="15.0" />
|
|
18
|
+
|
|
19
|
+
<!-- Reteno SDK access key (required) -->
|
|
20
|
+
<preference name="RETENO_ACCESS_KEY" value="YOUR_RETENO_ACCESS_KEY" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`RETENO_ACCESS_KEY` is the preferred name. The deprecated `SDK_ACCESS_KEY` preference remains supported for backward compatibility.
|
|
24
|
+
|
|
25
|
+
Install plugin:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
cordova plugin add cordova-plugin-reteno --variable RETENO_ACCESS_KEY=YOUR_KEY
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If `pod install` fails with `required a higher minimum deployment target`, raise deployment target to `15.0`+.
|
|
32
|
+
|
|
33
|
+
If `pod install` fails with `CocoaPods could not find compatible versions for pod "Reteno"`, your local spec repo is out of date. Run:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pod install --repo-update
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
from the `platforms/ios` directory (or pass `-- --repo-update` to `cordova build ios`).
|
|
40
|
+
|
|
41
|
+
## Add Notification Service Extension (NSE)
|
|
42
|
+
|
|
43
|
+
NSE is required for rich push and correct push payload handling.
|
|
44
|
+
|
|
45
|
+
1. In Xcode select `File > New > Target...`
|
|
46
|
+
2. Select `Notification Service Extension`.
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="https://raw.githubusercontent.com/reteno-com/reteno-mobile-documentation/main/Cordova/SetupGuide/Resources/create_notification_service_extension.png" width="50%"/>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
3. Use product name `NotificationServiceExtension`, press `Finish`.
|
|
53
|
+
4. On activate scheme popup, press `Cancel`.
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<img src="https://raw.githubusercontent.com/reteno-com/reteno-mobile-documentation/main/Cordova/SetupGuide/Resources/choose_options_for_extension.png" width="50%"/>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
5. Check extension deployment target equals main app target.
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<img src="https://raw.githubusercontent.com/reteno-com/reteno-mobile-documentation/main/Cordova/SetupGuide/Resources/configure_target.png" width="50%"/>
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
6. Replace `NotificationService.swift` contents with:
|
|
66
|
+
|
|
67
|
+
```swift
|
|
68
|
+
import UserNotifications
|
|
69
|
+
import Reteno
|
|
70
|
+
|
|
71
|
+
class NotificationService: RetenoNotificationServiceExtension {}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Add App Groups
|
|
75
|
+
|
|
76
|
+
Enable App Groups in both main target and `NotificationServiceExtension`.
|
|
77
|
+
|
|
78
|
+
1. Main target -> `Signing & Capabilities` -> `+ Capability` -> `App Groups`
|
|
79
|
+
|
|
80
|
+
<p align="center">
|
|
81
|
+
<img src="https://raw.githubusercontent.com/reteno-com/reteno-mobile-documentation/main/Cordova/SetupGuide/Resources/add_group_main_target.png" width="50%"/>
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
2. Add group in format:
|
|
85
|
+
|
|
86
|
+
`group.{bundle_id}.reteno-local-storage`
|
|
87
|
+
|
|
88
|
+
Example: `group.com.example.app.reteno-local-storage`
|
|
89
|
+
|
|
90
|
+
3. Repeat in extension target.
|
|
91
|
+
|
|
92
|
+
<p align="center">
|
|
93
|
+
<img src="https://raw.githubusercontent.com/reteno-com/reteno-mobile-documentation/main/Cordova/SetupGuide/Resources/add_group_in_extension.png" width="50%"/>
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
<p align="center">
|
|
97
|
+
<img src="https://raw.githubusercontent.com/reteno-com/reteno-mobile-documentation/main/Cordova/SetupGuide/Resources/app_groups_capability.png" width="50%"/>
|
|
98
|
+
</p>
|
|
99
|
+
|
|
100
|
+
## Podfile for extension targets
|
|
101
|
+
|
|
102
|
+
Plugin wires `Reteno` pod into the main iOS target automatically.
|
|
103
|
+
For extension targets, add pods manually in `platforms/ios/Podfile` inside the main target block:
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
target 'App' do
|
|
107
|
+
# ... existing pods ...
|
|
108
|
+
|
|
109
|
+
target 'NotificationServiceExtension' do
|
|
110
|
+
inherit! :search_paths
|
|
111
|
+
pod 'Reteno', '2.7.6'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
target 'NotificationContentExtension' do
|
|
115
|
+
inherit! :search_paths
|
|
116
|
+
pod 'Reteno', '2.7.6'
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Optional: Notification Content Extension (Images Carousel)
|
|
122
|
+
|
|
123
|
+
The Notification Content Extension is required for rich push notifications with an **Images Carousel**.
|
|
124
|
+
It provides the `UNNotificationContentExtension` entry point that renders a custom carousel UI.
|
|
125
|
+
|
|
126
|
+
Official guide: https://docs.reteno.com/reference/ios-images-carousel
|
|
127
|
+
|
|
128
|
+
### Create the extension target
|
|
129
|
+
|
|
130
|
+
In Xcode: **File → New → Target → Notification Content Extension**. Name it `NotificationContentExtension`.
|
|
131
|
+
|
|
132
|
+
### Replace extension files
|
|
133
|
+
|
|
134
|
+
1. **Delete** the generated `MainInterface.storyboard` (it is not used with `RetenoCarouselNotificationViewController`).
|
|
135
|
+
2. Replace the contents of `NotificationViewController.swift` with:
|
|
136
|
+
|
|
137
|
+
```swift
|
|
138
|
+
import Reteno
|
|
139
|
+
|
|
140
|
+
final class NotificationViewController: RetenoCarouselNotificationViewController {}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Update `Info.plist` of the NCE
|
|
144
|
+
|
|
145
|
+
Open `NotificationContentExtension/Info.plist` as source code and replace the `NSExtension` dict with:
|
|
146
|
+
|
|
147
|
+
```xml
|
|
148
|
+
<key>NSExtension</key>
|
|
149
|
+
<dict>
|
|
150
|
+
<key>NSExtensionAttributes</key>
|
|
151
|
+
<dict>
|
|
152
|
+
<key>UNNotificationExtensionCategory</key>
|
|
153
|
+
<string>ImageCarousel</string>
|
|
154
|
+
<key>UNNotificationExtensionInitialContentSizeRatio</key>
|
|
155
|
+
<real>0.5</real>
|
|
156
|
+
<key>UNNotificationExtensionUserInteractionEnabled</key>
|
|
157
|
+
<true/>
|
|
158
|
+
</dict>
|
|
159
|
+
<key>NSExtensionPointIdentifier</key>
|
|
160
|
+
<string>com.apple.usernotifications.content-extension</string>
|
|
161
|
+
<key>NSExtensionPrincipalClass</key>
|
|
162
|
+
<string>$(PRODUCT_MODULE_NAME).NotificationViewController</string>
|
|
163
|
+
</dict>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Deployment target
|
|
167
|
+
|
|
168
|
+
Make sure the NCE **Deployment Target** in Xcode matches the main app target (iOS 15.0+). A mismatch is the most common reason carousel images fail to display.
|
|
169
|
+
|
|
170
|
+
### Embed App Extensions — Copy only when installing
|
|
171
|
+
|
|
172
|
+
> **This step must be done manually in Xcode.**
|
|
173
|
+
|
|
174
|
+
In Xcode: **Main target → Build Phases → Embed App Extensions**. For **both** `NotificationServiceExtension` and `NotificationContentExtension` ensure **"Copy only when installing"** is **unchecked**.
|
|
175
|
+
|
|
176
|
+
If this checkbox is left on, the extensions will not be embedded during Debug builds and carousel images will not appear.
|
|
177
|
+
|
|
178
|
+
## Initialize the SDK in JS
|
|
179
|
+
|
|
180
|
+
For the full `init(...)` reference (options, platform matrix, `deviceready` wrapper) see [Initialize the SDK](./README.md#initialize-the-sdk).
|
|
181
|
+
|
|
182
|
+
## Request Notification Permission
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
await RetenoPlugin.requestNotificationPermission();
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Provide Device Tokens to the SDK
|
|
189
|
+
|
|
190
|
+
If another SDK/plugin obtains APNs/FCM token, forward it to Reteno:
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
await RetenoPlugin.setDeviceToken(token);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Using FCM (Firebase Cloud Messaging) on iOS
|
|
197
|
+
|
|
198
|
+
If your app uses Firebase for push delivery on iOS, follow the steps below to integrate FCM token handling with Reteno.
|
|
199
|
+
|
|
200
|
+
### 1. `FirebaseMessaging` pod
|
|
201
|
+
|
|
202
|
+
The plugin includes `FirebaseMessaging` pod automatically via `plugin.xml`. No manual Podfile changes are needed.
|
|
203
|
+
|
|
204
|
+
Whether Firebase is actually **used** for token handling depends on the `IOS_DEVICE_TOKEN_HANDLING_MODE` preference (see step 4 below).
|
|
205
|
+
|
|
206
|
+
### 2. Add `GoogleService-Info.plist`
|
|
207
|
+
|
|
208
|
+
Download `GoogleService-Info.plist` from the [Firebase Console](https://console.firebase.google.com/) and add it to your **iOS app target** in Xcode:
|
|
209
|
+
|
|
210
|
+
- Open `platforms/ios/<AppName>.xcworkspace` in Xcode.
|
|
211
|
+
- Drag `GoogleService-Info.plist` into the project navigator under the main app target.
|
|
212
|
+
- Make sure **"Copy items if needed"** is checked and the file is added to the **main app target** (not only the extension targets).
|
|
213
|
+
|
|
214
|
+
If your app calls `FirebaseApp.configure()` without this file, Firebase will crash at runtime. The plugin avoids auto-configuring Firebase when the file is missing and logs a warning in manual mode.
|
|
215
|
+
|
|
216
|
+
### 3. Configure AppDelegate
|
|
217
|
+
|
|
218
|
+
Nothing to do. Firebase iOS SDK uses **method swizzling** by default — it automatically intercepts `didRegisterForRemoteNotificationsWithDeviceToken` and forwards the APNS token to Firebase without any AppDelegate code.
|
|
219
|
+
|
|
220
|
+
### 4. `IOS_DEVICE_TOKEN_HANDLING_MODE` defaults to `manual`
|
|
221
|
+
|
|
222
|
+
`IOS_DEVICE_TOKEN_HANDLING_MODE` now defaults to `manual` in the plugin, so no extra config is required for the Firebase flow in most cases.
|
|
223
|
+
|
|
224
|
+
If you previously overrode it to `automatic`, switch it back to `manual` to use FCM token forwarding.
|
|
225
|
+
|
|
226
|
+
Only set `automatic` when you intentionally want APNS-only token handling by the native Reteno SDK.
|
|
227
|
+
|
|
228
|
+
Supported modes:
|
|
229
|
+
|
|
230
|
+
- `manual` (default)
|
|
231
|
+
- `automatic`
|
|
232
|
+
|
|
233
|
+
Any value other than `automatic` is treated as `manual`.
|
|
234
|
+
|
|
235
|
+
The mode is read from iOS preferences during `RetenoPlugin.init()`. It cannot be changed at runtime from JS after plugin start.
|
|
236
|
+
|
|
237
|
+
How to change mode:
|
|
238
|
+
|
|
239
|
+
- Cordova: set in `config.xml` or pass during plugin installation via `--variable IOS_DEVICE_TOKEN_HANDLING_MODE=...`
|
|
240
|
+
|
|
241
|
+
Cordova `config.xml` example:
|
|
242
|
+
|
|
243
|
+
```xml
|
|
244
|
+
<preference name="IOS_DEVICE_TOKEN_HANDLING_MODE" value="automatic" />
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
After changing this preference, run `cordova prepare ios` and rebuild the iOS app.
|
|
248
|
+
|
|
249
|
+
When `IOS_DEVICE_TOKEN_HANDLING_MODE` is `manual` **and** Firebase is configured (either already configured by the app or auto-configured because `GoogleService-Info.plist` is present), the plugin automatically:
|
|
250
|
+
|
|
251
|
+
1. Subscribes to Firebase Messaging delegate token updates — every future FCM token rotation is forwarded to Reteno immediately.
|
|
252
|
+
2. Tries to forward the already-cached FCM token on warm starts.
|
|
253
|
+
|
|
254
|
+
## In-App Status Handler (iOS)
|
|
255
|
+
|
|
256
|
+
For usage examples and payload mapping, see:
|
|
257
|
+
|
|
258
|
+
- [InAppMessages/README.md](../InAppMessages/README.md)
|
|
259
|
+
|
|
260
|
+
## In-Apps Pause (iOS)
|
|
261
|
+
|
|
262
|
+
For pause/resume examples and pause behaviour options, see:
|
|
263
|
+
|
|
264
|
+
- [InAppMessages/README.md](../InAppMessages/README.md)
|
|
265
|
+
|
|
266
|
+
## App lifecycle and screen tracking note
|
|
267
|
+
|
|
268
|
+
Screen view tracking options:
|
|
269
|
+
|
|
270
|
+
- **Manual (recommended for Cordova)** — call `RetenoPlugin.logScreenView(screenName)` on each navigation event (for example, by subscribing to your router's navigation events). This works on both iOS and Android and tracks the actual JS screens your users see.
|
|
271
|
+
|
|
272
|
+
```js
|
|
273
|
+
await RetenoPlugin.logScreenView('ScreenName');
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
- **Automatic** — pass `isAutomaticScreenReportingEnabled: true` to `RetenoPlugin.init(...)`. The native iOS SDK will track `UIViewController` transitions automatically. Defaults to `false`.
|
|
277
|
+
|
|
278
|
+
> **Note on automatic screen tracking in hybrid apps:** In Cordova the entire UI runs inside a single WebView, so automatic tracking only captures native controller transitions (e.g. `CDVViewController`), not your JS screen navigations. The same applies to Android, where the native SDK's `autoScreenTracking` monitors `Fragment` transitions. For meaningful screen analytics in a hybrid app, always use `logScreenView()` manually.
|
|
279
|
+
|
|
280
|
+
## Custom Notification Behavior (optional)
|
|
281
|
+
|
|
282
|
+
After initialization you can configure foreground/tap handling from JS:
|
|
283
|
+
|
|
284
|
+
```js
|
|
285
|
+
await RetenoPlugin.setWillPresentNotificationOptions({
|
|
286
|
+
options: ['badge', 'sound', 'banner'],
|
|
287
|
+
emitEvent: true,
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
await RetenoPlugin.setDidReceiveNotificationResponseHandler({
|
|
291
|
+
enabled: true,
|
|
292
|
+
emitEvent: true,
|
|
293
|
+
});
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
If `emitEvent: true`, plugin emits:
|
|
297
|
+
|
|
298
|
+
- `reteno-push-received`
|
|
299
|
+
- `reteno-notification-clicked`
|
|
300
|
+
|
|
301
|
+
### Deeplinks in push payloads
|
|
302
|
+
|
|
303
|
+
Reteno push notifications on iOS can include links. In hybrid Cordova apps, opening the correct in-app route usually requires a separate app-level deeplink solution.
|
|
304
|
+
|
|
305
|
+
This plugin does not expose full native iOS link-handler customization to JavaScript, so for custom routing use your app deeplink layer, for example:
|
|
306
|
+
|
|
307
|
+
- Branch.io
|
|
308
|
+
- custom URL scheme plugin
|
|
309
|
+
- Universal Links / App Links integration
|
|
310
|
+
|
|
311
|
+
In practice, Reteno delivers the link in push payload, while navigation to the exact app screen should be handled by your deeplink router.
|
|
312
|
+
|
|
313
|
+
## App Lifecycle Events (iOS)
|
|
314
|
+
|
|
315
|
+
When lifecycle tracking is enabled, iOS can report:
|
|
316
|
+
|
|
317
|
+
- `ApplicationInstalled`
|
|
318
|
+
- `ApplicationUpdated`
|
|
319
|
+
- `ApplicationOpened`
|
|
320
|
+
- `ApplicationBackgrounded`
|
|
321
|
+
|
|
322
|
+
Related automatic events are also controlled via `lifecycleTrackingOptions`:
|
|
323
|
+
|
|
324
|
+
- push subscription events (`pushSubscriptionEnabled`)
|
|
325
|
+
- session events (`sessionStartEventsEnabled` / `sessionEndEventsEnabled`)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Cordova Plugin Setup
|
|
2
|
+
|
|
3
|
+
### The Reteno Cordova Plugin for Mobile Customer Engagement and Analytics solutions
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`Reteno` is a plugin for Cordova that helps mobile teams integrate Reteno into their mobile apps.
|
|
8
|
+
|
|
9
|
+
##### The plugin supports:
|
|
10
|
+
|
|
11
|
+
- Cordova 10.2 or later
|
|
12
|
+
- iOS 15.0 or later
|
|
13
|
+
- Android with `cordova-android >= 12.0.0`
|
|
14
|
+
|
|
15
|
+
`cordova-plugin-reteno@2.2.2` includes Reteno Android SDK 2.10.2 and Reteno iOS SDK 2.7.6.
|
|
16
|
+
|
|
17
|
+
## Getting started with Reteno Plugin / Setup guide
|
|
18
|
+
|
|
19
|
+
- [iOS](./IOS.md)
|
|
20
|
+
- [Android](./Android.md)
|
|
21
|
+
|
|
22
|
+
## Initialize the SDK
|
|
23
|
+
|
|
24
|
+
`RetenoPlugin.init(...)` must be called **after Cordova's native bridge is ready**. Call it from the `deviceready` listener.
|
|
25
|
+
|
|
26
|
+
### Cordova (vanilla JS)
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
document.addEventListener('deviceready', onDeviceReady, false);
|
|
30
|
+
|
|
31
|
+
function onDeviceReady() {
|
|
32
|
+
RetenoPlugin.init({
|
|
33
|
+
isDebugMode: false,
|
|
34
|
+
pauseInAppMessages: false,
|
|
35
|
+
pausePushInAppMessages: false, // Android only
|
|
36
|
+
inAppMessagesPauseBehaviour: 'POSTPONE_IN_APPS', // iOS only: 'SKIP_IN_APPS' | 'POSTPONE_IN_APPS'
|
|
37
|
+
isAutomaticScreenReportingEnabled: false, // iOS only
|
|
38
|
+
lifecycleTrackingOptions: { // or 'ALL' / 'NONE'
|
|
39
|
+
appLifecycleEnabled: true,
|
|
40
|
+
foregroundLifecycleEnabled: false,
|
|
41
|
+
pushSubscriptionEnabled: true,
|
|
42
|
+
sessionStartEventsEnabled: true,
|
|
43
|
+
sessionEndEventsEnabled: true,
|
|
44
|
+
},
|
|
45
|
+
sessionDurationSeconds: 30 * 60, // Android 2.9.4+, iOS 2.7.0+
|
|
46
|
+
})
|
|
47
|
+
.then(() => console.log('Reteno initialized'))
|
|
48
|
+
.catch((err) => console.error('init: ERROR', err));
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Options reference
|
|
53
|
+
|
|
54
|
+
All fields are optional.
|
|
55
|
+
|
|
56
|
+
| Option | Type | iOS | Android | Notes |
|
|
57
|
+
|---|---|:---:|:---:|---|
|
|
58
|
+
| `accessKey` | `string` | ✅ | ✅ | Overrides `RETENO_ACCESS_KEY` (or legacy `SDK_ACCESS_KEY`) from `config.xml`. Usually not needed — see "Access key" below. |
|
|
59
|
+
| `isDebugMode` | `boolean` | ✅ | ✅ | Enables near real-time event monitoring. Use only on test devices. |
|
|
60
|
+
| `pauseInAppMessages` | `boolean` | ✅ | ✅ | Start the SDK with in-app messages paused. |
|
|
61
|
+
| `pausePushInAppMessages` | `boolean` | — | ✅ | Android-only. Safe to pass on iOS (ignored). |
|
|
62
|
+
| `inAppMessagesPauseBehaviour` | `'SKIP_IN_APPS' \| 'POSTPONE_IN_APPS'` | ✅ | — | iOS-only via `init()`. On Android use [`setInAppMessagesPauseBehaviour`](../InAppMessages/README.md) at runtime. |
|
|
63
|
+
| `isAutomaticScreenReportingEnabled` | `boolean` | ✅ | — | iOS-only. Not recommended in Cordova — use `logScreenView()` manually. |
|
|
64
|
+
| `lifecycleTrackingOptions` | `object \| 'ALL' \| 'NONE'` | ✅ | ✅ | See [App Lifecycle Events](../AppLifeCycleEvents/README.md). iOS: only via `init()`. |
|
|
65
|
+
| `sessionDurationSeconds` | `number` | ✅ | ✅ | Optional session reset duration (Android 2.9.4+, iOS 2.7.0+). |
|
|
66
|
+
|
|
67
|
+
### Access key
|
|
68
|
+
|
|
69
|
+
Recommended: set `RETENO_ACCESS_KEY` in `config.xml` (or via `cordova plugin add --variable RETENO_ACCESS_KEY=...`). The plugin reads it automatically — **no need to pass `accessKey` in JS**. The deprecated `SDK_ACCESS_KEY` name remains supported for backward compatibility.
|
|
70
|
+
|
|
71
|
+
Only pass `accessKey` in `init()` when you need to override the value from `config.xml` at runtime.
|
|
72
|
+
|
|
73
|
+
### Calling `init()` multiple times
|
|
74
|
+
|
|
75
|
+
`init()` is idempotent — the plugin caches the first successful initialization and subsequent calls resolve immediately without re-initializing the native SDK. Options passed to later calls are ignored.
|
|
76
|
+
|
|
77
|
+
## Feature guides
|
|
78
|
+
|
|
79
|
+
- [Tracking user information](../Tracking%20user%20information/README.md)
|
|
80
|
+
- [Tracking user behaviour](../Tracking%20user%20behaviour/README.md)
|
|
81
|
+
- [Push notification](../Push%20notification/README.md)
|
|
82
|
+
- [In app messages](../InAppMessages/README.md)
|
|
83
|
+
- [Ecommerce](../Ecommerce/README.md)
|
|
84
|
+
- [Recommendations](../Recommendations/README.md)
|
|
85
|
+
- [App inbox](../AppInbox/README.md)
|
|
86
|
+
- [Action Buttons](../Action%20Buttons/README.md)
|
|
87
|
+
- [App Lifecycle Events](../AppLifeCycleEvents/README.md)
|
|
88
|
+
|
|
89
|
+
##### Licence
|
|
90
|
+
|
|
91
|
+
Reteno Cordova Plugin is released under the MIT license. See [LICENSE](https://github.com/reteno-com/reteno-cordova/blob/main/LICENSE) for details.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Tracking user behaviour
|
|
2
|
+
|
|
3
|
+
## Track custom events
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
RetenoPlugin.logEvent({
|
|
7
|
+
eventName: 'EVENT_NAME',
|
|
8
|
+
date: new Date().toISOString(), // optional ISO8601
|
|
9
|
+
parameters: [
|
|
10
|
+
{ name: 'Additional parameter', value: 'Additional value' },
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
.then(() => console.log('logEvent: OK'))
|
|
14
|
+
.catch((err) => console.error('logEvent: ERROR', err));
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Parameter item type:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
type CustomEventParameter = {
|
|
21
|
+
name: string;
|
|
22
|
+
value?: string;
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Force push cached data
|
|
27
|
+
|
|
28
|
+
Reteno caches events locally. Use `forcePushData` to sync immediately:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
RetenoPlugin.forcePushData()
|
|
32
|
+
.then(() => console.log('forcePushData: OK'))
|
|
33
|
+
.catch((err) => console.error('forcePushData: ERROR', err));
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
On iOS this uses a technical `logEvent(..., forcePush: true)` call under the hood.
|
|
37
|
+
|
|
38
|
+
## Log screen view events
|
|
39
|
+
|
|
40
|
+
For Cordova/WebView apps, manual screen tracking is recommended:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
RetenoPlugin.logScreenView('HomeScreen')
|
|
44
|
+
.then(() => console.log('logScreenView: OK'))
|
|
45
|
+
.catch((err) => console.error('logScreenView: ERROR', err));
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Lifecycle tracking options
|
|
49
|
+
|
|
50
|
+
Lifecycle tracking configuration and examples are documented in:
|
|
51
|
+
|
|
52
|
+
- [AppLifeCycleEvents/README.md](../AppLifeCycleEvents/README.md)
|