Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_push
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
顾海波
2025-01-23 15:48:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c862db3c9f9fdc87f14517985bba2c2e873b2b8
2c862db3
1 parent
ef647fe7
【修复】鸿蒙regId不能正常获取
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
ohos/src/main/ets/com/ewin/flutter_push/PushPlatform.ets
ohos/src/main/ets/com/ewin/flutter_push/PushPluginMethodChannelHandler.ets
ohos/src/main/ets/com/ewin/flutter_push/PushPlatform.ets
0 → 100644
View file @
2c862db
export class PushPlatform {
platformName: string;
regId: string;
constructor(platformName: string, regId: string) {
this.platformName = platformName;
this.regId = regId;
}
}
...
...
ohos/src/main/ets/com/ewin/flutter_push/PushPluginMethodChannelHandler.ets
View file @
2c862db
...
...
@@ -22,6 +22,8 @@ import { UIAbility, AbilityConstant, Want } from '@kit.AbilityKit';
import { MethodChannel } from '@ohos/flutter_ohos';
import { notificationManager } from '@kit.NotificationKit';
import { common } from '@kit.AbilityKit';
import { PushPlatform } from './PushPlatform';
const TAG: string = "PushPluginMethodChannelHandler";
export default class PushPluginMethodChannelHandler implements MethodCallHandler {
...
...
@@ -86,11 +88,9 @@ export default class PushPluginMethodChannelHandler implements MethodCallHandler
try {
const pushToken: string = await pushService.getToken();
const map:Map<string,string> =new Map<string,string>()
const params:Map<string,string> =new Map<string,string>()
params.set("platformName","huawei_ohos")
params.set("regId",pushToken)
const pushPlatform = new PushPlatform("huawei_ohos",pushToken)
map.set("type","ReceiveRegisterResult")
map.set("params", JSON.stringify(p
arams
))
map.set("params", JSON.stringify(p
ushPlatform
))
this.methodChannel?.invokeMethod("onListener",map)
result.success(true)
} catch (err) {
...
...
Please
register
or
login
to post a comment