Xiaomi Push SDK Flutter plugin Xiaomi Push version: v3.7.6 During testing, please use a real device as an emulator may trigger an exception with the message "code = 10017, msg= Illegal parameter value".
Flutter Version >= 1.12
If you encounter an error with code 22022
, please make sure that push services are enabled. For instructions on how to enable push services, please refer to: https://support.rongcloud.cn/ks/NzE5
No additional configuration is required as obfuscation is already built in.
Modify the AndroidManifest.xml
file and add the following:
<permission android:name="your.package.name.permission.MIPUSH_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="your.package.name.permission.MIPUSH_RECEIVE"/>
API | Description | Parameters |
---|---|---|
init | Initialize | { appId: APP_ID , appKey: APP_KEY } |
setAlias | Set alias | { alias: alias, category: category } |
unsetAlias | Cancel alias | { alias: alias, category: category } |
getAllAlias | Get all aliases | - |
setUserAccount | Set user account | { userAccount: account, category: category } |
unsetUserAccount | Cancel user account | { userAccount: account, category: category } |
getAllUserAccount | Get all user accounts | - |
subscribe | Set tag | { topic: topic, category: category } |
unsubscribe | Cancel tag | { topic: topic, category: category } |
getAllTopic | Get all tags | - |
getRegId | Get client RegId | - |
Add listener: XiaoMiPushPlugin.addListener
, remove listener: XiaoMiPushPlugin.removeListener
Listener method prototype: typedef ListenerValue<P> = void Function(XiaoMiPushListenerTypeEnum type, P params);
Type | Description | Format |
---|---|---|
NotificationMessageClicked | Receive notification messages pushed by the server and trigger when the user clicks | MiPushMessageEntity |
RequirePermissions | Callback when the required permissions are not obtained | List |
ReceivePassThroughMessage | Receive pass-through messages pushed by the server | MiPushMessageEntity |
CommandResult | Get the result of the command sent to the server | MiPushCommandMessageEntity |
ReceiveRegisterResult | Get the result of the registration command sent to the server | MiPushCommandMessageEntity |
NotificationMessageArrived | Receive notification messages pushed by the server, trigger when the message arrives at the client, and also receive notification messages that do not pop up when the application is in the foreground (on MIUI, only when the application is in a running state or on the self-starting whitelist can this method be used to receive such messages). | MiPushMessageEntity | |
I also maintain the following plugins. If you are interested in maintaining them with me, please contact me through Github. Issues and PRs are welcome.
Platform | Plugin | Description | Version |
---|---|---|---|
Flutter | FlutterVideoPlayerLibrary-Desc | The best player (UI library) for Flutter | - |
Flutter | FlutterPerfectVolumeControl | Flutter's perfect volume controller plugin | |
Flutter | FlutterTencentImPlugin | Tencent Cloud IM plugin | |
Flutter | FlutterTencentRtcPlugin | Tencent Cloud Rtc plugin | |
Flutter | FlutterXiaoMiPushPlugin | Xiaomi Push SDK plugin | |
Flutter | FlutterHuaWeiPushPlugin | Huawei Push (HMS Push) plugin | |
Flutter | FlutterTextSpanField | Custom text style input box | |
Flutter | FlutterClipboardListener | Clipboard listener | |
Flutter | FlutterQiniucloudLivePlugin | Flutter Qiniu Cloud Live plugin | Not |