Future<void> setTheme(MiniTheme theme)
_tcmppFlutterPlugin.setTheme(MiniTheme.dark);
Future<void> setLocale(String language,{String? region, String? variant})
_tcmppFlutterPlugin.setLocale("en", region: "us");
Future<void> moveMiniAppToFront(String appId) async {return TcmppFlutterPlatform.instance.moveMiniAppToFront(appId);}Future<void> moveFlutterToFront() async {return TcmppFlutterPlatform.instance.moveFlutterToFront();}
_tcmppFlutterPlugin.moveMiniAppToFront("testAppId");
tcmpp://host/path 这种以自定义 scheme 开头的链接,宿主可以接管这些链接的跳转操作,并自定义跳转行为,需实现 TcmppPlatformEventHandler 中的 interceptWebViewUrl 方法。Future<bool> interceptWebViewUrl(AppInfo? appInfo, String url) async {return false;}
@overrideFuture<bool> interceptWebViewUrl(AppInfo? appInfo, String url) async {print("SupperAppCustom interceptWebViewUrl:${appInfo?.appId} $url");if (url.startsWith("tcmpp://")) {/// 跳转自定义页面return true;}return false;}
/// 从原生 SDK 中获取调试信息。/// 返回一个包含配置和调试信息的映射,例如应用 ID、应用密钥、域名、SDK 版本等。Future<Map<String, dynamic>> getDebugInfo() async {return TcmppFlutterPlatform.instance.getDebugInfo();}
final infoMap = await _tcmppFlutterPlugin.getDebugInfo();final guid = (infoMap['GUID'] ?? "") as String;
/// 启用测试广告/// [enable] - 是否启用测试广告/// [rewardedUnitId] - 广告的奖励单元标识符/// [bannerUnitId] - 广告的横幅单元标识符Future<void> enableTestAd(bool enable, String rewardedUnitId,String bannerUnitId) async {return TcmppFlutterPlatform.instance.enableTestAd(enable, rewardedUnitId, bannerUnitId);}
_tcmppFlutterPlugin.enableTestAd(true, "testRewardedUnitId", "testBannerUnitId");
文档反馈