bytedesk_push 0.0.3
bytedesk_push: ^0.0.3 copied to clipboard

a push sdk for android, mipush, huawei push integrated, mainly used for bytedesk_kefu

example/lib/main.dart

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

import 'package:bytedesk_push/bytedesk_push.dart';

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

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

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

  // 小米推送-初始化通道
  Future<void> initXmPush() async {
    // TODO: 需要替换为自己的appId和appKey,请到小米推送后台获取 https://admin.xmpush.xiaomi.com/zh_CN/app/nav?version=2021030801
    BytedeskPush.register("appId", "appKey");
  }

  //
  void unRegister() {
    BytedeskPush.unRegister();
  }

  //
  void bindAlias(String alias) {
    BytedeskPush.bindAlias(alias);
  }

  //
  void unBindAlias(String alias) {
    BytedeskPush.unBindAlias(alias);
  }

  //
  Future<List<String>> getAlias() async {
    return BytedeskPush.getAlias();
  }

  //
  void addTag(String tag) {
    BytedeskPush.addTag(tag);
  }

  //
  void deleteTag(String tag) {
    BytedeskPush.deleteTag(tag);
  }

  //
  Future<List<String>> getTags() async {
    return BytedeskPush.getTags();
  }

  //
  void setUserAccount(String userAccount) {
    BytedeskPush.setUserAccount(userAccount);
  }

  //
  void unsetUserAccount(String userAccount) {
    BytedeskPush.unsetUserAccount(userAccount);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('push'),
        ),
        body: Center(
          child: Text('mi push'),
        ),
      ),
    );
  }
}
1
likes
80
pub points
0%
popularity

a push sdk for android, mipush, huawei push integrated, mainly used for bytedesk_kefu

Homepage

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on bytedesk_push