Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.48 KB

LAUNCH_APP_FROM_H5.md

File metadata and controls

37 lines (29 loc) · 1.48 KB

WeChat reference document

Platform differences

  • The event type of Launch-App-From-H5 on Android is WeChatShowMessageFromWXRequest
  • The event type of Launch-App-From-H5 on IOS is WeChatLaunchFromWXRequest

Example

void handle_launch_from_h5() {
  Fluwx fluwx = Fluwx();

  fluwx.addSubscriber((response) {
    // 1. Handle responses separately for android and ios
    if (response is WeChatShowMessageFromWXRequest) {
      debugPrint("launch-app-from-h5 on android");
      // do something here only for android after launch from wechat
    } else if (response is WeChatLaunchFromWXRequest) {
      debugPrint("launch-app-from-h5 on ios");
      // do something here only for android after launch from wechat
    }

    // 2. Or handling responses together for android and ios
    if (response is WeChatLaunchFromWXRequest ||
        response is WeChatShowMessageFromWXRequest) {
      debugPrint("launch-app-from-h5");
      // do something here for both android and ios after launch from wechat
    }
  });
}

If you want to get ext from website, please call fluwx.getExtMsg()。For details, please read the example project.