# 小游戏 API 可用性说明
出海小游戏基于微信小游戏运行时,大部分 wx.* API 可直接使用。但由于海外环境的差异,部分 API 不支持或行为有所不同。
本文档列出出海小游戏中 可用 和 不可用 的公开 API。
- 标记为可用的 API 在海外环境中可正常调用。
- 标记为不可用的 API 在海外环境中无法使用,调用会返回错误或无响应。
# 出海新增接口
以下接口为出海小游戏独有,国内版本无对应接口。
| API | 说明 |
|---|---|
| requestGamePayment | 发起游戏币支付 |
| getGamePaymentProductInfo | 查询商品价格信息 |
| requestPaymentGameItem | 发起道具直购支付 |
# 与国内有差异的接口
以下接口在出海版本中可用,但参数或返回值与国内版本有所不同。
| API | 差异说明 |
|---|---|
| createBannerAd | 参数与国内不同,见 Banner 广告接入文档 |
| createCustomAd | 参数与国内不同,见 Banner 广告接入文档 |
| getLaunchOptionsSync | 返回值新增 userLocation 字段,可获取用户所在地区 |
# Worker
| API | 是否可用 |
|---|---|
| createWorker | ✅ 可用 |
# 基础
| API | 是否可用 |
|---|---|
| env | ✅ 可用 |
# 基础 > 分包加载
| API | 是否可用 |
|---|---|
| loadSubpackage | ✅ 可用 |
| preDownloadSubpackage | ✅ 可用 |
# 基础 > 加密
| API | 是否可用 |
|---|---|
| getUserCryptoManager | ✅ 可用 |
# 基础 > 小程序 > 应用级事件
| API | 是否可用 |
|---|---|
| onAudioInterruptionBegin / offAudioInterruptionBegin | ✅ 可用 |
| onAudioInterruptionEnd / offAudioInterruptionEnd | ✅ 可用 |
| onError / offError | ✅ 可用 |
| onUnhandledRejection / offUnhandledRejection | ✅ 可用 |
# 基础 > 小程序 > 生命周期
| API | 是否可用 |
|---|---|
| getEnterOptionsSync | ✅ 可用 |
| getLaunchOptionsSync | ✅ 可用 |
| onHide / offHide | ✅ 可用 |
| onShow / offShow | ✅ 可用 |
# 基础 > 性能
| API | 是否可用 |
|---|---|
| getPerformance | ✅ 可用 |
| reportPerformance | ✅ 可用 |
| triggerGC | ✅ 可用 |
# 基础 > 更新
| API | 是否可用 |
|---|---|
| getUpdateManager | ✅ 可用 |
| updateWeChatApp | ❌ 不可用 |
# 基础 > 系统
| API | 是否可用 |
|---|---|
| getAppAuthorizeSetting | ✅ 可用 |
| getAppBaseInfo | ✅ 可用 |
| getDeviceBenchmarkInfo | ❌ 不可用 |
| getDeviceInfo | ✅ 可用 |
| getSystemInfo | ✅ 可用 |
| getSystemInfoAsync | ✅ 可用 |
| getSystemInfoSync | ✅ 可用 |
| getSystemSetting | ✅ 可用 |
| getWindowInfo | ✅ 可用 |
| openAppAuthorizeSetting | ❌ 不可用 |
| openSystemBluetoothSetting | ❌ 不可用 |
# 基础 > 调试 > console
| API | 是否可用 |
|---|---|
| getLogManager | ✅ 可用 |
| getRealtimeLogManager | ✅ 可用 |
| setEnableDebug | ✅ 可用 |
# 媒体 > 图片
| API | 是否可用 |
|---|---|
| chooseImage | ⚠️ 需看上架的流量平台是否支持,如需使用该接口需做好调用失败的兜底方案 |
| chooseMessageFile | ⚠️ 需看上架的流量平台是否支持,如需使用该接口需做好调用失败的兜底方案 |
| compressImage | ✅ 可用 |
| previewImage | ✅ 可用 |
| previewMedia | ✅ 可用 |
| saveImageToPhotosAlbum | ✅ 可用 |
# 媒体 > 相机
| API | 是否可用 |
|---|---|
| createCamera | ⚠️ 需看上架的流量平台是否支持,如需使用该接口需做好调用失败的兜底方案 |
# 媒体 > 视频
| API | 是否可用 |
|---|---|
| chooseMedia | ⚠️ 需看上架的流量平台是否支持,如需使用该接口需做好调用失败的兜底方案 |
| createVideo | ✅ 可用 |
# 媒体 > 视频解码器
| API | 是否可用 |
|---|---|
| createVideoDecoder | ✅ 可用 |
# 媒体 > 音频
| API | 是否可用 |
|---|---|
| createInnerAudioContext | ✅ 可用 |
| createMediaAudioPlayer | ✅ 可用 |
| createWebAudioContext | ✅ 可用 |
| getAvailableAudioSources | ✅ 可用 |
| setInnerAudioOption | ✅ 可用 |
# 工具
# 广告
| API | 是否可用 |
|---|---|
| createBannerAd | ✅ 可用,需要额外参数,见 Banner 广告接入文档 |
| createCustomAd | ✅ 可用,需要额外参数,见 Banner 广告接入文档 |
| createGridAd | ❌ 不可用 |
| createInterstitialAd | ✅ 可用 |
| createRewardedVideoAd | ✅ 可用 |
# 开放接口 > 授权
| API | 是否可用 |
|---|---|
| authorize | ✅ 可用 |
# 开放接口 > 用户信息
| API | 是否可用 |
|---|---|
| createUserInfoButton | ⚠️ 不建议使用,已不再返回信息 |
| getPhoneNumber | ❌ 不可用 |
| getUserInfo | ⚠️ 不建议使用,已不再返回信息 |
# 开放接口 > 登录
| API | 是否可用 |
|---|---|
| checkSession | ❌ 不可用 |
| login | ✅ 可用 |
# 开放接口 > 账号信息
| API | 是否可用 |
|---|---|
| getAccountInfoSync | ✅ 可用 |
# 开放接口 > 隐私信息授权
| API | 是否可用 |
|---|---|
| getPrivacySetting | ✅ 可用 |
| onNeedPrivacyAuthorization | ✅ 可用 |
| openPrivacyContract | ❌ 不可用 |
| requirePrivacyAuthorize | ✅ 可用 |
# 数据分析
| API | 是否可用 |
|---|---|
| getExptInfoSync | ❌ 不可用 |
| getGameExptInfo | ❌ 不可用 |
| getGameLogManager | ❌ 不可用 |
| getMiniReportManager | ✅ 可用 |
| reportEvent | ❌ 不可用 |
| reportMonitor | ❌ 不可用 |
| reportScene | ❌ 不可用 |
| reportUserBehaviorBranchAnalytics | ❌ 不可用 |
# 数据缓存
| API | 是否可用 |
|---|---|
| clearStorage | ✅ 可用 |
| clearStorageSync | ✅ 可用 |
| createBufferURL | ✅ 可用 |
| getStorage | ✅ 可用 |
| getStorageInfo | ✅ 可用 |
| getStorageInfoSync | ✅ 可用 |
| getStorageSync | ✅ 可用 |
| removeStorage | ✅ 可用 |
| removeStorageSync | ✅ 可用 |
| revokeBufferURL | ✅ 可用 |
| setStorage | ✅ 可用 |
| setStorageSync | ✅ 可用 |
# 数据缓存 > 数据预拉取和周期性更新
| API | 是否可用 |
|---|---|
| getBackgroundFetchData | ✅ 可用 |
| getBackgroundFetchToken | ✅ 可用 |
| onBackgroundFetchData | ✅ 可用 |
| setBackgroundFetchToken | ✅ 可用 |
# 文件
| API | 是否可用 |
|---|---|
| getFileSystemManager | ✅ 可用 |
| saveFileToDisk | ❌ 不可用 |
# 渲染 > 图片
| API | 是否可用 |
|---|---|
| createImage | ✅ 可用 |
| createImageData | ✅ 可用 |
# 渲染 > 字体
| API | 是否可用 |
|---|---|
| getTextLineHeight | ✅ 可用 |
| loadFont | ✅ 可用 |
# 渲染 > 帧率
| API | 是否可用 |
|---|---|
| setPreferredFramesPerSecond | ✅ 可用 |
# 渲染 > 画布
| API | 是否可用 |
|---|---|
| createCanvas | ✅ 可用 |
| createPath2D | ✅ 可用 |
# 渲染 > 鼠标样式
| API | 是否可用 |
|---|---|
| exitPointerLock | ✅ 可用 |
| isPointerLocked | ✅ 可用 |
| requestPointerLock | ✅ 可用 |
| setCursor | ✅ 可用 |
# 界面 > 交互
| API | 是否可用 |
|---|---|
| hideLoading | ✅ 可用 |
| hideToast | ✅ 可用 |
| showActionSheet | ✅ 可用 |
| showLoading | ✅ 可用 |
| showModal | ✅ 可用 |
| showToast | ✅ 可用 |
# 界面 > 窗口
| API | 是否可用 |
|---|---|
| onWindowResize / offWindowResize | ✅ 可用 |
| onWindowStateChange / offWindowStateChange | ✅ 可用 |
| setWindowSize | ✅ 可用 |
# 界面 > 菜单
| API | 是否可用 |
|---|---|
| getMenuButtonBoundingClientRect | ✅ 可用 |
| getOfficialComponentsInfo | ❌ 不可用 |
| onOfficialComponentsInfoChange / offOfficialComponentsInfoChange | ❌ 不可用 |
| setMenuStyle | ✅ 可用 |
# 网络 > TCP 通信
| API | 是否可用 |
|---|---|
| createTCPSocket | ✅ 可用 |
# 网络 > UDP 通信
| API | 是否可用 |
|---|---|
| createUDPSocket | ✅ 可用 |
# 网络 > WebSocket
| API | 是否可用 |
|---|---|
| closeSocket | ✅ 可用 |
| connectSocket | ✅ 可用 |
| onSocketClose | ✅ 可用 |
| onSocketError | ✅ 可用 |
| onSocketMessage | ✅ 可用 |
| onSocketOpen | ✅ 可用 |
| sendSocketMessage | ✅ 可用 |
# 网络 > 上传
| API | 是否可用 |
|---|---|
| uploadFile | ✅ 可用 |
# 网络 > 下载
| API | 是否可用 |
|---|---|
| downloadFile | ✅ 可用 |
# 网络 > 发起请求
| API | 是否可用 |
|---|---|
| request | ✅ 可用 |
# 设备 > 内存
| API | 是否可用 |
|---|---|
| onMemoryWarning / offMemoryWarning | ✅ 可用 |
# 设备 > 剪贴板
| API | 是否可用 |
|---|---|
| getClipboardData | ✅ 可用 |
| setClipboardData | ✅ 可用 |
# 设备 > 加速计
| API | 是否可用 |
|---|---|
| onAccelerometerChange / offAccelerometerChange | ✅ 可用 |
| startAccelerometer | ✅ 可用 |
| stopAccelerometer | ✅ 可用 |
# 设备 > 屏幕
| API | 是否可用 |
|---|---|
| getScreenBrightness | ✅ 可用 |
| getScreenRecordingState | ✅ 可用 |
| onScreenRecordingStateChanged / offScreenRecordingStateChanged | ✅ 可用 |
| onUserCaptureScreen / offUserCaptureScreen | ✅ 可用 |
| setKeepScreenOn | ✅ 可用 |
| setScreenBrightness | ✅ 可用 |
| setVisualEffectOnCapture | ✅ 可用 |
# 设备 > 振动
| API | 是否可用 |
|---|---|
| vibrateLong | ✅ 可用 |
| vibrateShort | ✅ 可用 |
# 设备 > 游戏手柄
| API | 是否可用 |
|---|---|
| getGamepads | ✅ 可用 |
| onGamepadConnected | ✅ 可用 |
| onGamepadDisconnected | ✅ 可用 |
# 设备 > 滚轮
# 设备 > 电量
| API | 是否可用 |
|---|---|
| getBatteryInfo | ✅ 可用 |
| getBatteryInfoSync | ✅ 可用 |
# 设备 > 网络
| API | 是否可用 |
|---|---|
| getLocalIPAddress | ❌ 不可用 |
| getNetworkType | ✅ 可用 |
| onNetworkStatusChange / offNetworkStatusChange | ✅ 可用 |
| onNetworkWeakChange / offNetworkWeakChange | ✅ 可用 |
# 设备 > 罗盘
| API | 是否可用 |
|---|---|
| onCompassChange / offCompassChange | ✅ 可用 |
| startCompass | ✅ 可用 |
| stopCompass | ✅ 可用 |
# 设备 > 触摸
| API | 是否可用 |
|---|---|
| onTouchCancel / offTouchCancel | ✅ 可用 |
| onTouchEnd / offTouchEnd | ✅ 可用 |
| onTouchMove / offTouchMove | ✅ 可用 |
| onTouchStart / offTouchStart | ✅ 可用 |
# 设备 > 设备方向
| API | 是否可用 |
|---|---|
| onDeviceMotionChange / offDeviceMotionChange | ✅ 可用 |
| startDeviceMotionListening | ✅ 可用 |
| stopDeviceMotionListening | ✅ 可用 |
# 设备 > 转屏
| API | 是否可用 |
|---|---|
| onDeviceOrientationChange / offDeviceOrientationChange | ✅ 可用 |
| setDeviceOrientation | ✅ 可用 |
# 设备 > 键盘
| API | 是否可用 |
|---|---|
| hideKeyboard | ✅ 可用 |
| onKeyboardComplete / offKeyboardComplete | ✅ 可用 |
| onKeyboardConfirm / offKeyboardConfirm | ✅ 可用 |
| onKeyboardHeightChange / offKeyboardHeightChange | ✅ 可用 |
| onKeyboardInput / offKeyboardInput | ✅ 可用 |
| onKeyDown / offKeyDown | ✅ 可用 |
| onKeyUp / offKeyUp | ✅ 可用 |
| showKeyboard | ✅ 可用 |
| updateKeyboard | ✅ 可用 |
# 设备 > 陀螺仪
| API | 是否可用 |
|---|---|
| onGyroscopeChange / offGyroscopeChange | ✅ 可用 |
| startGyroscope | ✅ 可用 |
| stopGyroscope | ✅ 可用 |
# 设备 > 鼠标
| API | 是否可用 |
|---|---|
| onMouseDown / offMouseDown | ✅ 可用 |
| onMouseMove / offMouseMove | ✅ 可用 |
| onMouseUp / offMouseUp | ✅ 可用 |
# 跳转
| API | 是否可用 |
|---|---|
| exitMiniProgram | ✅ 可用 |
| navigateBackMiniProgram | ✅ 可用 |
| navigateToMiniProgram | ✅ 可用 |
| restartMiniProgram | ✅ 可用 |
# 全部不可用的分类
以下分类中的 API 在出海小游戏中均不可用。
# AI > AI 推理
| API | 是否可用 |
|---|---|
| createInferenceSession | ❌ 不可用 |
| getInferenceEnvInfo | ❌ 不可用 |
# AI > 人脸检测
| API | 是否可用 |
|---|---|
| faceDetect | ❌ 不可用 |
| initFaceDetect | ❌ 不可用 |
| stopFaceDetect | ❌ 不可用 |
# AI > 视觉算法
| API | 是否可用 |
|---|---|
| createVKSession | ❌ 不可用 |
| isVKSupport | ❌ 不可用 |
# 位置
| API | 是否可用 |
|---|---|
| getFuzzyLocation | ❌ 不可用 |
| getLocation | ❌ 不可用 |
# 媒体 > 实时语音
| API | 是否可用 |
|---|---|
| exitVoIPChat | ❌ 不可用 |
| joinVoIPChat | ❌ 不可用 |
| onVoIPChatInterrupted / offVoIPChatInterrupted | ❌ 不可用 |
| onVoIPChatMembersChanged / offVoIPChatMembersChanged | ❌ 不可用 |
| onVoIPChatSpeakersChanged / offVoIPChatSpeakersChanged | ❌ 不可用 |
| onVoIPChatStateChanged / offVoIPChatStateChanged | ❌ 不可用 |
| updateVoIPChatMuteConfig | ❌ 不可用 |
# 媒体 > 录音
| API | 是否可用 |
|---|---|
| getRecorderManager | ❌ 不可用 |
# 开放接口 > OPENLINK
| API | 是否可用 |
|---|---|
| createPageManager | ❌ 不可用 |
# 开放接口 > 卡券
# 开放接口 > 客服消息
| API | 是否可用 |
|---|---|
| openCustomerServiceConversation | ❌ 不可用 |
# 开放接口 > 开放数据
| API | 是否可用 |
|---|---|
| getUserInteractiveStorage | ❌ 不可用 |
| onInteractiveStorageModified / offInteractiveStorageModified | ❌ 不可用 |
| removeUserCloudStorage | ❌ 不可用 |
| setUserCloudStorage | ❌ 不可用 |
# 开放接口 > 开放数据域
| API | 是否可用 |
|---|---|
| getOpenDataContext | ❌ 不可用 |
| onMessage | ❌ 不可用 |
# 开放接口 > 微信客服
| API | 是否可用 |
|---|---|
| openCustomerServiceChat | ❌ 不可用 |
# 开放接口 > 微信小店
| API | 是否可用 |
|---|---|
| createStoreGift | ❌ 不可用 |
# 开放接口 > 微信群
| API | 是否可用 |
|---|---|
| getGroupEnterInfo | ❌ 不可用 |
# 开放接口 > 微信运动
| API | 是否可用 |
|---|---|
| getWeRunData | ❌ 不可用 |
# 开放接口 > 意见反馈
| API | 是否可用 |
|---|---|
| createFeedbackButton | ❌ 不可用 |
# 开放接口 > 我的小程序
| API | 是否可用 |
|---|---|
| checkIsAddedToMyMiniProgram | ❌ 不可用 |
# 开放接口 > 游戏圈
| API | 是否可用 |
|---|---|
| createGameClubButton | ❌ 不可用 |
| getGameClubData | ❌ 不可用 |
# 开放接口 > 视频号
| API | 是否可用 |
|---|---|
| getChannelsLiveInfo | ❌ 不可用 |
| getChannelsLiveNoticeInfo | ❌ 不可用 |
| openChannelsActivity | ❌ 不可用 |
| openChannelsEvent | ❌ 不可用 |
| openChannelsLive | ❌ 不可用 |
| openChannelsUserProfile | ❌ 不可用 |
| reserveChannelsLive | ❌ 不可用 |
# 开放接口 > 订阅消息
| API | 是否可用 |
|---|---|
| requestSubscribeMessage | ❌ 不可用 |
| requestSubscribeSystemMessage | ❌ 不可用 |
# 开放接口 > 设置
| API | 是否可用 |
|---|---|
| createOpenSettingButton | ❌ 不可用 |
| getSetting | ❌ 不可用 |
| openSetting | ❌ 不可用 |
# 游戏对局回放
| API | 是否可用 |
|---|---|
| createGameRecorderShareButton | ❌ 不可用 |
| getGameRecorder | ❌ 不可用 |
| operateGameRecorderVideo | ❌ 不可用 |
# 游戏服务
| API | 是否可用 |
|---|---|
| getGameServerManager | ❌ 不可用 |
# 界面 > 状态栏
| API | 是否可用 |
|---|---|
| setStatusBarStyle | ❌ 不可用 |
# 第三方平台
| API | 是否可用 |
|---|---|
| getExtConfig | ❌ 不可用 |
| getExtConfigSync | ❌ 不可用 |
# 聊天工具
| API | 是否可用 |
|---|---|
| exitChatTool | ❌ 不可用 |
| getChatToolInfo | ❌ 不可用 |
| isChatTool | ❌ 不可用 |
| notifyGroupMembers | ❌ 不可用 |
| openChatTool | ❌ 不可用 |
| selectGroupMembers | ❌ 不可用 |
| shareAppMessageToGroup | ❌ 不可用 |
| shareEmojiToGroup | ❌ 不可用 |
| shareImageToGroup | ❌ 不可用 |
| shareTextToGroup | ❌ 不可用 |
| shareVideoToGroup | ❌ 不可用 |
# 虚拟支付
| API | 是否可用 |
|---|---|
| requestMidasPayment | ❌ 不可用,请使用出海专用接口,见 出海小游戏支付开发者接入文档 |
| requestMidasPaymentGameItem | ❌ 不可用,请使用出海专用接口,见 出海道具直购开发者接入文档 |
# 设备 > 扫码
| API | 是否可用 |
|---|---|
| scanCode | ❌ 不可用 |
# 设备 > 蓝牙-低功耗中心设备
| API | 是否可用 |
|---|---|
| closeBLEConnection | ❌ 不可用 |
| createBLEConnection | ❌ 不可用 |
| getBLEDeviceCharacteristics | ❌ 不可用 |
| getBLEDeviceRSSI | ❌ 不可用 |
| getBLEDeviceServices | ❌ 不可用 |
| getBLEMTU | ❌ 不可用 |
| notifyBLECharacteristicValueChange | ❌ 不可用 |
| onBLECharacteristicValueChange / offBLECharacteristicValueChange | ❌ 不可用 |
| onBLEConnectionStateChange / offBLEConnectionStateChange | ❌ 不可用 |
| onBLEMTUChange / offBLEMTUChange | ❌ 不可用 |
| readBLECharacteristicValue | ❌ 不可用 |
| setBLEMTU | ❌ 不可用 |
| writeBLECharacteristicValue | ❌ 不可用 |
# 设备 > 蓝牙-低功耗外围设备
| API | 是否可用 |
|---|---|
| createBLEPeripheralServer | ❌ 不可用 |
| onBLEPeripheralConnectionStateChanged / offBLEPeripheralConnectionStateChanged | ❌ 不可用 |
# 设备 > 蓝牙-信标(Beacon)
| API | 是否可用 |
|---|---|
| getBeacons | ❌ 不可用 |
| onBeaconServiceChange / offBeaconServiceChange | ❌ 不可用 |
| onBeaconUpdate / offBeaconUpdate | ❌ 不可用 |
| startBeaconDiscovery | ❌ 不可用 |
| stopBeaconDiscovery | ❌ 不可用 |
# 设备 > 蓝牙-通用
| API | 是否可用 |
|---|---|
| closeBluetoothAdapter | ❌ 不可用 |
| getBluetoothAdapterState | ❌ 不可用 |
| getBluetoothDevices | ❌ 不可用 |
| getConnectedBluetoothDevices | ❌ 不可用 |
| isBluetoothDevicePaired | ❌ 不可用 |
| makeBluetoothPair | ❌ 不可用 |
| onBluetoothAdapterStateChange / offBluetoothAdapterStateChange | ❌ 不可用 |
| onBluetoothDeviceFound / offBluetoothDeviceFound | ❌ 不可用 |
| openBluetoothAdapter | ❌ 不可用 |
| startBluetoothDevicesDiscovery | ❌ 不可用 |
| stopBluetoothDevicesDiscovery | ❌ 不可用 |
# 转发
| API | 是否可用 |
|---|---|
| authPrivateMessage | ❌ 不可用 |
| getShareInfo | ❌ 不可用 |
| hideShareMenu | ❌ 不可用 |
| onAddToFavorites / offAddToFavorites | ❌ 不可用 |
| onCopyUrl / offCopyUrl | ❌ 不可用 |
| onHandoff / offHandoff | ❌ 不可用 |
| onShareAppMessage / offShareAppMessage | ❌ 不可用 |
| onShareMessageToFriend / offShareMessageToFriend | ❌ 不可用 |
| onShareTimeline / offShareTimeline | ❌ 不可用 |
| setHandoffQuery | ❌ 不可用 |
| setMessageToFriendQuery | ❌ 不可用 |
| shareAppMessage | ❌ 不可用 |
| showShareImageMenu | ❌ 不可用 |
| showShareMenu | ❌ 不可用 |
| updateShareMenu | ❌ 不可用 |