ContentProvider appropriate for very dynamic data? - android

I'm an Android newbie, learning the SDK by creating some basic apps. I'm currently working on an app that will display content from a news aggregator with news items and comments on each item. Each news item has an 'id', and many comments associated with it.
Each results page will have a 'before' and 'after' reference id to the news item at the beginning of the page and the end, respectively. So each 'query' will be something like '/?before=$ID' or '/?after=$ID'.
It seems like ContentProviders are the preferred way to store data on android. However, the content of the site changes so much that I question whether or not using a ContentProvider would be wise.
I appreciate any insight.

Well content providers are used by the e-mail app to hold e-mail, gmail to store and sync its mail messages, gtalk and contacts to keep track of the people you know and their chat status, etc.
I am not sure just how dynamic you are thinking, but those are all pretty dynamic.
One way to look at it -- a content provider is just an API to access structured data across processes. If that API serves your purpose, well that's a good sign. The other aspect to them is that usually they are implemented on top of a SQLite database, and that is the easiest way to implement them because there is a lot of framework support for that. So you will most likely be using a SQLite database for your content provider impl. Is a database dynamic enough for you?

Related

How can I implement the search for a location?

I am planning on making a widget for android. It will basically show pollution data that is gotten from a government data rest endpoint.
My problem is that I want the user to search for and select the location they want data for, much like the weather widget.
I'm thinking that having a persistence database is overkill because the data probably won't ever change and I don't think the location list very big.
Should I put a textfile in the app that is being searched through or is there another more efficient way to approach this problem?
Thanks in advance!

How to make api.ai agent learn something dynamically?

I am currently using api.ai , to create agent to perform specific tasks, but one question i don't have answer to is , can i make it learn something while chatting , mean that i speak my name is 'John Cena' and she should store it and then whenever i ask her again bot should answer me that. i know there is a way to do it by logging into api.ai web and manually add entries , but it will not help, is there any work around programmatically or automatically ? the file i've been using to practice is given in github . and here is working DEMO
You basically need for your bot to "learn" facts. There are many different ways to achieve this, but recently the most common way is to arrange knowledge into Semantic "Triples" and store the knowledge into a Graph repository (like Neo4j, Titan, Spark Graph, etc). In your example, "my name is John Cena" would translate into a Triple like ("anubava","Name","John Cena"). That way, the next time you are logged in as anubhava and ask "What is my name?", it would translate into a Graph search that will return "John Cena". A word of caution, achieving this is not trivial and would require some significant amount of fine tuning. For more info, you can check here and here.
Finally, most complete solutions (that I know of), are Server Side solutions. If you want for the whole knowledge base to reside in your mobile device, you could probably use the resources there as inspiration, and build your own Linked Data repository using an embedded database.
Hope this helps. Good luck.
To store and recall the user's name, you'll need to set up a webhook with some basic data persistence capabilities. Any database or key-value store would work fine.
Here's the breakdown:
Implement webhook fulfillment for the intent that captures the user's name. The webhook should store the name along with a unique, identifying ID that you should supply from your front-end in either the sessionId or as a context parameter in your call to /query.
Implement webhook fulfillment for the intent that reads the user's name. The webhook should look up the name by ID and return a response that tells the user their name.
The high-level docs for writing a fulfillment webhook are here:
https://docs.api.ai/docs/webhook

Best method to store and read data from a cloud source in Android?

The situation: I have many real life locations with specific information associated with them, and updated frequently. I am unsure of how to store this information for use in an android application.
My original thought was storing the data on some server/cloud source/database, reading from the server from each Activity in the app to make sure the info is up to date, and update the server with any changes that may or may not have been made.
For example: there are 200 people inside the library, one person leaves.
So we would read the number of people from the server, display this on the app, person leaves, subtract one, send the new number back to the server.
Would this be an incorrect approach? I'm fairly new to Android in general, and I really have no experience on how to approach this type of situation, what services to use, etc.
I would look into using Parse, its a pretty sweet way to power the backend, and their website is very detailed in explaining how to use it.

what kind of database solution suits my mobile apps

I am looking into options how to realize the following use case. A iOS/Android user is using my app which gets its table view data populated by a cloud database solution. The user must be able to send back information (e.g. name + date) which needs to be send back to the database and gets stored there in a/different table/s. Moreover, I would need the db-solution to run automated reports based on the information sent back by the users (e.g. in an excel file).
So far I only found ragic.com might suit my needs. But what other options are out there, which might not be as fancy looking but will get the job done. Thanks guys!
A WebService is considered best practice regarding these matters. Have a look at this guys tutorial:
http://android.programmerguru.com/android-webservice-example/

Challenging other players using Facebook API with the same data

I'm in course of developing an application, which basically is a quiz. I store all the questions on an external server, and fetch them as JSON files. I'd like to implement some Facebook features, most importantly the possibility of challenging other players. However, in order to compare the results, I'd like that other user to use the same set of questions in a current game, as I do - situation similar as in SongPop, where two players guess the same songs. I'm not sure though if it's possible for a standard Android app, not Facebook app like SongPop. I'm looking for a way of somehow sending a 'data pack' to him, containing the questions I have for the current challenge.
Create a Question Set which is a collection of Questions.
e.g. QuestionSet1 will contain Question2, Question4, Question5.
You can just send QuestionSet1 to the user being challenged. e.g. mysite.com/game/?questionsetid=1
On your server, if the url contains the parameter 'questionsetid', that meets you'll get the questions from the Question Set.

Categories

Resources