You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否通过Flutter直接发起Android与iOS端的SIM通话?

Flutter 实现Android/iOS SIM通话方案

核心结论

Flutter没有原生跨平台API直接发起SIM通话/USSD操作,必须针对Android和iOS做差异化实现,且iOS受系统限制功能更有限。

Android端实现

  • 你用到的ussd_service包是Android端处理USSD的成熟方案,也可以用更通用的url_launcher包直接调用系统拨号能力,示例代码:
    import 'package:url_launcher/url_launcher.dart';
    
    Future<void> initiateCall(String number) async {
      final callUri = Uri(scheme: 'tel', path: number);
      if (await canLaunchUrl(callUri)) {
        await launchUrl(callUri);
      } else {
        throw Exception('Failed to launch call for $number');
      }
    }
    
  • 若需处理USSD,记得在AndroidManifest.xml中申请权限:
    <uses-permission android:name="android.permission.CALL_PHONE" />
    

iOS端限制与处理

  • iOS系统出于安全考虑,不允许APP直接发起USSD请求或静默触发通话,只能通过系统拨号界面间接操作:
    • 同样用url_launcher调用tel:协议,系统会弹出拨号界面,必须由用户手动确认后才能发起通话/USSD,代码和Android端一致,无需额外权限。
    • 不存在合法的方式绕过用户确认,这是iOS的硬性限制。

跨平台兼容建议

  • 用Flutter的Platform Channel封装统一接口:Android端复用ussd_service的逻辑,iOS端调用url_launcher跳转系统拨号,上层业务无需关心平台差异。
  • 对iOS用户提前说明操作流程,避免因需要手动确认引发误解。

内容的提问来源于stack exchange,提问作者Mustafa Kadhim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 19:32:41