[Q] database implementation - Android Software Development

Creating a SQLite database for an android app, and I have a lot of data I need to import into this database. Any suggestions on the best way to do this? I have a couple of ideas, but some outside advice is always helpful.
Thank you

If it is a one time import, you just need to run a INSERT query at initial setup of database. The DATA to be imported itself can be hardcoded, downloaded, or in a textfile. If the initial data is never going to change on any install, then use a TextFile.

Related

[Q] Best Option Database to integrate into app

Looking for a bit of advice on databases integrated into an app, I have looked around and nothing seemed to answer my question. Will try make the problem clear and I hope someone can help me out.
I want to have a master database that is going to have a full list of information. In the app, the user will be able to choose from this list those which apply to them, leaving a smaller list. If the main database would be stored remotely I would think the user list would be stored locally to make any action on it quicker and so the app wont rely on an internet connection.
I am having trouble choosing what direction to go with the database and which will work best with Android. Also, from my research so far, I am on the fence as to whether the master database will be remotely or locally on the device. I would rather it be remotely so to minimize memory usage and have the means to set up a server system or other method to host the file. Seeing as the user list will be stored on their own device there is no need to store anything else apart from the master list and it being on a server will make updating it easier.
If anyone has any thoughts on what I am looking for or knows a best-of situation I would greatly appreciate it.

[Q] synchronization with my own cloud

I'm trying to add a synchronization function to my app which will work like this :
I want it to be login free, so no new account will be needed.
The data will be assigned to the user's google account on which he's logged in.
On server side, there will be a mySQL database wich will hold the user's data.
I didn't find a useful tutorial. This one uses some weird servlet or whatever, and the official google tut is very briefly explained.
Could anyone help me ?
halp meh plz
I was also trying to find a tutorial for something like this a while ago. Theres not much out there. Seems need to know how to write your own server side code to handle the synchronising and then communicate with the app through https or whatever.
Well, that doesn't help me very much. I know php/mySQL as well. I could imagine synchronization through xml - like implementing a function that would create an xml file from my database, upload it to the server and parse it/put it my online database.
This would be useful, if I only wanted to be able to modify data on one end - the phone - but then it wouldn't be called syncing, rather backup.
Or maybe I could request a similar xml file from the server. I think it should be possible to send some kind of query from the device to the server which would call a function that creates an xml file from database entries and then download the created file, parse it, compare with the device's database and update the database if some file was updated (it's 'last edited' time was changed).
So on each sync cycle I would first get the server-side xml file, update the local DB, then create the xml file from local DB, send it to the server and update the online DB. Only files with newer "last edited" time would be updated.
What do you think ?
Who the hell if not you, guys, can help me ?
bumpity bump

[Q] Newbie developing: How to host/share an SQLite Database online?

Hi!
I'm rather newbie developing for Android, and I'm kind of lost...but here goes what I'd like to do:
I'd like my app to have a local database that is updated from online, either downloading a new file each time versions don't match (which I find hard), or somehow to download/upload the latest insertions to an online file.
I'd like it to work somehow offline allowing to sync anytime that there's connection, so I'd like a local DB where the query is made, but I also want it to be synced as much as I can. Users should also be able to add new rows to the table, that could be done at any time the user decides to sync.
So...How can I implement an online database? And also, as a sidenote...Where could I host my DB? Is there any free hosting I could rely on? In my opinion it should be a rather small DB...
Thank you!

Best approach for loading website data into android app (without webview)?

Hi,
I am wondering what possible ways would be for loading a simple website into my app. My first thought is using a WebView, but I would like a dynamic app, while webview takes some time when loading between pages and links.
Is a common solution to load the html resources locally, from let say the assets folder? Than I could use AsyncTask to keep the files up to date and whenever the app starts it would load and work much quickly.
Or should I use HTTP Requests and parse the external Html document?
What would be the most situable solution for this kind of app?
Thanks,
Ved
vedtam said:
Hi,
I am wondering what possible ways would be for loading a simple website into my app. My first thought is using a WebView, but I would like a dynamic app, while webview takes some time when loading between pages and links.
Is a common solution to load the html resources locally, from let say the assets folder? Than I could use AsyncTask to keep the files up to date and whenever the app starts it would load and work much quickly.
Or should I use HTTP Requests and parse the external Html document?
What would be the most situable solution for this kind of app?
Thanks,
Ved
Click to expand...
Click to collapse
I think it's probably a decision best made by yourself. You have not said what type of data ? Cause really you should be wanting the minimal amount required. My app uses lots of data from my server for things like themes, but these come direct from SQL Database
deanwray said:
I think it's probably a decision best made by yourself. You have not said what type of data ? Cause really you should be wanting the minimal amount required. My app uses lots of data from my server for things like themes, but these come direct from SQL Database
Click to expand...
Click to collapse
Hi deanwray,
Thanks for your reply. I made some more researching and I have realised that my best bet is SQL, as you said.
Do you request data in your app directly from the online mySql database generally? I have read about a technique on downloading the data from the online database and converting it to SQLite (which is the local database on android) inside the application. This would be really cool, would really boost performance.
ved.
vedtam said:
Hi deanwray,
Thanks for your reply. I made some more researching and I have realised that my best bet is SQL, as you said.
Do you request data in your app directly from the online mySql database generally? I have read about a technique on downloading the data from the online database and converting it to SQLite (which is the local database on android) inside the application. This would be really cool, would really boost performance.
ved.
Click to expand...
Click to collapse
well my app uses a hosted database for
Online Theme Data (thumbnails store in just web space)
Settings Overrides (settings that I may have to force on the app)
Announcements ( Messages that trigger dialogs, adverts, html boxes)
Purchase info
other stuff that I forget
Any database that I access online I cache data local in cache sqlite database
So lets say the most complex things is the purchase list... a rough flow is as follows :
Get idents from online purchasable list
get descriptions and titles from idents
store local database
Simultaneous query of google IAP data from play to get locale info and pricing (along with IAP ident)
Store that in same local db
Display to user at, initial data, updated data and price additions
The database online is accessed via php (not a fan of that but hey ho, not really a programmer so there ya go) and given to the app as encoded JSON
I'm currently considering an ORM system like greenDAO or something like that...but not looked too much into it currently.
The themes database is quite good as it hold descriptions of views, shading, dimensions etc, these too are never displayed to the user from the server, but are cached local, cause failure of internet and failure of sync should not prevent any vital parts of what appears to be an offline app from working (e.g. my Smart SMS app)
Hope that helps, I could pass you the php although tis quite simple, there are security issues to look out for though
deanwray said:
well my app uses a hosted database for
Online Theme Data (thumbnails store in just web space)
Settings Overrides (settings that I may have to force on the app)
Announcements ( Messages that trigger dialogs, adverts, html boxes)
Purchase info
other stuff that I forget
Any database that I access online I cache data local in cache sqlite database
So lets say the most complex things is the purchase list... a rough flow is as follows :
Get idents from online purchasable list
get descriptions and titles from idents
store local database
Simultaneous query of google IAP data from play to get locale info and pricing (along with IAP ident)
Store that in same local db
Display to user at, initial data, updated data and price additions
The database online is accessed via php (not a fan of that but hey ho, not really a programmer so there ya go) and given to the app as encoded JSON
I'm currently considering an ORM system like greenDAO or something like that...but not looked too much into it currently.
The themes database is quite good as it hold descriptions of views, shading, dimensions etc, these too are never displayed to the user from the server, but are cached local, cause failure of internet and failure of sync should not prevent any vital parts of what appears to be an offline app from working (e.g. my Smart SMS app)
Hope that helps, I could pass you the php although tis quite simple, there are security issues to look out for though
Click to expand...
Click to collapse
Thanks for the details! It was really useful to see your workflow, I was not sure about the direction I should choose for my app development, but now is much clearer.
Thanks!
ved
Hy deanwray,
I could use a litle help, regarding the methods you have adopted for synchronising your online database with your apps local database.
I have reached a point where my database is ready, I am parsing (via JSON) data from a local xml file, and inserting it into my SQLite database. Everything works ok, but I need to get the data from my online mySql server into my app on a regular basis.
I have found threads wich mentiones the Android sync adapter, and others where people use the HTTPClient to pass data to/from the server. To be hones I am a bit confused, I would really glad if you could light me up on what would be the best approach, or what works for you the best
Thanks!!
vedtam said:
Hy deanwray,
I could use a litle help, regarding the methods you have adopted for synchronising your online database with your apps local database.
I have reached a point where my database is ready, I am parsing (via JSON) data from a local xml file, and inserting it into my SQLite database. Everything works ok, but I need to get the data from my online mySql server into my app on a regular basis.
I have found threads wich mentiones the Android sync adapter, and others where people use the HTTPClient to pass data to/from the server. To be hones I am a bit confused, I would really glad if you could light me up on what would be the best approach, or what works for you the best
Thanks!!
Click to expand...
Click to collapse
If you want do operate online database server then generally php is used.there is a tutorial on androidhive check it . you will get the answer
Sent from my GT-S5570 using XDA Premium 4 mobile app
vedtam said:
Hy deanwray,
I could use a litle help, regarding the methods you have adopted for synchronising your online database with your apps local database.
I have reached a point where my database is ready, I am parsing (via JSON) data from a local xml file, and inserting it into my SQLite database. Everything works ok, but I need to get the data from my online mySql server into my app on a regular basis.
I have found threads wich mentiones the Android sync adapter, and others where people use the HTTPClient to pass data to/from the server. To be hones I am a bit confused, I would really glad if you could light me up on what would be the best approach, or what works for you the best
Thanks!!
Click to expand...
Click to collapse
if you need a real time chat hit me up on hangouts https://plus.google.com/+DeanWray/

[Q] Encapsulate AccountManager

Hi guys,
I am trying to encapsulate the AccountManager. Specifications: Be able to retrieve an ApiToken (easy one, just use getAuthToken()), be able to create a new account (another easy one, just use addAccount()) and be able to chose from multiple accounts. I am not able to find a solution for the last point. Choosing itself is not hard. Just make an own Activity or use the AccountPicker.
The problem is I can want to encapsulate this in a simple POJO, but the AccountPicker needs an activity to be started. Now you may say, just pass the current visible Activity to the POJO. Well here's another thing I want to be able to do: Keep a reference to the selected account, so the user does not have to select the correct account everytime the app tries to retrieve an API-token as this account should be passed to getAuthToken. So passing the current Activity does not really solve this issue.
Any ideas or links to solving this problem or to a better approach on this topic? I am a fairly new developer and find it hard to find tutorials/best practices on Android Application Programming Patterns, so I'd appriciate some links.
Best Regards,
SampleAndroidDeveloper

Categories

Resources