mipush

Flutter plugin for Xiaomi MiPush (Android), adapted from the official C SDK demo.

Supported Platform

  • Android

Android Setup

The plugin already bundles the MiPush AAR from:

  • MiPush_Client_C_Android_20260129/SDK/MiPush_SDK_Client_7_9_2-C_3rd.aar

For your app module, make sure notification permission is handled for Android 13+.

Usage

import 'package:mipush/mipush.dart';

final mipush = Mipush();

await mipush.registerPush(appId: 'YOUR_APP_ID', appKey: 'YOUR_APP_KEY');
final regId = await mipush.getRegId();

mipush.events().listen((event) {
	// event["event"]: passThrough / notificationClicked /
	// notificationArrived / commandResult / registerResult
	print(event);
});

API

  • registerPush({required String appId, required String appKey})
  • unregisterPush()
  • setAlias(String alias, {String? category})
  • unsetAlias(String alias, {String? category})
  • setUserAccount(String account, {String? category})
  • unsetUserAccount(String account, {String? category})
  • subscribe(String topic, {String? category})
  • unsubscribe(String topic, {String? category})
  • setAcceptTime(...)
  • pausePush()
  • resumePush()
  • getRegId()
  • events()

Event Payload

All events are Map<String, dynamic> and contain event key.

  • Message callbacks include fields like content, topic, alias, title, description, extra.
  • Command callbacks include fields like command, resultCode, reason, commandArguments.