I'm developing an app which list the shops around my area by category. I have a REST API where the results would be returned in paginated mode (page=2, limit=20 etc) and users will need to login to the app in order to view the listing.
I'm thinking to incorporate offline 2 way sync into my app. The moment when user logs in for the first time he has to be connected to the internet and subsequently once he has logged in he should be able to proceed straight to the main screen eventhough the app is offline.
User also has the ability to post a review offline in which I suppose we should cache the post request in the DB and listen to network state changed event? Once there's a network then query everything in the cache and send to the server.
I understand how this can be achieved at high level but I'm still new to Android and not exposed to the popular libraries out there. Just wondering is there any library that is already doing all the magic for me?
I stumble across Sync Adapter and Content Provider but it seems like they are quite complicated to a beginner. Is there a simpler library that can achieve similar results?
Also from my understanding the way how it works would be.. there will be a service that periodically poll server for changes - and fetch when there's any then store into SQLite. On poll it will also retrieve client changes and send to server. When user views listing the app will retrieve from SQLite instead making request to the server - there is no direct interfacing between the App and server. Can anyone verify if my understanding is correct?
Related
So I have a project that I'm making which is An Android Application, which takes provides information taken from API Server (Laravel 5.x) and also provides live-chat feature
What I'm not sure of doing is how to handle the live-chat feature. Currently here's how the chat system works (keep in mind, there is also a Web App which provides the same feature, that I'm willing to change) :
User type chat and sends it. The client (Android app or Web App) sends it to the API Server. which then saves it to the database.
Then the API Server (which is connected to mysql database server) sends in email / notification which based on the other user's configuration.
When the other User opens the chat, it will call the API Server (which is connected to mysql database server) asking if there's an update every 3 seconds.
if there is, then (Android App or Web App) will show the new chat.
Now first of all I know that this is not efficient, bad on performance, etc.
Now I want to try and use firebase database for realtime chat.
Now, I really want to use the API Server for logging and storing Chat info inside my own database because of some legacy Android App which takes a long time to work on.
which is the better scenario :
The Android App directly sends new chat information to Firebase Database
The Android App sends new chat information to API Server. Then the API Server sends it to Firebase Database
Is there a better way to do this
so which is the better way to do this?
I would highly recommend using the firebase firestore. It sounds like it would solve the best of both worlds. Nosql json storage format is great for a chat app. Also the data is "live" so it will loosen for a change and update the user sides data. Saving you the 3 sec call resources. Last I checked it was still in beta but I used it top make an app that lets you create plus and live pools and it wad pretty smooth. It does take a bit to wrap your head around though.
I am very fairly novice to AndroidStudio and want to create a project of my own.
My question is:
Can you update a Database outside of republishing your app?
Say I have published the app and the Database is currently empty. Then later I want to add some data How would I add this data to the DB without having to change fundamental source code, or redevelop the app? I am using SQLite.
I would like to publish this application as a Network app. That is I want all users to view the same information from "empty" Database and whatever is populated. Could you guys give me a direction or a minimally functional example of Network apps / their requirements. I have never used or developed them before.
END_RESULT:
Users should download an app (this app) and be able to be able to collect news added to its feed.
The maintenance crew, should be able to add/populate the app via a database reasonably without having to redeploy the app every time new material is added.
You would have to implement some kind of server backend that your app communicates to in order to download new data. The app must already have logic for how to process that data and store it locally in SQLite, but that can be fairly straightforward. As for how to sync or download new data, there are several possibilities.
Perform a sync when the app starts. You may or may not want to do this if you are using some other (periodic) mechanism.
Schedule periodic syncs with JobScheduler. This is a good practice in that JobScheduler doesn't have to run your task at a specific time, it can run it within a certain time window so that your task coincides with other apps that need to run tasks. Since your task would spin up the radio and make network requests, the system can let other apps that need the radio also run at the same time to reduce the number of radio wakeups (and thus be more battery efficient).
Implement Google Cloud Messaging so that your backend can send a push notification to your app, and your app can receive this as a signal to perform a sync.
Note you aren't limited to only one of these.
Yes you can, if you add Realtime Database.
This is a database hosted on a server instead of directly on the phone, which can push informations to clients to synchronize new data on them.
Otherwise, you need to update the app to get new content.
One wonderful tool to achieve this is Firebase.
https://firebase.google.com/docs/database/
This is a very broad ended question and as such difficult to provide specific answer to. What do you mean by 'updating a database outside of republishing your app' ?
Do you mean update the database schema - YES, it can be done.
Put data into database - Yes, the app owning the database can do it anytime based on it's business logic.Which means the source code to insert the data should already be embedded into your published app. Only thing that should be decided on the fly, is when to execute this code.
Normally for a networked app, it's a norm to refresh the data when the app is launched. This means you can put a network call in your app's main screen launch and download whatever you wanted to download and put it into database. Your maintenance crew can put the data on a server and let the app download it.
Android has a plethora of network libraries and the choice depends on what kind of content you are downloading. Will suggest to try out Volley (Official from Google) and Retrofit (If you want something slicker)
Looking for some information and advice on the best way to go about using and integrating MongoDb for an Android App I am trying to develop. Last I looked around there was not an actual Android-MongoDb API that I am aware of so I am curious how this could be implemented. One of the biggest issues I am thinking about is connectivity while out in the field without network access since the app will be collecting data and I am wondering what is the best way to store the data locally on the device in cache until either service becomes available, or at the end of the day, the user can then upload the data. Thanks.
I have already an location based app which functionality i want to expand:
A user can login to this App via Facebook and also other users are logged on their own Mobilephone. Both can see the location of the other.
So basically an location aware meet people APP :-)
How can I do this? Backend with PHP and mysql database?
Are there already existing solutions I can use?
Tutorials available describing this?!
the infrastructure you need is achievable in many many programming languages and many types of databases.
In the end what you need is a server running that can store the location data sent from the users. Ideally i would tell you to use webservices in order to achieve this.
Next, you will need to implement a location service app that works on the user smartphone and uses the web services to send information and get information to and from the server.
Programming languagens you can achieve this are so many. For example, in the back end you can use a mysql database with a tomcat server. if u need a front-end for the server you can use java server pages, php, whatever u feel more confortable with.
for the mobile phone there are hybrid application for different OSs. for android specifically you will use java. if u want to save some info in the phones you can use a SQLite database. this is important if you want to send data only when internet connections are available.
Those are the kind of things you have to deal with. Hope i helped you.
Good luck.
I am planing to implement an app and I have come to a point where I don't know what is the best approach.
Scenario:
I have an app where I am making a todo list and I am adding 3 items. I use my phone for this.
Then I take my tablet and want to continue adding another task. Then after a while I take my wife's phone and want to add 2 new tasks.
Basically I want to have a very simple way of storing the tasks online and be able to sync it with the app.
I am seeing two possible ways:
have a web server with a database + web service calls. This has the disadvantage of having a host paid, learn some extra mysql + web service techniques.
store somehow the data on cloud and allow the app by login to access an account which stores the file. I am thinking here at something like Google Drive / Dropbox. But I don't know how I would be able to sync only the updated values, not the whole file. Because I am thinking, if I store all the tasks into one file, each time I update the file, I'll need to upload it fully, which is not the best approach.
I am open to any advices. What approach would you recommend ?
There's also Google Drive's "Application Data" folder.
https://developers.google.com/drive/android/appfolder
This has the advantage of using the user's storage space.
I would look into either Google App Engine or Amazon Web Services. They both give you free allotment of usage per month and if you go over then you start paying, chances are you wont get past the free tier for a while.
AWS is a bit more mature than GAE currently and seemed to be a bit easier to implement that GAE was when I was researching them
Take a look at the new training class for sync adapters:
http://developer.android.com/training/sync-adapters/index.html for the basics of sending data from your device to a server.
On the Android device, I suggest you store your tasks in a content provider. This helps you keep track of updates since the last time you synced. You can then query the provider during your sync, send only the data that's been updated, and store the data on the server.
You should probably store the last update time on the device, so you can tell if the server contains data that isn't yet on the device. Remember that you'll have to download tasks as well if you want all devices to be in sync.
You can try Google's Firebase. Firebase provides SDK for Android and iOS devices. And also, firebase supports offline and syncing. Firebase also provides object storage service. It easier to create firebase app than you think. Have look at this firebase's firestore service.
You can take a look at our Rethync framework (freeware with source) . Using it you can simplify the task of detecting modifications and sync only updated data. Next, Rethync provides both client- and server-side API so you can create your own service (and host it on the web side) or you can write your own transport for the cloud service of your choice (we will provide some transports in future, they are under development now).