getui_flutter 1.0.0 copy "getui_flutter: ^1.0.0" to clipboard
getui_flutter: ^1.0.0 copied to clipboard

Enhanced Getui Flutter plugin with full payload support for push notifications. Fork of getuiflut with bug fixes and improvements.

getui_flutter #

pub package License: MIT

Enhanced Getui (ไธชๆŽจ) Flutter plugin with full payload support for push notifications.

๐ŸŽฏ Why This Fork? #

This is an enhanced fork of the original getuiflut plugin with critical bug fixes:

โœ… Key Improvements #

  • Fixed payload data loss: onNotificationMessageArrived now correctly receives full payload data on Android
  • Enhanced notification handling: Improved data transmission in notification callbacks
  • Better error handling: More robust error handling in native code
  • Updated documentation: Clearer examples and API documentation

๐Ÿ› Original Issue #

In the original getuiflut plugin, when receiving push notifications on Android, the onNotificationMessageArrived callback would often receive null or incomplete payload data, making it impossible to handle custom notification data properly.

This fork fixes that issue completely.

๐Ÿ“ฆ Installation #

Add this to your pubspec.yaml:

dependencies:
  getui_flutter: ^1.0.0

Then run:

flutter pub get

๐Ÿš€ Quick Start #

1. Android Setup #

Add Getui SDK dependency

In your android/app/build.gradle:

dependencies {
    // Add Getui SDK
    implementation 'com.getui:gtsdk:3.2.13.0'  // Check for latest version
    implementation 'com.getui:gtc:3.1.10.0'
}

Configure AndroidManifest.xml

<manifest>
    <application>
        <!-- Getui Configuration -->
        <meta-data
            android:name="PUSH_APPID"
            android:value="YOUR_APP_ID" />
        <meta-data
            android:name="PUSH_APPKEY"
            android:value="YOUR_APP_KEY" />
        <meta-data
            android:name="PUSH_APPSECRET"
            android:value="YOUR_APP_SECRET" />
    </application>
</manifest>

2. iOS Setup #

Add to Podfile

# ios/Podfile
target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  
  # Add Getui SDK
  pod 'GTSDK', '~> 3.0'
end

Then run:

cd ios && pod install

Initialize in AppDelegate

// ios/Runner/AppDelegate.swift
import UIKit
import Flutter
import GTSDK

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    
    // Initialize Getui
    GeTuiSdk.start(withAppId: "YOUR_APP_ID", 
                   appKey: "YOUR_APP_KEY", 
                   appSecret: "YOUR_APP_SECRET", 
                   delegate: self)
    
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

3. Flutter Code #

import 'package:getui_flutter/getui_flutter.dart';

class PushService {
  final GetuiFlutter _getuiPlugin = GetuiFlutter();

  void initialize() {
    // Initialize SDK
    GetuiFlutter.initGetuiSdk;

    // Add event handlers
    _getuiPlugin.addEventHandler(
      // Receive Client ID
      onReceiveClientId: (String clientId) async {
        print("Getui Client ID: $clientId");
      },

      // Receive notification message (when app is in foreground)
      onNotificationMessageArrived: (Map<String, dynamic> message) async {
        print("Notification arrived: $message");
        
        // โœ… Now you can access full payload data!
        final payload = message['payload'];
        final title = message['title'];
        final content = message['content'];
        
        print("Payload: $payload");
      },

      // Handle notification click
      onNotificationMessageClicked: (Map<String, dynamic> message) async {
        print("Notification clicked: $message");
        
        // Handle navigation based on payload
        final payload = message['payload'];
        // Navigate to specific screen based on payload
      },

      // Receive transparent message
      onReceiveMessageData: (Map<String, dynamic> message) async {
        print("Transparent message: $message");
      },

      // iOS specific callbacks
      onRegisterDeviceToken: (String token) async {
        print("Device token: $token");
      },

      onReceivePayload: (Map<String, dynamic> payload) async {
        print("iOS payload: $payload");
      },

      onReceiveNotificationResponse: (Map<String, dynamic> response) async {
        print("iOS notification response: $response");
      },

      onAppLinkPayload: (String payload) async {
        print("App link payload: $payload");
      },

      onPushModeResult: (Map<String, dynamic> result) async {
        print("Push mode result: $result");
      },

      onSetTagResult: (Map<String, dynamic> result) async {
        print("Set tag result: $result");
      },

      onAliasResult: (Map<String, dynamic> result) async {
        print("Alias result: $result");
      },

      onQueryTagResult: (Map<String, dynamic> result) async {
        print("Query tag result: $result");
      },

      onWillPresentNotification: (Map<String, dynamic> notification) async {
        print("Will present notification: $notification");
      },

      onOpenSettingsForNotification: (Map<String, dynamic> settings) async {
        print("Open settings: $settings");
      },

      onTransmitUserMessageReceive: (Map<String, dynamic> message) async {
        print("User message: $message");
      },

      onGrantAuthorization: (String result) async {
        print("Authorization: $result");
      },

      onLiveActivityResult: (Map<String, dynamic> result) async {
        print("Live activity result: $result");
      },
    );
  }

  // Get client ID
  Future<String> getClientId() async {
    return await GetuiFlutter.getClientId;
  }

  // Bind alias
  void bindAlias(String alias) {
    _getuiPlugin.bindAlias(alias, "your_sequence_number");
  }

  // Unbind alias
  void unbindAlias(String alias) {
    _getuiPlugin.unbindAlias(alias, "your_sequence_number", true);
  }

  // Set badge (iOS)
  void setBadge(int count) {
    _getuiPlugin.setBadge(count);
  }

  // Set tags
  void setTags(List<String> tags) {
    _getuiPlugin.setTag(tags);
  }
}

๐Ÿ“š API Reference #

Static Methods #

Method Return Type Description Platform
initGetuiSdk Future<void> Initialize Getui SDK Android, iOS
getClientId Future<String> Get Getui client ID Android, iOS
sdkVersion Future<String> Get SDK version Android, iOS
getLaunchNotification Future<Map> Get notification that launched the app Android, iOS
platformVersion Future<String> Get platform version Android, iOS

Instance Methods #

Method Parameters Description Platform
turnOnPush() - Enable push notifications Android, iOS
turnOffPush() - Disable push notifications Android
bindAlias() String alias, String sn Bind user alias Android, iOS
unbindAlias() String alias, String sn, bool isSelf Unbind user alias Android, iOS
setBadge() int badge Set app badge number Android, iOS
resetBadge() - Reset badge to 0 iOS
setTag() List<dynamic> tags Set user tags Android, iOS
setPushMode() int mode Set push mode iOS
runBackgroundEnable() int enable Enable background running iOS
registerActivityToken() String aid, String token, String sn Register live activity token iOS

Event Handlers #

All event handlers are configured through addEventHandler():

Handler Parameter Type Description Platform
onReceiveClientId String Called when client ID is received Android, iOS
onNotificationMessageArrived Map<String, dynamic> [Fixed] Called when notification arrives (with full payload) Android, iOS
onNotificationMessageClicked Map<String, dynamic> Called when notification is clicked Android, iOS
onReceiveMessageData Map<String, dynamic> Called when transparent message is received Android, iOS
onRegisterDeviceToken String Called when device token is registered iOS
onReceivePayload Map<String, dynamic> Called when payload is received iOS
onReceiveNotificationResponse Map<String, dynamic> Called when notification response is received iOS
onAliasResult Map<String, dynamic> Called with alias operation result Android, iOS
onSetTagResult Map<String, dynamic> Called with tag operation result Android, iOS

๐Ÿ”„ Migration from getuiflut #

If you're migrating from the original getuiflut package:

1. Update pubspec.yaml #

dependencies:
  # getuiflut: ^0.2.24  # Remove
  getui_flutter: ^1.0.0  # Add

2. Update imports #

// Old
import 'package:getuiflut/getuiflut.dart';
Getuiflut plugin = Getuiflut();

// New
import 'package:getui_flutter/getui_flutter.dart';
GetuiFlutter plugin = GetuiFlutter();

3. No other changes needed! #

The API is fully compatible. Your existing code will work without modifications.

๐Ÿ› Troubleshooting #

Payload is null or empty #

This issue is fixed in this fork! If you're still experiencing issues:

  1. Make sure you're using getui_flutter (not getuiflut)
  2. Check that you've properly configured Getui credentials
  3. Verify that your push message includes payload data

Client ID is empty #

// Wait for client ID before using it
_getuiPlugin.addEventHandler(
  onReceiveClientId: (String clientId) async {
    // Use clientId here
    await sendClientIdToServer(clientId);
  },
  // ... other handlers
);

iOS notifications not working #

  1. Enable push notifications in Xcode capabilities
  2. Configure APNs certificate in Getui console
  3. Call registerRemoteNotification() after SDK initialization

Android notifications not showing #

  1. Check notification permissions (Android 13+)
  2. Verify Getui credentials in AndroidManifest.xml
  3. Ensure Getui SDK dependency is added

๐Ÿ“– Example #

Check the example directory for a complete working example.

๐Ÿ™ Credits #

This plugin is based on getuiflut by ๆ›นไธ–้‘ซ.

Key Enhancements in This Fork #

  • โœ… Fixed payload data loss in onNotificationMessageArrived
  • โœ… Enhanced notification data handling
  • โœ… Improved error handling
  • โœ… Better documentation and examples

๐Ÿ“„ License #

MIT License

Copyright (c) 2023 ๆ›นไธ–้‘ซ (Original Author)
Copyright (c) 2025 jjjjjjava (Modifications and Enhancements)

See LICENSE for details.

๐Ÿค Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“ฎ Support #

๐Ÿ“ Changelog #

See CHANGELOG.md for a detailed list of changes.

1
likes
130
points
143
downloads

Publisher

unverified uploader

Weekly Downloads

Enhanced Getui Flutter plugin with full payload support for push notifications. Fork of getuiflut with bug fixes and improvements.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on getui_flutter

Packages that implement getui_flutter