Loading...
Searching...
No Matches
NotificationManager Directory Reference

Directories

 dart
 
 java
 
 kotlin
 
 objc
 
 swift
 

Detailed Description

This directory contains comprehensive examples demonstrating the usage of Navigine SDK's NotificationManager functionality across all supported platforms.

Overview

NotificationManager is used to manage local notifications that are triggered by iBeacon signals. It detects proximity to beacons and notifies users about events based on parameters configured in CMS.

Key Components

NotificationManager

NotificationListener

Notification

Platform-Specific Files

Dart/Flutter

Java

Kotlin

Objective-C

Swift

Common Usage Patterns

1. Basic Notification Handling

// Initialize SDK and get NotificationManager
final notificationManager = sdk.getNotificationManager(locationManager);
// Create and add listener
final listener = NotificationListener(
onNotificationLoaded: (notification) {
print('Notification: ${notification.title}');
},
onNotificationFailed: (error) {
print('Error: ${error.message}');
},
);
notificationManager.addNotificationListener(listener);
// Remove listener when done
notificationManager.removeNotificationListener(listener);

2. Multiple Listeners

// Add multiple listeners for different purposes
notificationManager.addNotificationListener(analyticsListener);
notificationManager.addNotificationListener(uiListener);
notificationManager.addNotificationListener(loggingListener);

3. Notification Processing

void onNotificationLoaded(Notification notification) {
print('ID: ${notification.id}');
print('Title: ${notification.title}');
print('Content: ${notification.content}');
if (notification.imageUrl != null) {
print('Image: ${notification.imageUrl}');
}
}

4. Error Handling

void onNotificationFailed(Error error) {
print('Notification failed: ${error.message}');
// Implement retry logic or user notification
if (error.message.contains('network')) {
// Handle network errors
} else if (error.message.contains('timeout')) {
// Handle timeout errors
}
}

Running Examples

Dart/Flutter

cd dart
dart notification_manager_example.dart

Java

cd java
javac NotificationManagerExample.java
java NotificationManagerExample

Kotlin

cd kotlin
kotlinc NotificationManagerExample.kt -include-runtime -d NotificationManagerExample.jar
java -jar NotificationManagerExample.jar

Objective-C

cd objc
clang -framework Foundation NotificationManagerExample.m -o NotificationManagerExample
./NotificationManagerExample

Swift

cd swift
swift NotificationManagerExample.swift

Features Demonstrated

Use Cases

Retail Applications

Event Management

Navigation Apps

Notes