I think question title is self explanatory, however following are more details
Background
I am developing one turn based android game with the help of Firebase realtime database. Concept is very simple, all players are connected to single room which I create by pushing into firebase database. Now every player attaches child value listener to that node. Now I can update game status in this node and everyone will get update in real time.
Problem
During development phase, I am still trying out different ways to structuring this data and implementing in android client. I am not working on any company or enterprise hence I have to use my own mobile internet (where internet data is costly). Plus many times I am in area where there is no internet connectivity. This reduces amount of time spent on testing any network related testing.
Question
Is there way I can simulate (or emulate) firebase database locally ? So that once it is working fine, I can test it on real network ? Any ideas or hints regarding this will be helpful.
It sounds like you probably want to try firebase-server. It is basically a replacement Real-Time Database server that you can run locally.
You need to edit your OS's hosts file to make a 3-part domain name (like localhost.firebaseio.test) resolve to localhost, because of some weird restrictions built into the Firebase client libraries. Some people have found a way around this by injecting mocks into the client library, but this never worked for me; I think it only worked in an old version.
Note that this is NOT the officially recommended way to write unit tests; it's considered better to totally mock out the Firebase client library. It can be quite useful for integration tests, though.
There's a useful thread here that covers some testing questions.
You can use the Firebase Local Emulator Suite it has many modules (including the Realtime Database). Check their official docs here:
https://firebase.google.com/docs/emulator-suite/connect_and_prototype?database=RTDB
Related
I have an idea for a mobile app that I would like to make. I am experienced in programming locally on the device, but not so much at making something that has a server in it.
I have (rather hastily) rented a server at HostGator and rented the domain name.
I made a project for university before and did the server-side scripting, but it had flaws, wasn't well polished and took a lot of time. So I'd like to avoid it as much as possible.
I have been searching the internet from morning till night for services that would take the load of server-side from my bac.
I'm planning to build an iPhone and an android app that will actually be "wrappers" to my data on the server. I will need user accounts and databases in general. The app will basically connect the users in some way and organize events for them. I saw a lot of names like "Parse" and "Kinvey" but I'm not really sure if that's what I'm looking for or not. Would I need to build an API myself, put it on the server, and wrap the apps around it? Or is there (hopefully) another solution? I'm looking for general guidance and what to research exactly.
What you're looking for are BaaSs (Backend-as-a-Service) and there are plenty to choose from. I highly recommend Firebase as a starting point as it's pretty easy to work with and pretty fast to get up and running, though there may be a learning curve in grasping how you should define your data in an efficient way. Parse is now defunct and you'll probably still have to wrangle with trying to get it deployed to a server, which may be a daunting task if you don't have experience with that kind of stuff as it's now just an open source project that doesn't give you any server infrastructure to work with out of the box like they use to. Other promising BaaSs is Realm's mobile platform which I haven't tried yet.
I'm a complete beginner with mobile development. A friend of mine approached me with a project idea, asking me if it was possible to do it. The way I see it, it is a mobile app that needs to read and write data on a database in order to write inspection reports on the job of various staff members.
I told that friend that I would check how mobile development works first and would try to create a prototype to present. I've asked and Android is the main platform that is desired, so I've tried working with Android Studio and it is pretty straight forward up to now.
So, now I'm wondering what is the proper way to sync mobile apps with the database. Last time I worked with a database in a project we had multiple clients connecting to a server to play some small game together and the server would access the database and send the data back to the client through the network connection. So, I was wondering if a mobile app was supposed to use this communication structure or would simply talk directly to the database instead of a server.
The structure I have in mind:
Is this an acceptable structure? Or am I thinking of this the wrong way?
I am planning to build a web application and android app, which will manage huge numbers of notification (push notification), and can work in slow internet connection too. I need to send and get instant notifications. Number of users can be thousands or millions, application will have multiple servers (web farm), multiple database. Now I need to decide that which database will be best for this kind of application and which language should I use for programming. Please help me out. Any suggestions will be appreciated
Well, first you need to decide what your immediate needs are. Are you going to use this on a platforms that could potentially have hundreds of people accessing information at the same time? Then you need to estimate your future needs.
This will help you to decide your database system.
As per my experience i am suggesting you to use MYSQL database.
I Blindly Suggest you to Use Parse Cloud Database,as it provides SDK for All mobile Environments like Android and IOS for easy implementation and also it recently Launched a Javascript SDK to use.Its free for Trial.MultiPlatform Support and Secure
Check it out Here: https://www.parse.com/
Are you sure you going to get to thousands and millions users ? Everyone starts from scratch (read: zero users, except some friends). By this I mean, that you have to concentrate on what's the real issue within your development (growing app user base is different story):
Creation of Android app and it's lifecycle (updates, support of previous versions & etc).
Back-end. Will I also work on Back-end. Working on 2 'projects' (Android app and it's back-end) isn't easy. Not everyone is experienced enough to work on multiple assignments at the same time.
Valuate an option of using SaaS/Paas backend. Most of the have trial or free version for developer.
Third option is great. Get cheap/free web host. Store there configuration, that your Android app will download when it starts. In configuration you should declare what's the back-end and how to communicate with it. You can use any of known services like https://www.firebase.com or https://parse.com/plans or even use Google App engine free tier / AWS free tier.
About developing app for Android - if your app doesn't need any complex calculation or libraries - just write it with JavaScript. It's fast enough. Though, Java apps are always faster and easier to debug.
Good luck !
Local DB always sync to remote server sounds a great idea, because you get the responsiveness for using local DB, but also get sync crossing devices.
But can anybody talk about their experiences with couchbase on Android?
https://github.com/couchbase/Android-Couchbase/
What are other options out there? Cloudant?
Look at Touch-DB Android. It's more compact than Android-Couchbase and is still regularly updated and maintained (I believe the main contributor is working on a big release, which is why the last update we two months ago). The framework is built on top of Ektorp and emulates a CouchDB database on your Android device.
Replication to and from a remote database is fairly intuitive and easy to set-up.
I use CloudAnt as my remote back end for my Android game.
I can tell you that in general, it works. e.g. I have an android app that syncs with iriscouch.com. But you might want to ask a more specific question.
iBoxDB is another option. It is a lightweight database for java. You can customize replication.
https://github.com/iboxdb/forjava
I am completely new to Android development and have been reading many articles on the Android site and elsewhere. There are a lot of articles that give very specific examples, but I haven’t bumped into the articles explaining the following:
Logging-In:
I haven’t noticed market applications forcing me to create login credentials (per se), only verification of access to types of permissions. However, they surely must need some kind of login credential. This means Android is providing this access (somehow).
How?
What process?
Database Location:
Some articles I’ve read “imply” a copy of the applications database is located on the phone (itself), others imply a database located elsewhere (cloud etc.). Lastly, others imply they use both a local database for quick updates and a remote database for synching and error-analysis.
Is there a common database available for everyone to use?
I wouldn’t “think” so
Do you generate the local copy automatically every time?
Seems wasteful as you just have to re-create the whole thing and re-synch EVERY entity...but I’ve seen articles promote it.
Which databases are you using?
What best-practices do you use for synching?
Lastly:
If this forum isn't the right one I will be happy to move this question. I looked at the Android Enthusiast forum and it didn't look like the correct one either.
Logging in, I guess you want to take a look at AccountManager. However, since it's only available after API lvl 5 I am not sure how to do with previous versions since I haven't used it myself. http://developer.android.com/reference/android/accounts/AccountManager.html
Databases, for the applications that uses databases that I've done I have always used a local database on the device itself since the information has only been interested in one-way IE downloading and synching the device from web services.
For syncing both ways I would probably look at having variables which holds when the database were last updated so you know how much and what you need to update in order to have a fresh copy of the database. And then poll a web service to see if the user should update it's database or not.