简体   繁体   English

Android Studio 连接在线数据库的方法

[英]How to connect to online database in Android Studio

I'm making an Android app that displays my and other groups' university schedule.我正在制作一个 Android 应用程序来显示我和其他小组的大学时间表。

I wrote a program that scrapes the schedule and inserts it into remote mysql database.我写了一个程序来抓取时间表并将其插入远程 mysql 数据库。 The schedule changes sometimes, so i would need to update it from time to time, that's why i want to be able to download content from online database when an update is available, and then store it locally.时间表有时会更改,所以我需要不时更新它,这就是为什么我希望能够在更新可用时从在线数据库下载内容,然后将其存储在本地。

The app is supposed to be public, so i don't want to hard code database credentials into app.该应用程序应该是公开的,所以我不想将数据库凭据硬编码到应用程序中。 I have looked around over here, but I was not able to find a solution that would fit my problem, and also be understandable for me.我环顾四周,但找不到适合我的问题的解决方案,而且对我来说也是可以理解的。

This is my first post, I would appreciate any help or advice:D这是我的第一篇文章,我将不胜感激任何帮助或建议:D

Welcome.欢迎。 You cannot just connect to your mysql server without exposing your credentials.你不能只连接到你的 mysql 服务器而不暴露你的凭据。 I would recommend either creating a web service to return your database content or using some third party solution like firebase firestore https://firebase.google.com/docs/firestore , which seems like a good option for your use case.我建议创建一个网络服务来返回您的数据库内容或使用一些第三方解决方案,如 firebase firestore https://firebase.google.com/docs/firestore ,这对于您的用例来说似乎是一个不错的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM