tecom_push_service 1.0.4 copy "tecom_push_service: ^1.0.4" to clipboard
tecom_push_service: ^1.0.4 copied to clipboard

outdated

tecom push service plugin

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:tecom_push_service/tecom_push_service.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _tecomPushServicePlugin = TecomPushService();

  @override
  void initState() {
    super.initState();
    _tecomPushServicePlugin.initPushService("app_icon");
    _tecomPushServicePlugin.addEventHandler(onOpenNotification: _onOpenNotification);
  }

  Future<void> _onOpenNotification(Map<String, dynamic> message) async {
    print("_onOpenNotification $message");
  }

  _token() async{
    final token = await _tecomPushServicePlugin.getDeviceToken();
    print(token);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: TextButton(
            onPressed: _token,
            child: Text("get token"),
          ),
        ),
      ),
    );
  }
}
0
likes
0
points
42
downloads

Publisher

unverified uploader

Weekly Downloads

tecom push service plugin

Homepage

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on tecom_push_service