简体   繁体   English

Android“设备名称”相当于

[英]Android “device name” equivalent

I would like input in deciding what API-accessible field in Android is the best equivalent to an iPhone's "device name" (it will be used as non-essential login data passed to a server). 我想输入决定Android中哪些API可访问字段最适合iPhone的“设备名称”(它将用作传递给服务器的非必要登录数据)。 By device name, I do not mean "model", or any hardware- or software-related identifier, but more to do with the owner. 按设备名称,我不是指“模型”,或任何与硬件或软件相关的标识符,而是与所有者有关。 See How do you get an iPhone's device name for exactly what I'm referencing. 请参阅如何获取iPhone的设备名称,以确切了解我所引用的内容。

As an additional example, when faced with the same problem in BlackBerry, it was decided that the owner name was the best equivalent. 作为另一个例子,当在BlackBerry中遇到相同的问题时,确定所有者名称是最佳等价物。 (See answer in Get Blackberry Owner details (eg name/number) through API ) 通过API查看获取黑莓所有者详细信息(例如姓名/号码)中的答案)

So far, it looks to me like the best android-equivalent is using an AccountManager to return someone's google account email; 到目前为止,它看起来像最好的Android等效使用AccountManager返回某人的谷歌帐户电子邮件; see How can you get an Android user's email address? 你如何获得Android用户的电子邮件地址? . This seems to me like a pretty rough approximation, though; 不过,在我看来,这似乎是一个相当粗略的近似。 and would require adding another whole permission to the app just for some non-essential login data. 并且需要为应用添加另一个完整权限,仅用于一些非必要的登录数据。 Does anyone know of a better equivalent, and how to grab it? 有谁知道更好的等价物,以及如何抓住它?

Many thanks! 非常感谢!

If you look in Settings -> Wireless & Network Setting -> Bluetooth Settings There is an option to set the device name. 如果您查看设置 - >无线和网络设置 - >蓝牙设置有一个选项可以设置设备名称。 If the device name has not been set then I think it uses the persons account. 如果尚未设置设备名称,那么我认为它使用人员帐户。 You can access it through the BluetoothDevice.getName() method. 您可以通过BluetoothDevice.getName()方法访问它。 Not sure if that helps. 不确定这是否有帮助。

BluetoothAdapter.getDefaultAdapter.getName() is also returning null if the user has switched off BT eg for saving battery or for security reasons. 如果用户已关闭BT,例如为了节省电池或出于安全原因,BluetoothAdapter.getDefaultAdapter.getName()也返回null。 So it's not reliable, I'd say. 所以它不可靠,我会说。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM