如何在 Android 上创建社交网络应用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10649813/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create a social network app on Android
提问by Faizal
I want to build a social network app for Android. But, I don't know where to start. I tried to search in http://developer.android.comand many other tutorials. But, I didn't understand in data storage. In web development (PHP) for example, we need server and database (MySQL). How about the android app? I need to know the concept in developing social network app for Android, such as to store users' posts, comments, uploaded photos, google map data and so on. I don't want the code, I'm asking for idea and concept in developing social network app for Android.
我想为 Android 构建一个社交网络应用程序。但是,我不知道从哪里开始。我尝试在http://developer.android.com和许多其他教程中搜索。但是,我不了解数据存储。例如,在 Web 开发(PHP)中,我们需要服务器和数据库(MySQL)。安卓应用程序怎么样?我需要了解为Android开发社交网络应用程序的概念,例如存储用户的帖子、评论、上传的照片、谷歌地图数据等。我不想要代码,我在为 Android 开发社交网络应用程序时寻求想法和概念。
Any links to the suitable sites for me to start would be appreciated. Thanks.
任何指向适合我的网站的链接将不胜感激。谢谢。
回答by Nanne
You can use file-storage (sd-card), preferences (for settings and such) or SQLLIte for storage on an Android phone. But if it is an actually socialapp, I suspect you want users to be able to interact. Therefore, equivalent with php and mysql, your users might use their browser (phone in this case) to use the app, but they use your server to store the data (friends, likes, retweets, whathaveyous).
您可以使用文件存储(SD 卡)、首选项(用于设置等)或 SQLLite 在 Android 手机上进行存储。但如果它是一个真正的社交应用程序,我怀疑你希望用户能够进行交互。因此,等同于 php 和 mysql,您的用户可能会使用他们的浏览器(在这种情况下是手机)来使用该应用程序,但他们会使用您的服务器来存储数据(朋友、喜欢、转发、whathaveyous)。
So what you need to do for this to work is
所以你需要做的是让这个工作
- Make a server just like "normal" where you store the data. I suggest MySQL as you seem to know how that works
- Make an API to add data to that server. I suggest a RESTfull API in PHP, again as you seem to know how that works
- Write your app. Whenever you want to interact (for instance "like" a post) you send a request trough the API and that saves your action to the database.
- Your other users can see that like because their phones get their info trough the API form the same database.
- 使服务器就像存储数据的“普通”服务器一样。我建议使用 MySQL,因为您似乎知道它是如何工作的
- 制作一个 API 以将数据添加到该服务器。我建议在 PHP 中使用 RESTfull API,因为您似乎知道它是如何工作的
- 编写您的应用程序。每当您想要交互(例如“喜欢”帖子)时,您都可以通过 API 发送请求并将您的操作保存到数据库中。
- 您的其他用户可以看到这一点,因为他们的手机通过 API 形成相同的数据库获取他们的信息。
Now the settings (how many times does the app check for new messages) are saved in a preferences file (you can find that on the developer pages), and some extra things might be saved on the sd-card (images etc).
现在设置(应用程序检查新消息的次数)保存在首选项文件中(您可以在开发人员页面上找到),并且一些额外的内容可能保存在 SD 卡上(图像等)。
So the APP part is quite easy, and no problem to figure out using the manual, the SOCIAL part you need to do what I described above. Yes this is some work, but there is enough written about php-mysql interaction using an app.
所以APP部分还是很简单的,使用手册搞清楚没问题,SOCIAL部分你需要做我上面描述的。是的,这是一些工作,但是关于使用应用程序进行 php-mysql 交互的文章已经足够多了。