Best way to detect changes in an API response - android

Hey so basically I have a school API that provides me some informations about current courses, homeworks, etc, and so they differs depending on the current time. I would like to build an Android application around that API that would send me a notification when there is a different course happening, or when i get a new homework or anything else.
So what is the best way to achieve this? I tought about making a loop that will send a request to the API every x secondes/minutes and if it retrieves different informations than the current informations I already have, it sends a notification or anything else. But I'm not sure if it's the best way to make it.
I also heard about the observer pattern but I'm not sure if it's applicable there since I have no control on the state changement at the API level.
Thanks for you answers, I hope I'm clear about what I'm trying to achieve, feel free to ask if you want more informations.

You will have a hard with that if you want to implement the querying within the app. I'd suggest you to build a server application that constantly queries the API and sends out a push notification (for example via Firebase Cloud Messaging) to all users that are subscribed to your server application.

Related

Android: How to post live commentary and match updates

I'm sorry but I'm really bad at this. So do bear with me.
A few questions:
1.) How do live score apps provide line-ups, live commentary etc. ?
Do they use RSS feeds and have the mobile app retrieve data from the feed?
2.) Is there any way, where I send updates from my mobile and every one using the app receives these updates?
3.) Is there any documentation that I can read up about live score update apps?
Thank you.
The detailed functionality really depends on the app and the sports. Usually there is an API involved which can be consumed to retrieve all kinds of data. http://www.programmableweb.com/apis/directory/1?apicat=sports should be a good starting point for sports related API's.
In order to send implement the functionality of sending updates from your device to other user's, you would require some kind of server to help you communicate.

How to speed up mobile application which consumes a lot of API data?

I built a social-type mobile Android application. Due to a specific requests, application contacts a remote API on almost each screen. Consequently, I feel that the app is slow.
What is the best design for apps like this? Should I have a special service which will handle all API requests and responses? If yes, users will not not see "data loading" information, but they still have to see the most accurate data refreshed from server side. How should I accomplish this?
Ideally, I would like to have the same UX like top apps where users simply press buttons and do stuff on the scree, and data is synched with the server-side without they know about it.
NOTE: I know how to do all this technically. I am asking about the best approach to this problem.

Send text to app (not specific phone number)

I don't know if this is even possible, couldn't find anything usefull on the internet.
I wanted to make an app, that me and some of my friends could send a message trough "my app" and that everyone who has that app, receive the message, without using a phone number.
So basically, same as WhatsApp GroupConversation, but then without using a phone number.
Is this even possible?
If it is possible, could you put me on the right track to start with.
Hope I am clear enough, if not, tell me :)
Edit:
This just pops up in my head (didn't look on internet yet), but what I want, is a kind of a shoutbox.
This is possible, in fact WhatsApp does not use your phone number for this at all.
You simply provide your phone number to asure a unique ID and proof that you are indeed in possession of this phone with the validation SMS.
From there on, your phone number isn't even used anymore.
You can go 2 ways with this;
Create a simple webservice with a database on which you just save and request messages. Maybe make a little difference between get all or get latest message. Anyone, hooking into the group, can just fetch the same data. With the use of GCM push notifications, you can make this pretty instant.
Use XMPP, which is a chat protocol kinda all the chats use. Whatsapp, Google talk, FB messenger... This will provide you with instant messaging just like any other chat app or program you know.
Option 2 is by far the best in final functionality, but be warned that XMPP is quite complex and error prone.
You can look into the asmack and asmackx libraries for Android, which will give you the basic functionality with ease. Going a bit deeper, you'll have to dig into the protocol and really get to know it though.
ps. For both you'll need your own server, however with asmack(x) you are also allowed to use Google's Talk servers for free. Communication will go through your Gmail account. Basically with this you just make your own version of Google Talk.
It is possible by implementing server-client architecture. Your app will use a common database for all the users. whenever an user install your app, he will achieve an unique user ID. if anyone uninstall it, his id will be destroyed. You can track the users from those ID in database. You don't need phone numbers.

What happens if the Parse cloud data service fails?

I'm considering using the Parse cloud data service for my iOS/Android mobile app.
From what I can see from the documentation, my app would be highly coupled to the Parse SDK, which in turn uses the Parse REST API (I assume).
What measures can be taken to redirect the app to another service if Parse is down or if I no longer want to use Parse?
Ideally I would like to be tell the Parse SDK to use my own domain and redirect it to the Parse servers (how?). If Parse fails, I can change my DNS to somewhere else and attempt to replicate the Parse REST API (how?). Is this possible now? Is there a better way of preparing for this scenario?
parse.com seems to be down right now and I was just searching randomly online and found this post. Given I can't work on my project now due to the outage, I will put in my 2 cents for this topic.
First of all, I am definitely not happy if my underlying service provider goes down, no matter that's parse.com, AWS, rackspace or something else. However, that's exactly the trade off we signed up for and in return we enjoyed the ease of development and shorten our development cycle from 1 year to something like a couple of months.
It's dangerous for early stage startups to spend too much time and energy focusing on issues that are not the most important at the given point of time. Personally, I will not worry about parse.com being down as long as I cannot afford the time and resources to build and maintain my own database cluster. Obviously, it's under the assumption that parse.com will still be up for most of the time, something like 99.9% :)
The Parse support and sales team got in touch with me about this. Unfortunately they opted not to have a public discussion so I will paraphrase what they told me.
It is not currently possible to change the server url of the SDK. They're not sure if this is a feature they want or not. (It should be noted that the server url is exposed in the JavaScript SDK and can be easily changed; search for api.parse.com.)
Using Cloud Code, you can build your own server API on top of Parse. The Parse SDK has a PFCloud that can be used to talk with Cloud Code but I couldn't find any usage examples in the documentation yet. This is similar to what toadzki's answer, but should be much simpler to implement.
They also offer custom server installations of Parse.
To take the opposite view...
How big is your app and company? If you're a lone ranger or a small outfit working on a smallish to medium app, the answer most likely is "Don't bother". Yes, in theory you could set up a system so that your app (or some infrastructure somewhere) redirects to a different cloud service, but the time and effort taken to do this, and do it well, is significant. Consider that even if you think you've implemented such a system, you're then going to have to test that it works. Not really a simple task.
Mirroring the Parse API and then forwarding sounds simple, but the devil is in the detail. Especially for something like this.
Also, adding your own forwarding server is going to add a point of failure that will almost certainly be the weakest link in the chain. In short, don't bother!
As an alternative solution to toadzky solution you could make an interface to all parse methods on the device so you easily could switch Parse sdk out with your own custom implementation. In short make wrappers for all parse calls.
That said parse is very reliable and a lot of the functionality also works in offline mode. Also you'll get error responses which you can handle in whatever way you see fit.
If you want to route requests through your own server, do it. Have your server run the Parse SDK, not the device. Make your requests through your own custom API and repackage the request and forward it to Parse. This way, if you decide to change cloud providers, your app can still work without an update.

Dynamic Android and iPhone Application Festival Event Application

Is there a way to build and Android and iPhone application that automatically updates its content.
For Example: the user has download the application and we have all of our data on there and what not but then we get another entertainer that is coming to the festival and we want to list them in the app. Do I have to "Publish" an update for the users to download of can all that information be dynamic and automatically retrieved from a server every time the person has internet.
Does that makes sense to anyone, I hope it does.
The short answer is yes.
How you achieve it is to broad a topic without some more information about your specific situation. In general what you'll be looking to do is host your content online somewhere and have your application pull the most recent version when it begins.
There are many possible ways you could store your data online XML, JSON, RSS are a few that are pretty common. Which you'd want to use depends on exactly what the data you are sharing is.

Categories

Resources