根据序列号/唯一 ID 确定设备类型

发布于 2024-12-24 16:52:37 字数 616 浏览 1 评论 0原文

我们在 iPhone 和 Android(以及即将发布的 Blackberry)上提供移动应用程序。应用程序的功能是相同的 - 我们只是支持几种不同的设备。该应用程序与后端 Web 服务通信以接收数据。

现在,在Web应用程序中,有什么方法可以轻松确定正在连接的设备类型吗?这是我可用的:

  1. 设备的序列号(或唯一 ID)(请注意,在 Android 模拟器中,它始终为 000000000000,而在 iPhone 模拟器中,格式与实际 iPhone 完全不同)

  2. 在 iPhone 应用程序中,使用 NSMutableUrlRequest / NSURLConnection 建立连接,在 Android 中使用 org.apache.http.client.HttpClient 建立连接 p>

  3. 服务器 Web 应用程序被写成 。

  4. 我愿意接受“最佳猜测”近似值:如果 95% 的时间我都是正确的,那么就足以满足我的目的。

我不确定黑莓的任何东西,因为该应用程序还没有准备好。

非常感谢任何想法/帮助。非常感谢。

We have mobile applications on iPhone and Android (and soon to be released Blackberry). The app functionality is the same - we just support several different devices. The app communicates with a back-end web service to receive data.

Now, in the web application, is there any way to easily determine what type of device is connecting to it? Here's what I have available:

  1. serial number (or unique ID) of the device (note that in android simulator it's always 000000000000 and in iphone simulator the format is totally different from actual iphone)

  2. in iphone app, connections are made using NSMutableUrlRequest / NSURLConnection, in Android connections are made using org.apache.http.client.HttpClient

  3. The server web app is written in PHP.

  4. I am willing to settle for a "best-guess" approximation: if I'm right 95% of the time, it's good enough for my purpose.

I'm not sure about any of the blackberry stuff, because that app is still not ready.

Any ideas/help are greatly appreciated. Many thanks.

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

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

发布评论

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

评论(1

三生一梦 2024-12-31 16:52:37

您可以查看正在访问 HTTP API 的用户代理并嗅探它。这至少在 95% 的情况下都有效。 iOS 应用程序中将包含类似 CFNetwork/xxx.xx.x 的内容。对于 Android / Blackberry,只需尝试一下,看看它们是什么。或者更改您的应用程序以自行设置用户代理,这样您就可以准确地知道您的应用程序的版本等正在访问 API。

You could look at the user agent that is hitting the HTTP API and sniff that. That'll work at least 95% of the time. iOS apps will have something like CFNetwork/xxx.xx.x in them. For Android / Blackberry just try it out and see what they are. Alternatively change your app to set the user agent yourself so you will know exactly what version of your app, etc is hitting the API.

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