android.provider.Settings.ACTION_BLUETOOTH_SETTINGS在Samsung上崩溃 [英] android.provider.Settings.ACTION_BLUETOOTH_SETTINGS crashes on Samsung

查看:303
本文介绍了android.provider.Settings.ACTION_BLUETOOTH_SETTINGS在Samsung上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道为什么

Intent pairIntent = new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
startActivityForResult(pairIntent, 0);

在所有三星设备上都崩溃,但在仿真器,HTC,索尼,LG等上都能正常工作.

Crashes on all Samsung devices, but works fine on emulator, HTC, Sony, LG etc.

已编辑-----------------------------------

EDITED -----------------------------------

结果证明,三星在清单中也需要BLUETOOTH_ADMIN

Turns out Samsung also requires BLUETOOTH_ADMIN in the manifest

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

推荐答案

如果您正在生产应用程序,则需要具有某物,该文件将使您能够获取崩溃日志.这可能是您通过Play商店运送的默认商品,或者是ACRA之类的开源解决方案,或者是任何数量的服务提供商.

If you have an app in production, you need to have something that will allow you to get crash logs. That could be the default stuff that you get from shipping through the Play Store, or an open source solution like ACRA, or any number of service providers.

关于崩溃,不能保证此活动可用.引用文档:

With regards to your crash, there is no guarantee that this activity is available. Quoting the documentation:

在某些情况下,可能不存在匹配的活动,因此请确保对此加以防范.

In some cases, a matching Activity may not exist, so ensure you safeguard against this.

保护措施"可能会将您的startActivity()调用包装在异常处理程序中,以监视ActivityNotFoundException.

The "safeguard" could be wrapping your startActivity() call in an exception handler, watching for ActivityNotFoundException.

此外,请注意,此Intent操作将使用startActivity(),而不是startActivityForResult().再次引用文档:

Also, please note that you use startActivity(), not startActivityForResult(), with this Intent action. Again, quoting the documentation:

输出:无.

Output: Nothing.

这意味着没有结果,使用startActivityForResult()浪费时间.

This means that there is no result, and using startActivityForResult() is a waste of time.

这篇关于android.provider.Settings.ACTION_BLUETOOTH_SETTINGS在Samsung上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆