Google Fusion Tables- access data and insert data from android - android

I am trying to access one of my google fusion tables from my android application. I have a few doubts I would like to clearify (few problems as well):
I tried to query one of the public tables (for test) using this direct URL in my browser: https://www.google.com/fusiontables/api/query?sql=SELECT%20*%20FROM%201W-rjFNnEYYsfJiN2vR8m09XwGQqMQkBHbmRwpQ and faced no problem. Now I want to select all states that have a charcter u in it. (CHANGE) At this first job was to select names of states first. I tried this: https://www.google.com/fusiontables/api/query?sql=SELECT%20State/UT%20Code,India/State/Union%20Territory%20#%20FROM%201W-rjFNnEYYsfJiN2vR8m09XwGQqMQkBHbmRwpQ - I am stuck at this point. Can some body please help. This is a public data and can be viewed here. For this I have already looked at developer docs for querying fusion tables and developer guide for querying fusion tables
I am lost on how to access this data at my android side and insert values in it. Do I have to give public permission to my table? I have looked at developer docs for fusion tables. Do I have to make a REST Client for it and do it that way?
Also, inserting data from my app is problem. I have not tried anything yet in this regard, but have searched a lot and have not found any thing useful. Any link in this regard would do.
What happens after number of request increases the limit? Also, if I create an application using an API key, does the number of hits per user of the application or total number of hits by the application count? Also, what are the charges if one wishes to to increase the limits?
Any link or code in this regard is highly appreciated.
Thanks

If you want a simple way to test the API I recommend to use the Google API Explorer for Fusion Tables.
If you have column names with spaces in them, you have to use quotes.
-> See this example in the API explorer.
SELECT 'State/UT Code', 'India/State/Union Territory #' FROM 1W-rjFNnEYYsfJiN2vR8m09XwGQqMQkBHbmRwpQ
It's probably the easiest to use the already existing Java client for the Google API (there are also other libraries available). Check their Java example for Fusion Tables to get the idea how to use it.
You have to use OAuth to authenticate yourself (see the OAUth guide for "Installed Applications"). The above mentioned Java library also has OAuth support.
I already answered this one on another question.

Related

How to create relationship between tables

I want to develop a Nutrition Recommender Smart Phone App. Details of project are following.
This app will:
•
guide patients about the choices of food and diet plan according to
their health issues.
provide a list of dieting plans
recommend healthy food choices for men, women, toddlers, kids etc.
according to their age, weight and health condition
• have the calorie calculator
have some good articles about diet and foods
inform people about the nutrition importance of different
vegetables, fruits, beverages, grains, oils, dairy etc.
share some innovative ideas about breakfast, lunch and dinner.
But I don’t know how to design database to implement above functionality. Can someone guide me how many tables should I create and what tables relationship exist?.
Introduction
First of all, this is very basic what you wrote us. You should start specifiing those things and get more into details. For example for a diet plan you can think about the properties such plan could have. Properties are e.g. the length of the plan, the nutrition you need and maybe some sport-excercises. Just some samples. Then you may split up the nutrition in one table and so on. Now you can think about if you want to do all the database stuff on your own, or use a framework. Actually the whole database stuff seen in MySQL and so on is done on a webserver, because of security leaks on the client (decompiling, traffic reading, ...). If you want to save data on the local storage or in a local db (SQLite would be you choice) then you should also think about if you want to use an API for that (e.g. RoomAPI by Android Jetpack)
General thing
You should get your self a clear mind which architecture you want to use. You can store data on a webserver and transfer the data via web-interfaces e.g. REST with JSON or XML. You can also store data on the local device in a file or in a database (which is basically also a file with specific interface requirements). You have to decide and consider you require the exchange on multiple devices or just for one device on it's own.
Planning your structures
After you know which architecture you want to use, you can start planning. First of all I would suggest you to get an abstract view of your project. That means just writing down what you want to have and then start writing down the corresponding properties. For a diet-plan this may be the name of the plan, the length, required nutrition and so on... After that you may know, oh okay, I also need a table with the food and you will see (automatically) that there will be a connection. If you see the connection just draw a line connecting those. In an ideal situation you already know the relation of this connection (One to many, Many to one, Many to Many, One to One, see this stackoverflow article: Difference Between One-to-Many, Many-to-One and Many-to-Many?).
Implementing your structures
Anything I do is handcrafted
In the case you want to do all on your own you may use a gui tool for databases to design your database. You can also use commands to do that, what need much more effort. You can decide on your own and on your knowledge.
Pro for gui
Easy to use
Fast creation of the tables
Contra for gui
May use some cryptic names for indexes and keys
"May don't let you look behind the scenes"
I rely on APIs
You can also rely on APIs. That means often, that you can program the class according to your plan, then annotate it and the connections/relations would be managed by the api. Such abstraction-layer is Room for Android or Doctrine for PHP, those are just samples and there are much more.
Conclusion
How you get the data into the database and out of the database is your thing. You could rely on easy use of APIs or get your things done by yourself. It should be a little guide for you to understand database design.
P.S.: If someone has things to edit, do that! I would appreciate that!
Cheers Tarik.

Google Places API - any way to enumerate the Place Types list?

My question is in the context of an Android app providing users with a way to add Places to the Google Places database. Regarding this page:
https://developers.google.com/places/supported_types
After extensive searching, I've been unable to find a way to retrieve these types from the API in a manner suitable for presentation to the user. Does anyone know a way to accomplish this, or is there a built-in dialog I can call (similar to the Place Picker)?
Thank you in advance.
I see this is old so you've likely worked around your issue by now. For the benefit of others, here's a work around since Google seems to have left us dangling on this one.
First, I've created a small data file having all of Google's constants (as of this posting date) associated with friendly names. The two values are separated by commas.
Here's a link to the file:
https://drive.google.com/open?id=0B_33r2IAzcMibndhT2RicWdLUXc
This file can be formatted in JSON if you wish, or read as is. Use it as a source for an AutoCompleteTextView DataAdapter, so the users can easily select a place type. I haven't written the code yet. My needs are different than yours so my code won't meet your needs, but it should be pretty easy to implement an AutoCompleteTextView with this data.

Pulling information from a websites database

I have an idea for an app. There's a property website, where you enter an area code and a date and it will give you all the properties sold in that area for the specified date. I want my android app to push out information when a property is sold in the specified area. Familiar with native android development. Just wondering what I need to start looking at to retrieve the information from the websites database. I'm familiar with native android development and java.
Hello Read to http://developer.android.com/intl/es/reference/org/apache/http/package-summary.html to using Json Request to Http Php script or other..
AND Geofence to location in specifed area
regards!
Though you won't be able to just access any old websites's database, if they have an API available, then you can use that data. For example Zillow has a variety of APIs available (though I'm not sure if any one has what your looking for. Try researching property APIs.
ProgrammableWeb.com has a list of 40 Real Estate APIs

Android and Google fusion tables

I want to build a map view with a google fusion table layer, bringing data from a public table. I'm searching for tutorials, infos ... Someone can give me some advises about how I can proceed? Thanks :)
here is my android app that uses fusion tables to sync it's data:
https://jedld#github.com/jedld/GiNote.git
The part where it also lets the user choose the google account to use and the retrieval of an auth token might also interest you.
The easiest way to proceed might be to use the App inventor Fusion Tables Control. It's quite simple and lightweight.
http://appinventor.mit.edu/explore/content/notready.html#FusiontablesControl
Otherwise here is a simple example app in Java
https://code.google.com/p/google-api-java-client/wiki/APIs#Fusion_Tables_API
Hope this helps.

Whats the best solution for a database used in conjunction with Maps in Android?

Could someone please point me in the right direction. My project involves a database where users enter their address and other info from my website. This database is then referenced in my android application to show the locations of these addresses in my database.
I have yet to start and just came up with this idea. My question is, what would be the best method to create a database easily modified through my website (mySQL, php, etc), and also easily referenced easily through Android and the Google Maps API? I need some ideas on the languages I will need to use to create this database and website so I can go buy the necessary books to start reading up.
Thanks so much
I believe the best way for you to go with this one is:
a database cache on the device
that means you can use XML if you don't have many complicated requirements from storing the address
or SQLite if you want to be able to query the database and do more fancy things
on the server side
if you only need to get the data from your server on the device, then a simple XML with a unique address per user should do it
if you need to push addresses from your device to the server then a REST system needs to be implemented
So, now you just need to figure out exactly what you need from your system and then start googleing on one of the solutions I gave you! Good luck! :)
Google App Engine would probably work for that. GAE supports Java and Python. Maybe use the Restlet framework (compatible with GAE) to implement a REST architecture.

Categories

Resources