如何从 webOS 应用程序获取使用数据并远程存储该数据?
我是 webOS 开发的新手。我在应用程序商店中有一个应用程序,在该应用程序的下一次更新中,我希望能够识别用户的年龄、他们的位置、他们使用该应用程序的时间、他们使用最多/最少的功能,然后存储数据库中的数据。我该怎么做?非常感谢您的帮助。
I am new to webOS development. I have one app in the app store and in the next update to the app I would like to be able to identify the age of users, their location, how long they use the app, which features they use the most/least and then store that data in a database. How do I do this? Many thanks in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,这是一个很大的问题。以下是要做什么的概述,以及一些注释。
首先,除非您直接询问用户并且他们告诉您,否则您可能无法获得年龄。此外,只有当应用程序具有位置感知功能并且用户允许您收集该数据时,您才能获取位置(当您安装位置感知应用程序时,它会询问用户是否同意该位置)应用程序将能够获取他们的位置)。
至于他们使用应用程序的时间和使用哪些功能,那就更容易了。根据您需要/想要捕获的粒度,您可以仅在用户开始和停止使用特定功能时记录时间戳,例如当场景激活和停用方法触发时。只要您存储功能名称和时间戳,就应该为您提供所需的内容。
接下来就是收藏的问题了。无论您如何将其存储在应用程序中,您都可以选择如何将其从应用程序中取出。除非您能让用户通过电子邮件将数据发送给您,否则最简单的方法可能是使用 Google 之类的工具创建一个网络应用程序(可能没有面向用户的输出,因为您只是用它来收集数据) App Engine 为您提供一个 URL,您可以使用 HTTP 请求向其发送 POST 请求。根据您的设置方式,它可以在每次收集时间戳时执行请求(不过,这对电池使用不利),只是偶尔,或者仅在应用程序正在进行清理时执行请求(如果您没有收到时间戳,则可能会出现问题)请及时下班)。
我建议您在线查看人们如何在 iPhone 应用程序中执行此类操作,以便更好地了解如何执行此类操作。如果您在使特定的事情正常工作时遇到问题,您当然可以来到 StackOverflow 并提出具体的编码问题。
Well, that's a pretty big question. Here's an outline of what to do, with some notes.
First, you're probably not going to be able to get age unless you ask the user directly and they tell you. Also, you're only going to get location if the application is location-aware and the user permits you to collect that data (when you install a location-aware application, it asks the user if they're okay with the fact that the application will be able to get their location).
As for how long they use the app and which features they use, that's easier. Depending on the granularity you need/want to capture, you can just record time stamps when a user starts and stops using a particular feature, such as when scene activate and deactivate methods fire. As long as you store feature name and timestamp, that should give you what you're looking for.
Then comes to question of collection. However you store it in the app, you have a couple of choices for how to get it out of the app. Unless you can get your users to just email the data to you, probably the easiest thing to do would be to create a web app (possibly with no user facing output, since you're just using it to collect data) using something like Google App Engine that gives you a URL you can send a POST request to using an HTTP request. Depending on how you set it up, it could do the request every time you collect a timestamp (bad for battery use, though), just occasionally, or only when the app is doing cleanup (possibly a problem if you don't get the request off in time).
I'd recommend taking a look online at how people do this type of thing in iPhone apps to get a good sense of how to do this type of thing. If you hit problems getting particular things to work, you can of course come here to StackOverflow with specific coding questions.