[英]what is the best way to transfer data from android app to a database on server?
I have a game for Android device and I want to upload highscore to a server. 我有一个适用于Android设备的游戏,我想将高分上传到服务器。 So far I am using url to transfer data to a php file on server which puts data to db, this is not secure as anyone can change url and make highscore .
到目前为止,我正在使用url将数据传输到服务器上的php文件中,该文件将数据放入db,这并不安全,因为任何人都可以更改url并获得高分。 What is the most common way to do so , is direct db connection in app secure ??
最常见的方法是在应用程序中直接建立数据库连接安全? Thanks
谢谢
-----edit----- What if I want to upload large amount of data for example I want to backup sms nd contacts on a server, and I want the sms to be uploaded as soon as it arrives. -----编辑-----如果我想上传大量数据,例如,我想在服务器上备份短信和联系人,并且希望短信到来就立即上传。
If you do not care the delay between sending data and storing to database you can use Google's GCM service. 如果您不在乎发送数据和存储到数据库之间的延迟,则可以使用Google的GCM服务。 Then all the security issues are handled by Google: You send a GCM Bundle to your server via Google Cloud.
然后,所有安全问题都由Google处理:您将GCM捆绑包通过Google Cloud发送到您的服务器。 But there might be a delay between sending on the device and receiving the data on the server.
但是在设备上发送和在服务器上接收数据之间可能会有延迟。
Some links that will help you: 一些链接将帮助您:
http://developer.android.com/google/gcm/ccs.html http://developer.android.com/google/gcm/ccs.html
http://javapapers.com/android/google-cloud-messaging-gcm-ccs-with-xmpp/ http://javapapers.com/android/google-cloud-messaging-gcm-ccs-with-xmpp/
But you need a server with a running GCM server programm (Java but also possible in Python and even PHP). 但是,您需要一台运行GCM服务器程序的服务器(Java,但在Python甚至PHP中也可以)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.