Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Request permission to display notification (on Android 13 and higher only)

Code Block
languagedart
final result = await MappSdk.requestPermissionPostNotifications();
debugPrint("POST NOTIFICATION PERMISSION RESULT: " + result.toString());
if (!result) {
  _showMyDialog(
      "POST NOTIFICATION", "Permission result", "Permission was denied!");
}

...

On Android some additional event handlers are available:

  • Push opened

Code Block
languagedart
  void pushOpenedHandler(dynamic arguments) {
    print("Push opened!");
    print(arguments);
  }
  
  MappSdk.handledPushOpen = 
      (dynamic arguments) => pushOpenedHandler(arguments);
  • Push dismissed

Code Block
languagedart
  void pushDismissedHandler(dynamic arguments) {
    print("Push dismissed!");
    print(arguments);
  }
  
  MappSdk.handledPushDismiss =
        (dynamic arguments) => pushDismissedHandler(arguments);
  • Silent push received

Code Block
languagedart
  void pushSilentHandler(dynamic arguments) {
    print("Push silent!");
    print(arguments);
  }
  
  MappSdk.handledPushSilent =
        (dynamic arguments) => pushSilentHandler(arguments);

...

To get inbox messages use Mapp.fetchInboxMessage()

Code Block
languagedart
if (Platform.isAndroid) {
    MappSdk.fetchInboxMessage().then((messages) {
      _showMyDialog("Inbox messages", "", messages);
    });
} else {
    MappSdk.fetchInboxMessage();
}

...

Start geo targeting feature

Code Block
languagedart
MappSdk.startGeoFencing().then((status) {
        debugPrint("Start Geofencing status:" + status);
        // handle successfull start of geo targeting
      }).catchError((e) {
        debugPrint("Start Geofencing error:" + e.toString());
        // handle errors
      });

Stop geo targeting feature

Code Block
languagedart
MappSdk.stopGeoFencing().then((status) {
        debugPrint("Stop Geofencing status:" + status);
        // handle successfull stoping of geo targeting
      }).catchError((e) {
        debugPrint("Stop Geofencing error:" + e.toString());
        // handle errors
      });

...