A relational database shared by an android app and a website - the easy way

泪湿孤枕 提交于 2019-12-20 03:53:33

问题


I have a project where I will develop an android application and a website. They both should share the same database. I am trying to explore all the options and I am really confused.

Here are my requirements: 1- I need an extremely simple and EASY way. I am not trying to learn; I am just trying to get things done.

2- The database design includes relationships and foreign keys. Therefore, I need a relational database.

3- The users of the android app are limited; as it is not an app that will be on the store. And the rate of querying the database is not extensive, but the data stored will continuously increase. So, I guess scalability is important.

4- I do not have complex data types. Probably just text and numbers, although storing images would be nice, too.

5- I also want to mention that push notifications are needed.

I appreciate if you can provide me with examples for the option you recommend. I need to start as soon as possible.

Thank you


回答1:


Take a look at www.parse.com

It is a really simple cloud based database with nice API's for a lot of platforms. They support push notifications and nice features such as saveEventually() so that you do not need a stable internet connection.

Regarding the website, I have created a demo for Angular that is aimed at generating a simple CRUD (Create update and delete) interface for simple Parse objects.

You can find it here: parse-angular-crud-demo

Disclaimer: Currently the project has taken me a week to implement, so might very well be some shortcommings and/or bugs.

Might be a good starting point for you.

My experience with Parse:

The app that I have been developing is for a fire department. It receives all the relevant information during a turnout as SMS messages and displays them in large text. It can display hydrants and relevant pdf files to the address that they are moving towards.

I have used Parse to support shared preferences (profiles) between devices and used push notifications to broadcast received information about an alarm. This makes it easy to add more devices and makes the installation much quicker (as there are a lot of settings).

For the larger files (hydrants and pdf) I have used Dropbox Sync API but could just as well have been done with Parse. So there is nothing preventing you from extending with image support later on.




回答2:


Well, after you make your database you can make api or web service that will allow your android app to interact with database, and regarding websites it depends on technology you are using (for example Entity Framefork in .NET).

Assuming you know how to create database.




回答3:


  1. you have to make a api on the web side to manage database transaction. There you can validate the entries from the mobile.

2.the mobile should connect to the api and transfer the data to the api. Since all data are inserted /managed by api (website) you can ensure relational features there and or can use triggers or stored procedures in database.

3.you can save the file name of image in database if required. I think it will be the nice way to do it.



来源:https://stackoverflow.com/questions/22516721/a-relational-database-shared-by-an-android-app-and-a-website-the-easy-way

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!