infobip_mobilemessaging 0.0.1 copy "infobip_mobilemessaging: ^0.0.1" to clipboard
infobip_mobilemessaging: ^0.0.1 copied to clipboard

outdated

Infobip Mobile Messaging Flutter Plugin.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:infobip_mobilemessaging/infobip_mobilemessaging.dart';
import 'package:infobip_mobilemessaging/models/Configuration.dart';
import 'package:infobip_mobilemessaging/models/LibraryEvent.dart';
import 'package:infobip_mobilemessaging/models/Message.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    await InfobipMobilemessaging.init(Configuration(
        applicationCode: "a7cbaec3b7481b023d90e8373306c23a-5a14469f-9cae-4319-8d9a-eb4b5f02f2d0",
        androidSettings: AndroidSettings(
            firebaseSenderId: "<>Yours Firebase sender ID>"
        ),
        iosSettings: IOSSettings(
            notificationTypes: ["alert", "badge", "sound"],
            forceCleanup: false,
            logging: true
        )
    ));
    InfobipMobilemessaging.on(LibraryEvent.TOKEN_RECEIVED, (event) => {
      print("Callback. TOKEN_RECEIVED event:" + event.toString())
    });
    InfobipMobilemessaging.on(LibraryEvent.MESSAGE_RECEIVED, (Map<String, dynamic> event) => {
      print("Callback. MESSAGE_RECEIVED event,  message title: "  + event["body"])
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running'),
        ),
      ),
    );
  }
}
7
likes
0
points
5.33k
downloads

Publisher

unverified uploader

Weekly Downloads

Infobip Mobile Messaging Flutter Plugin.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, package_info_plus

More

Packages that depend on infobip_mobilemessaging