What do you need for integration?
- An account to access into indigitall console. If you don't have it, please contact with us here.
- The next thing is to have a project associated with the application web (web browsers) and / or mobile (android, ios). See more details here.
It is important since the project contains the configuration data of your application, that is, the domain where your website is hosted, the safari or iOS certificates or the firebase key that android uses. It all depends on the platforms (web or app) that the project uses.
- You will need the App Key of the project, which is the key that our system uses to identify it, so it is unique for each project. You can find it in the administration console within the Configuration section in the Projects tab. You can see it in the following image, and to copy it, it is easy to click on the icon next to the key (App Key)
- For android
- A Firebase Server Key
- A HMS Push Kit Server Key
- Android Studio
- An Android device or emulator with Google Play services installed to run the app
- For iOS
- A valid push certificate for iOS. Learn how get push certificate from APNS
- Xcode
- An iOS device to run the app
Integration
This article shows the minimum development that must be done to start registering devices and being able to carry out the first push campaigns.
The indigitall SDK is compatible with Google messaging services, through the Firebase platform and with the services of HMS or Huawei Mobile Services of Huawei.
Our SDK is available via pub.dev.
pub.dev it is a package management system. It consists of a command line client and an online database of public and private packages.
You can watch it in this tutorial video or read the instructions below:
🤖 Click to expand AI Integration Prompt (ChatGPT / Copilot / Claude)
Copy and paste this prompt into your AI assistant to accelerate your integration:
You are a senior Flutter mobile engineer. Implement push notifications in an existing Flutter app using `indigitall_flutter_plugin`, with optional Huawei support and optional location support.
## Goal
Deliver a complete, production-ready integration of Indigitall push notifications for Android and iOS, including:
1. Plugin setup and initialization
2. Native Android manifest and activity updates
3. Native iOS AppDelegate integration
4. Notification Service Extension (Swift or Objective-C)
5. Optional private cloud URL setup
6. Optional location features
7. Optional Huawei Mobile Services (HMS) support
8. Dependency/build validation and final verification checklist
Do not leave placeholders unaddressed. Ask for missing values first, then implement.
---
## First: Ask these required questions before coding
1. What is the Indigitall `appKey`?
2. What is the Firebase `senderId`?
3. Do you use Indigitall private cloud?
- If yes, provide `setUrlDeviceApi` URL.
- If no, do not configure it.
4. Do you want location enabled?
- If yes, enable all required Android/iOS permissions and notes.
5. Do you want Huawei services (HMS) enabled?
- If yes, configure HMS native files, manifest/service entries, and Gradle setup.
6. In which screen/class do you want to receive push notification data (for `getPush`)?
- Provide the class name or route where `IndigitallFlutterPlugin.getPush(...)` should be placed.
Also confirm:
1. Is Firebase already configured in Android (`google-services.json`)?
2. If HMS is enabled, is Huawei config file present (for example `agconnect-services.json`)?
3. Current Flutter version and plugin version constraints.
---
## Implementation requirements
### 0) Plugin installation
Add the plugin to `pubspec.yaml`:
```yaml
dependencies:
indigitall_flutter_plugin: ^
```
Then run:
```bash
flutter pub get
```
If HMS support is required, also add the following dependency to `pubspec.yaml`:
```yaml
indigitall_hms_flutter_plugin: ^
```
Verify the plugin appears under `.flutter-plugins` and `.flutter-plugins-dependencies` after running `pub get`.
---
### 1) Flutter initialization flow
After plugin installation and parameter setup, initialize with this structure (adapt syntax to valid Dart if needed, but preserve behavior):
```dart
import 'package:indigitall_flutter_plugin/indigitall_flutter_plugin.dart';
Map params = {
IndigitallParams.PARAM_APP_KEY: "YOUR_APPKEY",
IndigitallParams.PARAM_SENDER_ID: "YOR _SENDER_ID",
IndigitallParams.PARAM_REQUEST_LOCATION: false,
IndigitallParams.PARAM_URL_DEVICE_API: "URL_DEVICE_API",
IndigitallParams.PARAM_DEFAULT_ACTIVITY: "/",
IndigitallParams.PARAM_LOG_LEVEL: LogLevel.debug.level
};
IndigitallFlutterPlugin.init(
params,
(device) async => {
print("device " + device.deviceId.toString()),
(device) async => {
// accepts permissions
print("init on new user registered " + device.deviceId.toString()),
},
(error) => {print("error init: " + error.errorMessage.toString())}
}
);
```
Requirements:
1. Replace `YOUR_APPKEY` and `YOUR_SENDER_ID` in the params map with the real values provided.
2. If private cloud is **not** enabled, remove `PARAM_URL_DEVICE_API` from the params map entirely.
3. If location is **not** enabled, keep `PARAM_REQUEST_LOCATION: false`; if enabled, set it to `true`.
4. Add robust logging for success/new device/error.
5. Ensure initialization happens once at app startup (e.g. in `main.dart` or top-level widget `initState`).
6. Keep code null-safe and idiomatic Dart.
#### 1.1) Push data reception (`getPush`)
In the screen or class indicated by the user, register the push data listener:
```dart
import 'package:indigitall_flutter_plugin/indigitall_flutter_plugin.dart';
IndigitallFlutterPlugin.getPush(
(push) => {
print("getPush: " + push.toMap().toString()),
},
(error) => {
print("getPush error: " + error.errorMessage.toString()),
});
```
Requirements:
1. Place this call in the `initState` (or equivalent lifecycle method) of the class/screen specified by the user.
2. Ensure it is only registered once — guard against duplicate registrations if the widget rebuilds.
3. Use the received `push` object to drive UI or business logic as needed.
---
### 2) Android changes
#### 2.1 Manifest required entries
Add these permissions/components to Android manifest (merge safely with existing entries):
```xml
```
#### 2.2 Optional location (only if requested)
Add:
```xml
```
Also implement runtime permission flow for Android 10+ and Android 13+ (`POST_NOTIFICATIONS`).
#### 2.3 Optional HMS (only if requested)
Add manifest service:
```xml
```
Then verify and configure all required Gradle/HMS pieces (plugin classpath, repositories, dependencies, apply plugin) and confirm Huawei config file exists.
#### 2.4 MainActivity update
Add:
```kotlin
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
IndigitallFlutterPlugin.onRequestPermissionsResult(context, requestCode, permissions, grantResults)
}
```
Ensure `context` is valid in scope (use `this` or equivalent if needed).
#### 2.5 Android validation
1. Confirm `google-services.json` is present and correctly placed.
2. If HMS enabled, confirm Huawei config file exists and is correctly placed.
3. Build debug APK successfully.
4. Confirm push token registration logs are visible.
---
### 3) iOS changes
#### 3.1 CocoaPods update
If using CocoaPods, update repo so latest native SDK (already referenced by plugin) can be resolved:
1. `pod repo update`
2. `pod install` in `ios/`
#### 3.2 AppDelegate integration
Modify/add these handlers in `AppDelegate`:
```swift
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
UNUserNotificationCenter.current().delegate = self;
}
@available(iOS 10.0, *)
override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
IndigitallFlutterPlugin.sendNotification(notification.request.content.userInfo)
completionHandler(Indigitall.willPresentNotification());
}
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
IndigitallFlutterPlugin.sendNotification(userInfo)
Indigitall.didReceivePush(withNotification: userInfo) { push in
print("Push notification with push secure: \(push.pushId)")
}
}
@available(iOS 10.0, *)
override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
IndigitallFlutterPlugin.handleTapNotification(response)
Indigitall.handle(with: response)
}
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
IndigitallFlutterPlugin.sendToken(deviceToken)
Indigitall.setDeviceToken(deviceToken)
}
```
Ensure:
1. Proper imports (`UserNotifications`, plugin/native SDK modules).
2. `UNUserNotificationCenterDelegate` conformance.
3. `didFinishLaunchingWithOptions` returns correctly and preserves existing logic.
4. No duplicate delegate assignments.
#### 3.3 iOS capabilities
Verify in Xcode target:
1. Push Notifications capability enabled
2. Background Modes enabled with:
- Remote notifications
- Background fetch
#### 3.4 Optional location on iOS (only if requested)
Add proper `Info.plist` keys and human-readable usage descriptions:
1. `NSLocationWhenInUseUsageDescription`
2. `NSLocationAlwaysAndWhenInUseUsageDescription` (if background location is needed)
3. Any other required keys based on chosen location mode
Also ensure runtime permission request flow is implemented from Flutter/native path as needed.
---
### 4) Notification Service Extension (iOS)
Create and configure a Notification Service Extension target and include one of these implementations.
#### Swift version
```swift
import Indigitall
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
var request: UNNotificationRequest?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
self.request = request
self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
Indigitall.didReceive(self.request!, withContentHandler: self.contentHandler!)
}
override func serviceExtensionTimeWillExpire() {
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
Indigitall.serviceExtensionTimeWillExpire(bestAttemptContent, withContentHandler: contentHandler)
}
}
}
```
#### Objective-C version
```objc
# import
# import
API_AVAILABLE(ios(10.0))
//NotificaiontService.h
@interface NotificationService : UNNotificationServiceExtension
@end
//NotificationService.m
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@property (nonatomic, strong) UNNotificationRequest *request;
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
self.request = request;
[Indigitall didReceiveNotificationRequest:self.request withContentHandler:self.contentHandler];
}
- (void)serviceExtensionTimeWillExpire {
if (self.contentHandler != nil && self.bestAttemptContent != nil){
[Indigitall serviceExtensionTimeWillExpire:self.bestAttemptContent withContentHandler:self.contentHandler];
}
}
@end
```
Extension requirements:
1. Ensure extension target links required framework/pods.
2. Ensure correct bundle identifiers and signing.
3. Ensure extension is embedded in app.
4. Validate with a rich push payload.
---
### 5) Dependency and build verification
Review all dependency and build integration points and fix missing pieces:
1. Flutter `pubspec.yaml` dependency
2. Android Gradle files (project/app/module)
3. Firebase plugin/apply settings if required
4. HMS Gradle/plugin setup if requested
5. iOS Podfile/pods integration
6. Native SDK compatibility versions
Then run:
1. `flutter clean`
2. `flutter pub get`
3. Android build
4. iOS pod install + iOS build (or archive-ready validation)
---
### 6) Final QA checklist (must complete)
1. App starts without crashes on Android/iOS.
2. Device registration succeeds and logs device ID.
3. Push reception works foreground/background.
4. Notification tap/open callbacks work.
5. iOS notification service extension processes payload.
6. Optional location path works (if enabled).
7. Optional HMS path works on Huawei device/emulator (if enabled).
8. No manifest/plist/capability mismatch.
9. Document all changed files and why each change was required.
---
### 7) Output format required from you
Provide:
1. A concise implementation summary
2. Exact file-by-file diffs or code blocks for each changed file
3. Any assumptions made
4. A “Manual steps for the developer” section (Xcode capabilities/signing, Firebase/Huawei console tasks)
5. A troubleshooting section for common errors (missing config files, Gradle sync issues, pod conflicts, notification permission not shown, token not received)
---
## Official documentation
https://documentation.indigitall.com/reference/flutter-sdk
> ⚠️ AI can make mistakes. Always verify everything it does before treating it as valid.
Import the plugin
To import the SDK into your project, follow these steps:
-
- Open file pubspec.yaml located inside the application folder, and add indigitall_flutter_plugin below the dependencies section as shown below:
dependencies:
flutter:
sdk: flutter
indigitall_flutter_plugin: ^4.0.0-
- Run this line in the console to import the plugin:
$ flutter pub getFrom Android Studio / VS Code: click on Packages get in the message box that appears at the top right of pubspec.yaml.
