【问题标题】:SMS url on android with ionic 3 framework not opening messaging app带有ionic 3框架的android上的SMS url未打开消息传递应用程序
【发布时间】:2018-02-10 16:27:20
【问题描述】:

短信 url 在 iOS 上运行良好,可以正常打开消息应用程序,但在 android 上它不会打开消息应用程序,只会崩溃。有谁知道它为什么不打开android上的消息应用程序?

home.html

<h5 class="padding5"><a [href]="sanitize('sms:' + 1234567890)"><ion-icon class="contactIcons" name="text"></ion-icon></a></h5>

home.ts

  sanitize(url: string) {
    return this.sanitizer.bypassSecurityTrustUrl(url);
  }

【问题讨论】:

    标签: javascript android ios ionic-framework ionic3


    【解决方案1】:

    我认为您需要将正斜杠添加到您的短信链接中,如下所示:

    <a [href]="sanitize('sms://' + 1234567890)">
    

    还要确保在你的 config.xml 中允许 Intent:

    <allow-intent href="sms:*" />
    

    【讨论】:

    • 我按照你说的做了尝试,但还是不行。我收到此错误:net::err_unknown_url_scheme(sms://1234567890)
    • 您是否检查过 sanitize 函数所期望的字符串格式?这是将短信传递给离子中元素的正确方法。您可能需要将字符串传递给清理,然后在清理后添加斜杠,然后在视图中设置该引用。
    猜你喜欢
    • 2023-03-15
    • 1970-01-01
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 2020-10-27
    • 2021-12-15
    • 2019-06-12
    • 1970-01-01
    相关资源
    最近更新 更多