How do I continually get info from a server? - android

I have an Android client that needs to request information from my server (using retrofit). The information on my server is updated randomly and can be updated at any moment and I am limited by the fact that I am not allowed to use cloud technologies, everything is to be self hosted. Does this prevent me from using GCM and Firebase? If so, are there more elegant solutions other than calling GET every second in the background?

Related

Android, API Server, and Firebase Database relation

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.

Sync data between Android App, Web and Desktop application

Currently, I have an App that sends data to web server.
But, if website sends data to the server, my App does not receive any data from the server.
I want to create an app like Evernote where I don't have to refresh the app to receive data from the server.
So when I sends data from mobile, it has to sync with all other devices.
How do I implement it?? Which method is best for android?
Is GCM the only way to do it?
We need more information regarding what you have tried implementing for us to provide a better solution since your issue is about code implementation.
You may check Firebase Realtime Database as this seems perfect for your situation because with Firebase, "data are synced across all clients in realtime, and remains available when your app goes offline". Since you are using Android, you can check this document: Set up Firebase Realtime Database for Android.

Using Parse.com as a middleman to provide user registration, etc. for my XMPP IM server

I've just started off with Parse.com and I'm loving the simplicity and effectiveness of the service so far.
My app will have an instant messaging feature for which, I realize, Parse is not suitable. I would still love to use Parse for user registration, easy Facebook and Google integration, and all the good things that come with it, but I also need to provide IM in my app.
I want to host my own XMPP server and somehow integrate this server with Parse.
My question is whether it will be possible to verify and create XMPP chat sessions between my users through Parse which will act as a middleman that provides username and password for authentication and to notify offline users through push notification, etc.
As I mentioned above, I would like to host my own XMPP server and would like to avoid services like Pusher.
However, I would like to know if there are any self hosted alternatives that have all the features of Parse as well as IM capabilities.
I used to use Parse.com as a mobile application server. I ended up moving to Amazon EC2 server on march this year. Because my users couldn't login Parse.com. This situation happens 1,2 or 3 times every week. Customers of Parse.com share servers which runs on Amazon Cloud Server.
If you think your app will be able to attract a lot of users, I think you better start with Amazon EC2. My server which runs on AWS has never gone down since I moved to this.
Although Parse.com provide simple and easy APIs which decrease repetitive work load for mobile applications, It is worth for you to implement them on your own. I think that can save your time eventually based on my experience.

Connect Android app to a webserver

Some advice comrades, am thinking of developing an android app that retrieves some updates from a website. In other words when content of the website is updated the app content is also updated. I have searched google and i can't get clear answers on how to do it. Anyone tell me what do i need to do to accomplish this task. I have read about json parsing and web services but everything is not clear since am new to network apps.
If your server is a standard http server, you'll need another server that can establish a connection with the android device.
You can implement it yourself (using TCP or UDP), or you can use the trusted Google GCM:
https://developer.android.com/google/gcm/index.html
I recommend using GCM, but in either way, you'll have to make your current server, to notify the other server when it needs to send a message to any device.

Android react to DB changes

I'm building an Android application that consumes a RESTful API.
When I make a http request to the server I get a JSON response that I can then parse and display appropriately on the screen. So far so good.
Now as my application is going to have multiple users I'd like to refresh this information to all users when any of them changes it.
I know that you can accomplish something similar using AngularJS but I'm not sure you can use that on Android.
My only other idea is to make http requests from the mobile app every X period of time, say 30 seconds (but this is not very elegant and would consume lots of network resources).
Any ideas of how to solve this? Thanks!
PD: I used Laravel to build my REST API.
Either you will use a background thread to check your server for changes every once in a while(basically polling from server), or you use push notifications (whenever something changes on your server side, server will push the data that changed to you). Preferably push should be the way you choose cause it is both user and battery friendly. Also eases your server load.
In android, push notifications implemented mostly by using GCM. You can read rest through here http://developer.android.com/google/gcm/index.html
For a local network, you can use MQTT. There is an excellent blog post about it here http://dalelane.co.uk/blog/?p=1599 .

Categories

Resources