netmera_flutter_sdk 0.0.7-beta copy "netmera_flutter_sdk: ^0.0.7-beta" to clipboard
netmera_flutter_sdk: ^0.0.7-beta copied to clipboard

outdated

NETMERA is a Mobile Application Engagement Platform. We offer a series of development tools and app communication features to help your mobile business ignite and soar.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/Netmera.dart';
import 'package:netmera_flutter_sdk/NetmeraPushBroadcastReceiver.dart';

import 'page_event.dart';
import 'page_push_inbox.dart';
import 'page_settings.dart';
import 'page_user.dart';

///
/// Copyright (c) 2019 Inomera Research.
/// Author Burak Soykal
///
void main() {
  initBroadcastReceiver();
  runApp(MyApp());
}

void _onPushRegister(Map<dynamic, dynamic> bundle) async {
  print("onPushRegister: $bundle");
}

void _onPushReceive(Map<dynamic, dynamic> bundle) async {
  print("onPushReceive: $bundle");
}

void _onPushDismiss(Map<dynamic, dynamic> bundle) async {
  print("onPushDismiss: $bundle");
}

void _onPushOpen(Map<dynamic, dynamic> bundle) async {
  print("onPushOpen: $bundle");
}

void _onPushButtonClicked(Map<dynamic, dynamic> bundle) async {
  print("onPushButtonClicked: $bundle");
}

void initBroadcastReceiver() {
  NetmeraPushBroadcastReceiver receiver = new NetmeraPushBroadcastReceiver();
  receiver.initialize(
    onPushRegister: _onPushRegister,
    onPushReceive: _onPushReceive,
    onPushDismiss: _onPushDismiss,
    onPushOpen: _onPushOpen,
    onPushButtonClicked: _onPushButtonClicked,
  );
}

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    Netmera.logging(true);

    Netmera.isPushEnabled().then((enabled) {
      print("Netmera: isPushEnabled = " + enabled.toString());
    });

    if (Platform.isIOS) {
      Netmera.requestPushNotificationAuthorization();
      Netmera.setAppGroupName("AppGroupName");
    }

    if (Platform.isAndroid) {
      Netmera.isWebViewProgressbarEnabled().then((enabled) {
        print("Netmera: isWebViewProgressbarEnabled = " + enabled.toString());
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 4,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Text("Event")),
                Tab(icon: Text("User")),
                Tab(icon: Text("PushInbox")),
                Tab(icon: Text("Settings")),
              ],
            ),
            title: Text('NM Flutter SDK'),
          ),
          body: TabBarView(
            children: [EventPage(), UserPage(), PushInboxPage(), SettingsPage()],
          ),
        ),
      ),
    );
  }
}
3
likes
0
pub points
82%
popularity

Publisher

unverified uploader

NETMERA is a Mobile Application Engagement Platform. We offer a series of development tools and app communication features to help your mobile business ignite and soar.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on netmera_flutter_sdk