tencent_tpns_xiaomi_push_plugin 0.0.1 tencent_tpns_xiaomi_push_plugin: ^0.0.1 copied to clipboard
小米推送
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:tencent_tpns_xiaomi_push_plugin/tencent_tpns_xiaomi_push_plugin.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
test();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> test() async {
TencentTpnsXiaomiPushPlugin.registerPush(
appID: "2882303761518516314",
appToken: "2882303761518516314",
);
String regId = await TencentTpnsXiaomiPushPlugin.getRegId();
//上传给服务端
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}