Android设备返回SMS_NOT_SUPPORTED,但它是

发布于 2025-02-12 19:06:58 字数 1117 浏览 1 评论 0原文

我注意到一些Android设备(Galaxy Fold系列而非翻转)在调用GetSmsSupport()时返回SMS_NOT_SUPPORT,即使该设备显然支持SMS,因为它在权限中列出了SMS并能够发送SMS。下面的示例代码返回SMS_NOT_SUPPORTED。但是,如果我评论案例SMS_NOT_SUPPORT,则按照应该打开默认消息应用程序。

    try {
        switch(Display.getInstance().getSMSSupport()) {
            case Display.SMS_NOT_SUPPORTED:
                errMes = "SMS not supported by this device";
                return false;
            case Display.SMS_SEAMLESS:                    
                Display.getInstance().sendSMS(formatedIntercomTele,intercomMes, false);
                return true;
            case Display.SMS_INTERACTIVE:
                Display.getInstance().sendSMS(formatedIntercomTele,intercomMes, true); 
                return true;
            default:
                Display.getInstance().sendSMS(formatedIntercomTele,intercomMes, true); 
                return true;
        }            
    } catch (IOException ex) {
        errMes = "Unable to send message";
        return false;
    }         

我使用不同API级别的各种模拟器运行了我的应用程序。例如,API 30将使用翻转手机或标准手机,但是API 30将在设备打开的任何折叠手机上不支持像Galaxy Z Fold 3这样的书籍。

I've noticed some android devices (Galaxy Fold series not flip) are returning SMS_NOT_SUPPORTED when calling getSMSSupport(), even though the device clearly supports SMS since it has SMS listed in permissions and is able to send SMS. Example code below returns SMS_NOT_SUPPORTED. However, if I comment out case SMS_NOT_SUPPORTED the default messaging app opens as it should etc.

    try {
        switch(Display.getInstance().getSMSSupport()) {
            case Display.SMS_NOT_SUPPORTED:
                errMes = "SMS not supported by this device";
                return false;
            case Display.SMS_SEAMLESS:                    
                Display.getInstance().sendSMS(formatedIntercomTele,intercomMes, false);
                return true;
            case Display.SMS_INTERACTIVE:
                Display.getInstance().sendSMS(formatedIntercomTele,intercomMes, true); 
                return true;
            default:
                Display.getInstance().sendSMS(formatedIntercomTele,intercomMes, true); 
                return true;
        }            
    } catch (IOException ex) {
        errMes = "Unable to send message";
        return false;
    }         

I ran my app using various emulators at different API levels. API 30 for instance will work with a flip phone or standard phone however API 30 will return not supported on any fold phone where the device opens like a book such as the Galaxy Z fold 3.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国粹 2025-02-19 19:06:58

我认为我们可能需要将该代码调整为Galaxy Fold样式设备。为了避免权限提示,此API使用简单的启发式方法,即检查这是平板电脑还是台式机。

这曾经工作过,但是这样的设备既是手机和平板电脑,这是我们在编写该代码时没有预测的东西。我想我们需要修复方法在这里。我建议对此提出问题。

I think we might need to adapt that code to Galaxy Fold style devices. In order to avoid a permissions prompt this API uses a simple heuristic of checking if this is a tablet or desktop.

This used to work but devices like this are both a phone and a tablet which is something we didn't predict when writing that code. I guess we need to fix the method here. I suggest filing an issue on that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文