react-native-notify-sphere 1.0.0 → 1.1.0
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 +1080 -15
- package/android/src/main/AndroidManifest.xml +8 -1
- package/android/src/main/java/com/notifysphere/NotifySphereModule.kt +0 -6
- package/ios/NotifySphere.mm +0 -6
- package/lib/module/NativeNotifySphere.js +11 -0
- package/lib/module/NativeNotifySphere.js.map +1 -1
- package/lib/module/index.js +463 -105
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeNotifySphere.d.ts +11 -1
- package/lib/typescript/src/NativeNotifySphere.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +213 -25
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +9 -11
- package/src/NativeNotifySphere.ts +12 -3
- package/src/index.tsx +670 -154
package/README.md
CHANGED
|
@@ -1,37 +1,1102 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NotifySphere Push Notifications Implementation Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Complete implementation guide for integrating **react-native-notify-sphere** push notifications in React Native Android/iOS applications.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Overview](#overview)
|
|
10
|
+
2. [Prerequisites](#prerequisites)
|
|
11
|
+
3. [Installation](#installation)
|
|
12
|
+
4. [Android Setup](#android-setup)
|
|
13
|
+
5. [iOS Setup](#ios-setup)
|
|
14
|
+
6. [Implementation](#implementation)
|
|
15
|
+
7. [NotifySphere Admin Panel](#notifysphere-admin-panel)
|
|
16
|
+
8. [Testing](#testing)
|
|
17
|
+
9. [Troubleshooting](#troubleshooting)
|
|
18
|
+
10. [Advanced Features](#advanced-features)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
### What is NotifySphere?
|
|
25
|
+
|
|
26
|
+
NotifySphere is a custom push notification solution built on top of Firebase Cloud Messaging (FCM) and Notifee, providing:
|
|
27
|
+
|
|
28
|
+
- **Centralized Management**: Admin panel for sending notifications
|
|
29
|
+
- **User Segmentation**: Target users with custom tags
|
|
30
|
+
- **Analytics**: Track delivery, opens, and engagement
|
|
31
|
+
- **Rich Notifications**: Support for images, sounds, and custom actions
|
|
32
|
+
- **Cross-Platform**: Works on both Android and iOS
|
|
33
|
+
|
|
34
|
+
### Architecture
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
┌─────────────────────────────────────────────┐
|
|
38
|
+
│ NotifySphere Admin Panel │
|
|
39
|
+
│ • Send Notifications │
|
|
40
|
+
│ • Manage User Segments │
|
|
41
|
+
│ • View Analytics & Reports │
|
|
42
|
+
└──────────────┬──────────────────────────────┘
|
|
43
|
+
│
|
|
44
|
+
▼
|
|
45
|
+
┌─────────────────────────────────────────────┐
|
|
46
|
+
│ NotifySphere Backend API │
|
|
47
|
+
│ (notifysphere.dothejob.in:3008) │
|
|
48
|
+
│ • User Registration & Token Management │
|
|
49
|
+
│ • Tag-based Segmentation │
|
|
50
|
+
│ • Notification Delivery via Firebase │
|
|
51
|
+
└──────────────┬──────────────────────────────┘
|
|
52
|
+
│
|
|
53
|
+
▼
|
|
54
|
+
┌─────────────────────────────────────────────┐
|
|
55
|
+
│ Firebase Cloud Messaging (FCM) │
|
|
56
|
+
│ • Push Notification Delivery │
|
|
57
|
+
│ • Device Token Management │
|
|
58
|
+
└──────────────┬──────────────────────────────┘
|
|
59
|
+
│
|
|
60
|
+
▼
|
|
61
|
+
┌─────────────────────────────────────────────┐
|
|
62
|
+
│ Your React Native App │
|
|
63
|
+
│ • react-native-notify-sphere │
|
|
64
|
+
│ • @react-native-firebase/messaging │
|
|
65
|
+
│ • @notifee/react-native │
|
|
66
|
+
└─────────────────────────────────────────────┘
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Prerequisites
|
|
72
|
+
|
|
73
|
+
### Required Tools
|
|
74
|
+
|
|
75
|
+
- **Node.js**: v16 or higher
|
|
76
|
+
- **React Native**: v0.70+
|
|
77
|
+
- **Android Studio**: Latest version (for Android development)
|
|
78
|
+
- **Xcode**: Latest version (for iOS development)
|
|
79
|
+
- **CocoaPods**: Latest version (for iOS dependencies)
|
|
80
|
+
|
|
81
|
+
### Firebase Project
|
|
82
|
+
|
|
83
|
+
1. Create/Select project at [Firebase Console](https://console.firebase.google.com)
|
|
84
|
+
2. Enable **Cloud Messaging**
|
|
85
|
+
3. Download configuration files:
|
|
86
|
+
- **Android**: `google-services.json`
|
|
87
|
+
- **iOS**: `GoogleService-Info.plist`
|
|
88
|
+
4. Get **Firebase Server Key**:
|
|
89
|
+
- Firebase Console → Project Settings → Cloud Messaging → Server Key
|
|
90
|
+
|
|
91
|
+
### NotifySphere Account
|
|
92
|
+
|
|
93
|
+
1. Access NotifySphere Admin Panel (contact provider for credentials)
|
|
94
|
+
2. Create new application
|
|
95
|
+
3. Obtain **App ID** (UUID format, e.g., `123b13cc-7dcb-2dcc-8dde-565433ec8d40`)
|
|
96
|
+
|
|
97
|
+
---
|
|
4
98
|
|
|
5
99
|
## Installation
|
|
6
100
|
|
|
101
|
+
### Step 1: Install Packages
|
|
7
102
|
|
|
8
|
-
```
|
|
103
|
+
```bash
|
|
104
|
+
# Core NotifySphere package
|
|
9
105
|
npm install react-native-notify-sphere
|
|
106
|
+
|
|
107
|
+
# Required Firebase packages
|
|
108
|
+
npm install @react-native-firebase/app@22.4.0
|
|
109
|
+
npm install @react-native-firebase/messaging@22.4.0
|
|
110
|
+
|
|
111
|
+
# Notifee for local notifications
|
|
112
|
+
npm install @notifee/react-native@9.1.8
|
|
113
|
+
|
|
114
|
+
# Additional dependencies
|
|
115
|
+
npm install react-native-localize
|
|
116
|
+
npm install react-native-device-info
|
|
117
|
+
npm install axios
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Step 2: Link Native Dependencies
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# iOS only - Install pods
|
|
124
|
+
cd ios && pod install && cd ..
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 3: Verify Installation
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Check if packages are installed
|
|
131
|
+
npm list react-native-notify-sphere @react-native-firebase/messaging @notifee/react-native
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Android Setup
|
|
137
|
+
|
|
138
|
+
### Step 1: Add Firebase Configuration
|
|
139
|
+
|
|
140
|
+
**File Location**: `android/app/google-services.json`
|
|
141
|
+
|
|
142
|
+
1. Download `google-services.json` from Firebase Console
|
|
143
|
+
2. Place file in `android/app/` directory
|
|
144
|
+
|
|
145
|
+
### Step 2: Configure Gradle Files
|
|
146
|
+
|
|
147
|
+
#### Root build.gradle
|
|
148
|
+
|
|
149
|
+
**File**: `android/build.gradle`
|
|
150
|
+
|
|
151
|
+
```gradle
|
|
152
|
+
buildscript {
|
|
153
|
+
dependencies {
|
|
154
|
+
// ... other dependencies
|
|
155
|
+
|
|
156
|
+
// Add Google Services plugin
|
|
157
|
+
classpath 'com.google.gms:google-services:4.4.0'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### App build.gradle
|
|
163
|
+
|
|
164
|
+
**File**: `android/app/build.gradle`
|
|
165
|
+
|
|
166
|
+
```gradle
|
|
167
|
+
apply plugin: "com.android.application"
|
|
168
|
+
apply plugin: "com.facebook.react"
|
|
169
|
+
|
|
170
|
+
// ... other configurations
|
|
171
|
+
|
|
172
|
+
android {
|
|
173
|
+
// ... android config
|
|
174
|
+
|
|
175
|
+
// Add packaging options to avoid conflicts
|
|
176
|
+
packagingOptions {
|
|
177
|
+
pickFirst 'lib/x86/libc++_shared.so'
|
|
178
|
+
pickFirst 'lib/x86_64/libc++_shared.so'
|
|
179
|
+
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
|
|
180
|
+
pickFirst 'lib/arm64-v8a/libc++_shared.so'
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
dependencies {
|
|
185
|
+
// ... dependencies
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// IMPORTANT: Apply Google Services plugin at the very bottom (last line)
|
|
189
|
+
apply plugin: 'com.google.gms.google-services'
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Step 3: Update AndroidManifest.xml
|
|
193
|
+
|
|
194
|
+
**File**: `android/app/src/main/AndroidManifest.xml`
|
|
195
|
+
|
|
196
|
+
```xml
|
|
197
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
198
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
199
|
+
package="com.yourapp.package">
|
|
200
|
+
|
|
201
|
+
<!-- Notification Permissions -->
|
|
202
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
203
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
204
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
205
|
+
|
|
206
|
+
<application
|
|
207
|
+
android:name=".MainApplication"
|
|
208
|
+
android:allowBackup="false"
|
|
209
|
+
android:theme="@style/AppTheme">
|
|
210
|
+
|
|
211
|
+
<!-- Firebase Notification Icon -->
|
|
212
|
+
<meta-data
|
|
213
|
+
android:name="com.google.firebase.messaging.default_notification_icon"
|
|
214
|
+
android:resource="@drawable/ic_stat_notification"
|
|
215
|
+
tools:replace="android:resource" />
|
|
216
|
+
|
|
217
|
+
<!-- Notification Color -->
|
|
218
|
+
<meta-data
|
|
219
|
+
android:name="com.google.firebase.messaging.default_notification_color"
|
|
220
|
+
android:resource="@color/notification_color"
|
|
221
|
+
tools:replace="android:resource" />
|
|
222
|
+
|
|
223
|
+
<!-- Default Notification Channel -->
|
|
224
|
+
<meta-data
|
|
225
|
+
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
|
226
|
+
android:value="default_notification_channel"
|
|
227
|
+
tools:replace="android:value" />
|
|
228
|
+
|
|
229
|
+
<!-- Your Activities -->
|
|
230
|
+
<activity
|
|
231
|
+
android:name=".MainActivity"
|
|
232
|
+
android:exported="true">
|
|
233
|
+
<!-- ... intent filters ... -->
|
|
234
|
+
</activity>
|
|
235
|
+
|
|
236
|
+
</application>
|
|
237
|
+
</manifest>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Step 4: Create Resource Files
|
|
241
|
+
|
|
242
|
+
#### Colors
|
|
243
|
+
|
|
244
|
+
**File**: `android/app/src/main/res/values/colors.xml`
|
|
245
|
+
|
|
246
|
+
```xml
|
|
247
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
248
|
+
<resources>
|
|
249
|
+
<color name="notification_color">#FF6B6B</color>
|
|
250
|
+
<color name="ic_launcher_background">#FFFFFF</color>
|
|
251
|
+
<color name="white">#FFFFFF</color>
|
|
252
|
+
<color name="black">#000000</color>
|
|
253
|
+
</resources>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### Strings
|
|
257
|
+
|
|
258
|
+
**File**: `android/app/src/main/res/values/strings.xml`
|
|
259
|
+
|
|
260
|
+
```xml
|
|
261
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
262
|
+
<resources>
|
|
263
|
+
<string name="app_name">Your App Name</string>
|
|
264
|
+
</resources>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### Styles
|
|
268
|
+
|
|
269
|
+
**File**: `android/app/src/main/res/values/styles.xml`
|
|
270
|
+
|
|
271
|
+
```xml
|
|
272
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
273
|
+
<resources>
|
|
274
|
+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
275
|
+
<item name="android:textColor">#000000</item>
|
|
276
|
+
</style>
|
|
277
|
+
</resources>
|
|
10
278
|
```
|
|
11
279
|
|
|
280
|
+
### Step 5: Add Notification Icon
|
|
281
|
+
|
|
282
|
+
Create a notification icon and place it in:
|
|
283
|
+
- `android/app/src/main/res/drawable/ic_stat_notification.png`
|
|
284
|
+
|
|
285
|
+
Or use an existing icon in your project.
|
|
12
286
|
|
|
13
|
-
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## iOS Setup
|
|
14
290
|
|
|
291
|
+
### Step 1: Add Firebase Configuration
|
|
15
292
|
|
|
16
|
-
|
|
17
|
-
|
|
293
|
+
1. Download `GoogleService-Info.plist` from Firebase Console
|
|
294
|
+
2. Open Xcode: `open ios/YourApp.xcworkspace`
|
|
295
|
+
3. Drag and drop `GoogleService-Info.plist` into Xcode project
|
|
296
|
+
4. Ensure "Copy items if needed" is checked
|
|
297
|
+
5. Add to all targets
|
|
18
298
|
|
|
19
|
-
|
|
299
|
+
### Step 2: Install CocoaPods
|
|
20
300
|
|
|
21
|
-
|
|
301
|
+
```bash
|
|
302
|
+
cd ios
|
|
303
|
+
pod install
|
|
304
|
+
cd ..
|
|
22
305
|
```
|
|
23
306
|
|
|
307
|
+
### Step 3: Enable Capabilities in Xcode
|
|
308
|
+
|
|
309
|
+
1. Open `ios/YourApp.xcworkspace` in Xcode
|
|
310
|
+
2. Select Project → Target → **Signing & Capabilities**
|
|
311
|
+
3. Click **+ Capability**
|
|
312
|
+
4. Add **"Push Notifications"**
|
|
313
|
+
5. Click **+ Capability** again
|
|
314
|
+
6. Add **"Background Modes"**
|
|
315
|
+
- Check: ☑️ **Remote notifications**
|
|
316
|
+
|
|
317
|
+
### Step 4: Update AppDelegate
|
|
318
|
+
|
|
319
|
+
**File**: `ios/YourApp/AppDelegate.mm` (or `AppDelegate.m`)
|
|
320
|
+
|
|
321
|
+
#### Add Imports
|
|
322
|
+
|
|
323
|
+
```objc
|
|
324
|
+
#import <Firebase.h>
|
|
325
|
+
#import <UserNotifications/UserNotifications.h>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### Update didFinishLaunchingWithOptions
|
|
329
|
+
|
|
330
|
+
```objc
|
|
331
|
+
- (BOOL)application:(UIApplication *)application
|
|
332
|
+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
333
|
+
{
|
|
334
|
+
// Initialize Firebase
|
|
335
|
+
if ([FIRApp defaultApp] == nil) {
|
|
336
|
+
[FIRApp configure];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Set up notification center
|
|
340
|
+
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
|
341
|
+
center.delegate = self;
|
|
342
|
+
|
|
343
|
+
// ... rest of your existing code
|
|
344
|
+
|
|
345
|
+
return YES;
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### Add Notification Handler Methods
|
|
350
|
+
|
|
351
|
+
```objc
|
|
352
|
+
// Handle foreground notifications
|
|
353
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
354
|
+
willPresentNotification:(UNNotification *)notification
|
|
355
|
+
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
|
|
356
|
+
{
|
|
357
|
+
completionHandler(UNNotificationPresentationOptionSound |
|
|
358
|
+
UNNotificationPresentationOptionAlert |
|
|
359
|
+
UNNotificationPresentationOptionBadge);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Handle notification tap
|
|
363
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
364
|
+
didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|
365
|
+
withCompletionHandler:(void(^)(void))completionHandler
|
|
366
|
+
{
|
|
367
|
+
completionHandler();
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Implementation
|
|
374
|
+
|
|
375
|
+
### Step 1: Create NotificationHelper Component
|
|
376
|
+
|
|
377
|
+
**File**: `src/utils/NotificationHelper.tsx`
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
import { useEffect, useCallback } from 'react';
|
|
381
|
+
import { Platform } from 'react-native';
|
|
382
|
+
import NotifySphere from 'react-native-notify-sphere';
|
|
383
|
+
import { useNavigation } from '@react-navigation/native';
|
|
384
|
+
|
|
385
|
+
interface Props {
|
|
386
|
+
navigationRef?: any;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export let deviceInfo: any = {};
|
|
390
|
+
|
|
391
|
+
const NotificationHelper: React.FC<Props> = (props) => {
|
|
392
|
+
const navigation = useNavigation();
|
|
393
|
+
|
|
394
|
+
// Handle notification click
|
|
395
|
+
const onClickNotification = useCallback(
|
|
396
|
+
(notificationData: any, type?: string) => {
|
|
397
|
+
console.log('📬 Notification Clicked');
|
|
398
|
+
console.log('Type:', type);
|
|
399
|
+
console.log('Data:', notificationData);
|
|
400
|
+
|
|
401
|
+
const data = notificationData?.data || {};
|
|
402
|
+
const action = data?.redirect_action;
|
|
403
|
+
|
|
404
|
+
// Navigate based on action
|
|
405
|
+
switch (action) {
|
|
406
|
+
case 'home':
|
|
407
|
+
navigation.navigate('Home');
|
|
408
|
+
break;
|
|
409
|
+
|
|
410
|
+
case 'profile':
|
|
411
|
+
navigation.navigate('Profile');
|
|
412
|
+
break;
|
|
413
|
+
|
|
414
|
+
case 'details':
|
|
415
|
+
if (data?.itemId) {
|
|
416
|
+
navigation.navigate('Details', { id: data.itemId });
|
|
417
|
+
}
|
|
418
|
+
break;
|
|
419
|
+
|
|
420
|
+
default:
|
|
421
|
+
// Default navigation
|
|
422
|
+
console.log('No specific action, staying on current screen');
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
[navigation]
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
useEffect(() => {
|
|
430
|
+
const initializeNotifications = async () => {
|
|
431
|
+
try {
|
|
432
|
+
console.log('🔥 Initializing NotifySphere...');
|
|
433
|
+
|
|
434
|
+
// Get user information (replace with your actual user data)
|
|
435
|
+
const userId = 12345; // Your user ID
|
|
436
|
+
const userName = 'John Doe';
|
|
437
|
+
const userEmail = 'john@example.com';
|
|
438
|
+
const userPhone = 9876543210;
|
|
439
|
+
|
|
440
|
+
// Initialize NotifySphere
|
|
441
|
+
const subscriptionId = await NotifySphere.initialize({
|
|
442
|
+
applicationUserId: userId,
|
|
443
|
+
type: Platform.OS === 'android' ? 'AndroidPush' : 'IOSPush',
|
|
444
|
+
name: userName,
|
|
445
|
+
email: userEmail,
|
|
446
|
+
appId: 'YOUR_NOTIFYSPHERE_APP_ID', // Replace with your App ID
|
|
447
|
+
phone: userPhone,
|
|
448
|
+
lat: '26.9124', // Optional: User latitude
|
|
449
|
+
long: '75.7873', // Optional: User longitude
|
|
450
|
+
city: 'Jaipur', // Optional: User city
|
|
451
|
+
state: 'Rajasthan', // Optional: User state
|
|
452
|
+
tags: {
|
|
453
|
+
userType: 'customer',
|
|
454
|
+
premium: 'true',
|
|
455
|
+
// Add your custom tags
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
console.log('✅ NotifySphere Initialized!');
|
|
460
|
+
console.log('Subscription ID:', subscriptionId);
|
|
461
|
+
|
|
462
|
+
// Store subscription ID
|
|
463
|
+
deviceInfo.userId = subscriptionId;
|
|
464
|
+
|
|
465
|
+
// Update tags (optional - for better targeting)
|
|
466
|
+
NotifySphere.updateTags({
|
|
467
|
+
appId: 'YOUR_NOTIFYSPHERE_APP_ID',
|
|
468
|
+
applicationUserId: userId,
|
|
469
|
+
type: Platform.OS === 'android' ? 'AndroidPush' : 'IOSPush',
|
|
470
|
+
tags: {
|
|
471
|
+
lastLogin: new Date().toISOString(),
|
|
472
|
+
appVersion: '1.0.0',
|
|
473
|
+
// Add more tags as needed
|
|
474
|
+
},
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
// Set notification callback
|
|
478
|
+
NotifySphere.onNotification((notification, type) => {
|
|
479
|
+
console.log('🔔 Notification Callback Triggered');
|
|
480
|
+
console.log('Type:', type); // 'opened', 'initial', 'press'
|
|
481
|
+
|
|
482
|
+
// Handle notification
|
|
483
|
+
onClickNotification(notification, type);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
console.log('✅ Notification handlers registered!');
|
|
487
|
+
|
|
488
|
+
} catch (error) {
|
|
489
|
+
console.error('❌ NotifySphere Error:', error);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
initializeNotifications();
|
|
494
|
+
}, [onClickNotification]);
|
|
495
|
+
|
|
496
|
+
return null;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export default NotificationHelper;
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Step 2: Add to Your App
|
|
503
|
+
|
|
504
|
+
**File**: `App.tsx`
|
|
505
|
+
|
|
506
|
+
```typescript
|
|
507
|
+
import React from 'react';
|
|
508
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
509
|
+
import { Provider } from 'react-redux';
|
|
510
|
+
import NotificationHelper from './src/utils/NotificationHelper';
|
|
511
|
+
import store from './src/redux/store';
|
|
512
|
+
|
|
513
|
+
const App = () => {
|
|
514
|
+
return (
|
|
515
|
+
<Provider store={store}>
|
|
516
|
+
<NavigationContainer>
|
|
517
|
+
{/* Your navigation stack */}
|
|
518
|
+
<YourNavigationStack />
|
|
519
|
+
|
|
520
|
+
{/* Add NotificationHelper */}
|
|
521
|
+
<NotificationHelper />
|
|
522
|
+
</NavigationContainer>
|
|
523
|
+
</Provider>
|
|
524
|
+
);
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export default App;
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Step 3: Replace App ID
|
|
531
|
+
|
|
532
|
+
In `NotificationHelper.tsx`, replace:
|
|
533
|
+
```typescript
|
|
534
|
+
appId: 'YOUR_NOTIFYSPHERE_APP_ID'
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
With your actual NotifySphere App ID from the admin panel.
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## NotifySphere Admin Panel
|
|
542
|
+
|
|
543
|
+
### Step 1: Create Application
|
|
544
|
+
|
|
545
|
+
1. **Login** to NotifySphere Admin Panel
|
|
546
|
+
2. Click **"Create New App"**
|
|
547
|
+
3. Fill in details:
|
|
548
|
+
- **App Name**: Your application name
|
|
549
|
+
- **Platform**: Select Android and/or iOS
|
|
550
|
+
- **Package Name**: Your app's package name
|
|
551
|
+
4. Click **Save**
|
|
552
|
+
5. **Copy the App ID** (UUID format)
|
|
553
|
+
|
|
554
|
+
### Step 2: Configure Firebase
|
|
555
|
+
|
|
556
|
+
1. Go to your app's settings in NotifySphere Admin
|
|
557
|
+
2. Click **"Firebase Configuration"**
|
|
558
|
+
3. Add **Firebase Server Key**:
|
|
559
|
+
- Get from: Firebase Console → Project Settings → Cloud Messaging → Server Key
|
|
560
|
+
4. Save configuration
|
|
561
|
+
|
|
562
|
+
### Step 3: Test Setup
|
|
563
|
+
|
|
564
|
+
1. Go to **"Send Notification"** in admin panel
|
|
565
|
+
2. Select your app
|
|
566
|
+
3. Fill in basic details:
|
|
567
|
+
- **Title**: Test Notification
|
|
568
|
+
- **Body**: This is a test message
|
|
569
|
+
4. Click **Send**
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Testing
|
|
574
|
+
|
|
575
|
+
### Method 1: Via NotifySphere Admin Panel
|
|
576
|
+
|
|
577
|
+
**Recommended for production testing**
|
|
578
|
+
|
|
579
|
+
1. Login to NotifySphere Admin Panel
|
|
580
|
+
2. Navigate to **"Send Notification"**
|
|
581
|
+
3. Select your application
|
|
582
|
+
4. Configure notification:
|
|
583
|
+
|
|
584
|
+
```json
|
|
585
|
+
{
|
|
586
|
+
"title": "New Message",
|
|
587
|
+
"body": "You have received a new message!",
|
|
588
|
+
"data": {
|
|
589
|
+
"redirect_action": "details",
|
|
590
|
+
"itemId": "123",
|
|
591
|
+
"type": "message"
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
5. Target:
|
|
597
|
+
- **All Users**: Send to everyone
|
|
598
|
+
- **By Tags**: Target specific user segments
|
|
599
|
+
- **Specific Users**: Enter user IDs
|
|
600
|
+
|
|
601
|
+
6. Click **Send**
|
|
24
602
|
|
|
25
|
-
|
|
603
|
+
### Method 2: Via Firebase Console
|
|
26
604
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
605
|
+
**Good for quick testing**
|
|
606
|
+
|
|
607
|
+
1. Go to [Firebase Console](https://console.firebase.google.com)
|
|
608
|
+
2. Select your project
|
|
609
|
+
3. Navigate to **Cloud Messaging** → **Send your first message**
|
|
610
|
+
4. Click **"Send test message"**
|
|
611
|
+
5. Get FCM token from app logs:
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
# Android
|
|
615
|
+
npx react-native log-android | grep "fcmToken"
|
|
616
|
+
|
|
617
|
+
# iOS
|
|
618
|
+
npx react-native log-ios | grep "fcmToken"
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
6. Paste token and click **Test**
|
|
622
|
+
|
|
623
|
+
### Method 3: Via Postman/API
|
|
624
|
+
|
|
625
|
+
**For automated testing**
|
|
626
|
+
|
|
627
|
+
```http
|
|
628
|
+
POST https://fcm.googleapis.com/fcm/send
|
|
629
|
+
Content-Type: application/json
|
|
630
|
+
Authorization: key=YOUR_FIREBASE_SERVER_KEY
|
|
631
|
+
|
|
632
|
+
{
|
|
633
|
+
"to": "DEVICE_FCM_TOKEN",
|
|
634
|
+
"notification": {
|
|
635
|
+
"title": "Test Notification",
|
|
636
|
+
"body": "Testing push notifications"
|
|
637
|
+
},
|
|
638
|
+
"data": {
|
|
639
|
+
"redirect_action": "home",
|
|
640
|
+
"customKey": "customValue"
|
|
641
|
+
},
|
|
642
|
+
"android": {
|
|
643
|
+
"priority": "high"
|
|
644
|
+
},
|
|
645
|
+
"apns": {
|
|
646
|
+
"headers": {
|
|
647
|
+
"apns-priority": "10"
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
### Test Scenarios
|
|
654
|
+
|
|
655
|
+
#### ✅ Foreground Testing (App Open)
|
|
656
|
+
|
|
657
|
+
**Expected Behavior:**
|
|
658
|
+
- Notification displays as banner/head-up notification
|
|
659
|
+
- Sound plays (if configured)
|
|
660
|
+
- Vibration occurs (if configured)
|
|
661
|
+
- Tapping navigates to specified screen
|
|
662
|
+
|
|
663
|
+
**Verification:**
|
|
664
|
+
```bash
|
|
665
|
+
npx react-native log-android | grep "displayLocalNotification"
|
|
666
|
+
# Should see: "✅ NOTIFICATION DISPLAYED SUCCESSFULLY!"
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
#### ✅ Background Testing (App Minimized)
|
|
670
|
+
|
|
671
|
+
**Expected Behavior:**
|
|
672
|
+
- Notification appears in notification tray
|
|
673
|
+
- Tapping opens app
|
|
674
|
+
- Navigation occurs after app opens
|
|
675
|
+
|
|
676
|
+
#### ✅ Killed State Testing (App Closed)
|
|
677
|
+
|
|
678
|
+
**Expected Behavior:**
|
|
679
|
+
- Notification appears in notification tray
|
|
680
|
+
- Tapping launches app
|
|
681
|
+
- Navigation occurs after app launches
|
|
682
|
+
|
|
683
|
+
**Verification:**
|
|
684
|
+
```bash
|
|
685
|
+
npx react-native log-android | grep "Notification Callback"
|
|
686
|
+
# Should see: Type: 'initial' or 'opened'
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
## Troubleshooting
|
|
692
|
+
|
|
693
|
+
### Common Issues
|
|
694
|
+
|
|
695
|
+
#### Issue: "No FCM Token Received"
|
|
696
|
+
|
|
697
|
+
**Symptoms:**
|
|
698
|
+
- No token in logs
|
|
699
|
+
- Notifications not received
|
|
700
|
+
|
|
701
|
+
**Solutions:**
|
|
702
|
+
|
|
703
|
+
1. **Check Firebase Configuration:**
|
|
704
|
+
```bash
|
|
705
|
+
# Android
|
|
706
|
+
ls -la android/app/google-services.json
|
|
707
|
+
|
|
708
|
+
# iOS
|
|
709
|
+
ls -la ios/GoogleService-Info.plist
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
2. **Verify Google Services Plugin:**
|
|
713
|
+
```bash
|
|
714
|
+
cat android/app/build.gradle | grep "google-services"
|
|
715
|
+
# Should be at the very bottom of the file
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
3. **Check Permissions:**
|
|
719
|
+
```bash
|
|
720
|
+
# Android - Check if permission granted
|
|
721
|
+
adb shell dumpsys package com.yourapp.package | grep "POST_NOTIFICATIONS"
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
#### Issue: "Foreground Notifications Not Displaying"
|
|
725
|
+
|
|
726
|
+
**Error in logs:**
|
|
727
|
+
```
|
|
728
|
+
❌ ERROR in displayLocalNotification
|
|
729
|
+
Error: largeIcon expected a valid string URL
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
**Solution:**
|
|
733
|
+
|
|
734
|
+
The package has a known issue with empty `largeIcon` field. Fix by editing package:
|
|
735
|
+
|
|
736
|
+
```bash
|
|
737
|
+
code node_modules/react-native-notify-sphere/src/index.tsx
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
Find `displayLocalNotification` function and update:
|
|
741
|
+
|
|
742
|
+
```typescript
|
|
743
|
+
// Validate largeIcon before using
|
|
744
|
+
const largeIconRaw = remoteMessage.data?.largeIcon;
|
|
745
|
+
const validLargeIcon = largeIconRaw && largeIconRaw.trim() !== ''
|
|
746
|
+
? largeIconRaw
|
|
747
|
+
: undefined;
|
|
748
|
+
|
|
749
|
+
// Only add if valid
|
|
750
|
+
if (validLargeIcon) {
|
|
751
|
+
notificationConfig.android.largeIcon = validLargeIcon;
|
|
752
|
+
}
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
#### Issue: "App Crashes on Notification"
|
|
756
|
+
|
|
757
|
+
**Symptoms:**
|
|
758
|
+
- App crashes when notification received
|
|
759
|
+
- No error in React Native logs
|
|
760
|
+
|
|
761
|
+
**Solutions:**
|
|
762
|
+
|
|
763
|
+
1. **Check Native Logs:**
|
|
764
|
+
```bash
|
|
765
|
+
# Android
|
|
766
|
+
adb logcat | grep -i "error\|exception"
|
|
767
|
+
|
|
768
|
+
# iOS
|
|
769
|
+
# View in Xcode console
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
2. **Verify Channel Creation:**
|
|
773
|
+
```bash
|
|
774
|
+
npx react-native log-android | grep "Channel created"
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
3. **Check Sound Files:**
|
|
778
|
+
- Ensure custom sound files exist in `android/app/src/main/res/raw/`
|
|
779
|
+
- Use `default` sound if custom sound missing
|
|
780
|
+
|
|
781
|
+
#### Issue: "iOS Notifications Not Working"
|
|
782
|
+
|
|
783
|
+
**Common Causes:**
|
|
784
|
+
|
|
785
|
+
1. **Testing on Simulator:**
|
|
786
|
+
- Push notifications **DO NOT work** on iOS Simulator
|
|
787
|
+
- Must test on real device
|
|
788
|
+
|
|
789
|
+
2. **Missing Capabilities:**
|
|
790
|
+
- Xcode → Target → Signing & Capabilities
|
|
791
|
+
- Verify "Push Notifications" is enabled
|
|
792
|
+
- Verify "Background Modes" → "Remote notifications" is checked
|
|
793
|
+
|
|
794
|
+
3. **Firebase Not Initialized:**
|
|
795
|
+
```objc
|
|
796
|
+
// Check AppDelegate.mm
|
|
797
|
+
if ([FIRApp defaultApp] == nil) {
|
|
798
|
+
[FIRApp configure]; // Must be present
|
|
799
|
+
}
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
4. **Provisioning Profile:**
|
|
803
|
+
- Ensure push notifications are enabled in Apple Developer Portal
|
|
804
|
+
- Regenerate provisioning profile if needed
|
|
805
|
+
|
|
806
|
+
#### Issue: "Notification Data Not Received in Callback"
|
|
807
|
+
|
|
808
|
+
**Symptoms:**
|
|
809
|
+
- Notification displays
|
|
810
|
+
- Callback triggered
|
|
811
|
+
- But `data` object is empty
|
|
812
|
+
|
|
813
|
+
**Solution:**
|
|
814
|
+
|
|
815
|
+
Check notification payload structure:
|
|
816
|
+
|
|
817
|
+
```json
|
|
818
|
+
{
|
|
819
|
+
"notification": {
|
|
820
|
+
"title": "Title",
|
|
821
|
+
"body": "Body"
|
|
822
|
+
},
|
|
823
|
+
"data": {
|
|
824
|
+
"redirect_action": "home",
|
|
825
|
+
"itemId": "123"
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
Ensure `data` is separate from `notification` object.
|
|
831
|
+
|
|
832
|
+
### Debug Commands
|
|
833
|
+
|
|
834
|
+
```bash
|
|
835
|
+
# Android - View all logs
|
|
836
|
+
npx react-native log-android
|
|
837
|
+
|
|
838
|
+
# Android - Filter notification logs
|
|
839
|
+
npx react-native log-android | grep -E "NotifySphere|fcm|notification"
|
|
840
|
+
|
|
841
|
+
# iOS - View all logs
|
|
842
|
+
npx react-native log-ios
|
|
843
|
+
|
|
844
|
+
# iOS - Filter notification logs
|
|
845
|
+
npx react-native log-ios | grep -E "NotifySphere|Firebase|notification"
|
|
846
|
+
|
|
847
|
+
# Check app processes
|
|
848
|
+
adb shell ps | grep com.yourapp.package
|
|
849
|
+
|
|
850
|
+
# Kill app (Android)
|
|
851
|
+
adb shell am force-stop com.yourapp.package
|
|
852
|
+
|
|
853
|
+
# Clear app data (Android)
|
|
854
|
+
adb shell pm clear com.yourapp.package
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
---
|
|
858
|
+
|
|
859
|
+
## Advanced Features
|
|
860
|
+
|
|
861
|
+
### Custom Tags for User Segmentation
|
|
862
|
+
|
|
863
|
+
```typescript
|
|
864
|
+
NotifySphere.updateTags({
|
|
865
|
+
appId: 'YOUR_APP_ID',
|
|
866
|
+
applicationUserId: userId,
|
|
867
|
+
type: Platform.OS === 'android' ? 'AndroidPush' : 'IOSPush',
|
|
868
|
+
tags: {
|
|
869
|
+
// Demographic
|
|
870
|
+
age: '25-34',
|
|
871
|
+
gender: 'male',
|
|
872
|
+
location: 'New York',
|
|
873
|
+
|
|
874
|
+
// Behavioral
|
|
875
|
+
purchaseFrequency: 'high',
|
|
876
|
+
lastPurchase: '2024-01-01',
|
|
877
|
+
totalSpent: '5000',
|
|
878
|
+
|
|
879
|
+
// Engagement
|
|
880
|
+
appVersion: '2.1.0',
|
|
881
|
+
lastLogin: new Date().toISOString(),
|
|
882
|
+
notificationsEnabled: 'true',
|
|
883
|
+
|
|
884
|
+
// Custom
|
|
885
|
+
interests: 'sports,technology',
|
|
886
|
+
membershipLevel: 'premium',
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
### Rich Notifications with Images
|
|
892
|
+
|
|
893
|
+
Send from admin panel or API:
|
|
894
|
+
|
|
895
|
+
```json
|
|
896
|
+
{
|
|
897
|
+
"notification": {
|
|
898
|
+
"title": "New Product Launch",
|
|
899
|
+
"body": "Check out our latest collection!",
|
|
900
|
+
"image": "https://example.com/image.jpg"
|
|
901
|
+
},
|
|
902
|
+
"data": {
|
|
903
|
+
"redirect_action": "product_details",
|
|
904
|
+
"productId": "P123"
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
### Custom Sounds
|
|
910
|
+
|
|
911
|
+
**Android:**
|
|
912
|
+
|
|
913
|
+
1. Add sound file: `android/app/src/main/res/raw/custom_sound.mp3`
|
|
914
|
+
2. Send notification with sound:
|
|
915
|
+
|
|
916
|
+
```json
|
|
917
|
+
{
|
|
918
|
+
"data": {
|
|
919
|
+
"sound": "custom_sound"
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
**iOS:**
|
|
925
|
+
|
|
926
|
+
1. Add sound file to Xcode project
|
|
927
|
+
2. Ensure file is added to target
|
|
928
|
+
3. Send notification with sound in payload
|
|
929
|
+
|
|
930
|
+
### Action Buttons
|
|
931
|
+
|
|
932
|
+
```json
|
|
933
|
+
{
|
|
934
|
+
"data": {
|
|
935
|
+
"actionButtons": "[{\"title\":\"View\",\"pressAction\":{\"id\":\"view\"}},{\"title\":\"Dismiss\",\"pressAction\":{\"id\":\"dismiss\"}}]"
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
### Notification Scheduling
|
|
941
|
+
|
|
942
|
+
Currently, NotifySphere handles immediate delivery. For scheduled notifications, use the admin panel's scheduling feature or implement server-side scheduling.
|
|
943
|
+
|
|
944
|
+
### Analytics Tracking
|
|
945
|
+
|
|
946
|
+
NotifySphere automatically tracks:
|
|
947
|
+
- Notification delivery
|
|
948
|
+
- Open rates
|
|
949
|
+
- Click rates
|
|
950
|
+
- Device information
|
|
951
|
+
|
|
952
|
+
View in admin panel: **Analytics → Notification Reports**
|
|
953
|
+
|
|
954
|
+
---
|
|
955
|
+
|
|
956
|
+
## Best Practices
|
|
957
|
+
|
|
958
|
+
### 1. User Privacy
|
|
959
|
+
|
|
960
|
+
```typescript
|
|
961
|
+
// Request permission gracefully
|
|
962
|
+
const hasPermission = await NotifySphere.checkApplicationPermission();
|
|
963
|
+
|
|
964
|
+
if (!hasPermission) {
|
|
965
|
+
// Show explanation UI
|
|
966
|
+
showPermissionExplanation();
|
|
967
|
+
// Then request
|
|
968
|
+
await requestPermission();
|
|
969
|
+
}
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
### 2. Tag Management
|
|
973
|
+
|
|
974
|
+
```typescript
|
|
975
|
+
// Update tags when relevant data changes
|
|
976
|
+
useEffect(() => {
|
|
977
|
+
if (user.profileUpdated) {
|
|
978
|
+
NotifySphere.updateTags({
|
|
979
|
+
appId: APP_ID,
|
|
980
|
+
applicationUserId: user.id,
|
|
981
|
+
type: Platform.OS === 'android' ? 'AndroidPush' : 'IOSPush',
|
|
982
|
+
tags: {
|
|
983
|
+
profileComplete: 'true',
|
|
984
|
+
lastUpdated: new Date().toISOString(),
|
|
985
|
+
},
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
}, [user.profileUpdated]);
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
### 3. Error Handling
|
|
992
|
+
|
|
993
|
+
```typescript
|
|
994
|
+
try {
|
|
995
|
+
const subscriptionId = await NotifySphere.initialize({...});
|
|
996
|
+
|
|
997
|
+
if (!subscriptionId) {
|
|
998
|
+
// Handle initialization failure
|
|
999
|
+
logError('NotifySphere initialization failed');
|
|
1000
|
+
// Retry or fallback
|
|
1001
|
+
}
|
|
1002
|
+
} catch (error) {
|
|
1003
|
+
// Handle error gracefully
|
|
1004
|
+
logError('NotifySphere error:', error);
|
|
1005
|
+
// Show user-friendly message if needed
|
|
1006
|
+
}
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
### 4. Testing Checklist
|
|
1010
|
+
|
|
1011
|
+
- [ ] Test on real devices (iOS especially)
|
|
1012
|
+
- [ ] Test all notification states (foreground, background, killed)
|
|
1013
|
+
- [ ] Test navigation for each `redirect_action`
|
|
1014
|
+
- [ ] Test with different payload structures
|
|
1015
|
+
- [ ] Test with images
|
|
1016
|
+
- [ ] Test with custom sounds
|
|
1017
|
+
- [ ] Test user segmentation with tags
|
|
1018
|
+
- [ ] Verify analytics tracking
|
|
1019
|
+
- [ ] Test opt-out functionality
|
|
1020
|
+
|
|
1021
|
+
---
|
|
1022
|
+
|
|
1023
|
+
## Package Information
|
|
1024
|
+
|
|
1025
|
+
### Dependencies
|
|
1026
|
+
|
|
1027
|
+
```json
|
|
1028
|
+
{
|
|
1029
|
+
"react-native-notify-sphere": "^1.0.0",
|
|
1030
|
+
"@react-native-firebase/app": "22.4.0",
|
|
1031
|
+
"@react-native-firebase/messaging": "22.4.0",
|
|
1032
|
+
"@notifee/react-native": "9.1.8",
|
|
1033
|
+
"react-native-device-info": "latest",
|
|
1034
|
+
"react-native-localize": "latest",
|
|
1035
|
+
"axios": "latest"
|
|
1036
|
+
}
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### Package Features
|
|
1040
|
+
|
|
1041
|
+
- ✅ Automatic foreground notification display
|
|
1042
|
+
- ✅ Background notification handling
|
|
1043
|
+
- ✅ Notification tap handling
|
|
1044
|
+
- ✅ Custom tags for segmentation
|
|
1045
|
+
- ✅ Image support in notifications
|
|
1046
|
+
- ✅ Custom sound support
|
|
1047
|
+
- ✅ Analytics tracking
|
|
1048
|
+
- ✅ Action buttons support
|
|
1049
|
+
- ✅ Cross-platform (Android & iOS)
|
|
1050
|
+
|
|
1051
|
+
---
|
|
1052
|
+
|
|
1053
|
+
## Resources
|
|
1054
|
+
|
|
1055
|
+
### Documentation
|
|
1056
|
+
|
|
1057
|
+
- [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging)
|
|
1058
|
+
- [Notifee Documentation](https://notifee.app/react-native/docs/overview)
|
|
1059
|
+
- [React Native Firebase](https://rnfirebase.io/)
|
|
1060
|
+
|
|
1061
|
+
### Useful Commands
|
|
1062
|
+
|
|
1063
|
+
```bash
|
|
1064
|
+
# Clean build
|
|
1065
|
+
cd android && ./gradlew clean && cd ..
|
|
1066
|
+
rm -rf node_modules && npm install
|
|
1067
|
+
|
|
1068
|
+
# iOS clean
|
|
1069
|
+
cd ios && pod deintegrate && pod install && cd ..
|
|
1070
|
+
|
|
1071
|
+
# Run app
|
|
1072
|
+
npm run android
|
|
1073
|
+
npm run ios
|
|
1074
|
+
|
|
1075
|
+
# View logs
|
|
1076
|
+
npx react-native log-android
|
|
1077
|
+
npx react-native log-ios
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
---
|
|
1081
|
+
|
|
1082
|
+
## Support
|
|
1083
|
+
|
|
1084
|
+
For issues or questions:
|
|
1085
|
+
|
|
1086
|
+
1. Check logs for error messages
|
|
1087
|
+
2. Verify all configuration steps
|
|
1088
|
+
3. Test on real devices (especially iOS)
|
|
1089
|
+
4. Check Firebase and NotifySphere admin panels
|
|
1090
|
+
5. Contact NotifySphere support if needed
|
|
1091
|
+
|
|
1092
|
+
---
|
|
30
1093
|
|
|
31
|
-
##
|
|
1094
|
+
## Version History
|
|
32
1095
|
|
|
33
|
-
|
|
1096
|
+
- **v1.0.0** (January 2026) - Initial implementation guide
|
|
34
1097
|
|
|
35
1098
|
---
|
|
36
1099
|
|
|
37
|
-
|
|
1100
|
+
**Created:** January 7, 2026
|
|
1101
|
+
**Status:** ✅ Production Ready
|
|
1102
|
+
**Platform Support:** Android ✅ | iOS ✅
|