uniapp监听安卓原生插件的监听事件

安卓中module类中的写法

Map<String,Object> params = new HashMap<>();
        params.put("code",2000);
        params.put("senderId",userid);
        params.put("msg",dataContent);
        mWXSDKInstance.fireGlobalEventCallback("onReceiveMsg", params);

uniapp中监听的写法

// 先获得安卓监听事件方法的原生插件的module
this.uniTest = uni.requireNativePlugin('test-module');
// 监听收到的消息
plus.globalEvent.addEventListener('onReceiveMsg', function(e) {
  console.log('========onReceiveMsg========'+ JSON.stringify(e));
});
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务