Best approach for loading website data into android app (without webview)? - Java for Android App Development

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/

Related

[Q] Which application allows to sync files with cloud?

Hello,
Dropbox and other synchronisation services are actually not running in background and don't think folders. You have to manually download/upload files. Anybody knows application which will automatically synchronise local Android folder with cloud?
artisticcheese said:
Hello,
Dropbox and other synchronisation services are actually not running in background and don't think folders. You have to manually download/upload files. Anybody knows application which will automatically synchronise local Android folder with cloud?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=886445
Smestorage is another app.
However none works perfect yet...
But i am sure one day
I wouldn't mind writing such a beast, however I see one problem that users could complain about.
I have a hosted site with probably enough data storage (or I can add more). Thing is, I HAVE TO create the database and the tables within it. That means I have Admin authority which means I can see everything.
Now, I am not the person that would do such a thing and would even sign some type of non-disclosure document. But, are people going to upload their pictures, files, documents etc. knowing that I have access?
Rootstonian said:
I wouldn't mind writing such a beast, however I see one problem that users could complain about.
I have a hosted site with probably enough data storage (or I can add more). Thing is, I HAVE TO create the database and the tables within it. That means I have Admin authority which means I can see everything.
Now, I am not the person that would do such a thing and would even sign some type of non-disclosure document. But, are people going to upload their pictures, files, documents etc. knowing that I have access?
Click to expand...
Click to collapse
I think people would prefer an interface to existing clouds rather than to have you host your own.
Yeah, agreed. However, any site of this type you go to, SOMEONE has access to your data...that's just the nature of the beast. And a reason I don't use ANY online service of that type.
Hell, Dropbox could be run by one person for all I know.

[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!

Any idea how create Bill receipt

Actually I am creating an android App. In which app user buy products online.
After successfully placing order. I need to generate bill and show it user which he may store it on mobile.
I have no clue how i am gonna do that.
few aprroches in my mind as of now.
1. Get cart data from the app to server-> make bill in pdf or suitable formaton server-> send it to app's inbox as well as to email.
2. Get cart data from the app to server -> then whenever user request send data to app to dynamically generate bill from received data.
App flow :
User--> browse products -> add products in cart -> place order-> after successful ordering generate the bill and mail or show it aps inbox
If any one has alternative solution or want to suggest ifferent flow please feel free to share
Sandeep_Jagtap said:
Actually I am creating an android App. In which app user buy products online.
After successfully placing order. I need to generate bill and show it user which he may store it on mobile.
I have no clue how i am gonna do that.
few aprroches in my mind as of now.
1. Get cart data from the app to server-> make bill in pdf or suitable formaton server-> send it to app's inbox as well as to email.
2. Get cart data from the app to server -> then whenever user request send data to app to dynamically generate bill from received data.
App flow :
User--> browse products -> add products in cart -> place order-> after successful ordering generate the bill and mail or show it aps inbox
If any one has alternative solution or want to suggest ifferent flow please feel free to share
Click to expand...
Click to collapse
I have decided to go with Approch Number 1
Generate invoice.pdf with php on server and open in web view of pdf in app and optionaly ask for mail or download invoice.
Your approach seems good! What I would do apart from it is, save the cart item in database associated with the user. You may use your own username/password pair to place the order or use AccountManager class to use the user's registered gmail id on the phone as login. Or even better, provide them option to use any one of them. That way, user can request duplicate invoice anytime they want from cart history.
Hint: After placing order, always catch the cart to local DB so that it can be viewed offline. Also, use php to connect to db of remote server and perform operations. Never connect to db directly from the app because you have more chances of compromising your remote DB with this method
P.S: I just noticed that your app "Nomadic Food" Is not licensed. Please consider including a license so that the source belongs to you forever. Its always good to license opensource projects. I personally prefer GNU GPL license. But you can choose whatever suits you better. this this might help you select the license.
vijai2011 said:
P.S: I just noticed that your app "Nomadic Food" Is not licensed. Please consider including a license so that the source belongs to you forever. Its always good to license opensource projects. I personally prefer GNU GPL license. But you can choose whatever suits you better. this this might help you select the license.
Click to expand...
Click to collapse
Definitely do this.

RESTful to Android connectivity

Hi,
I'm going to write a system for processing taxi orders. It consits of client application, driver application and restfull web service. For now I have only a few POST resources in my server that consumes JSON file and produces plain text. I'm wondering how to resolve the situation when the client need confirmation about the order he made or when the new order is made and has to be delivered to taxi driver app. I am a beginner android developer and I do not know which tools should I consider to achieve it. Is it good idea to use a service that checks let say every 30sec for new order/confirmation or shuld I use another solution for example let REST to connect directly to the particular android device?
Thank you in andvance for your response.
You can use push notifications by using Google Cloud Messaging.
EmptinessFiller said:
You can use push notifications by using Google Cloud Messaging.
Click to expand...
Click to collapse
Thanks for the idea. I didn't know about it before. I have just one question - since I use RESTful service the easiest way to implement GCM is to choose http protocol (single POST request) but there is no upstream feature in it. Is it good approach to use GCM in "server -> android" connection and regular POST request (that I used till now) vice versa?

[Q] what is the best way to implements push notifications in android.

I want to implement push notifications in my android apps.what is the best way to implement push notifications.
Notes :
1) Apps User need not have compulsory google Account.
Implement android push notifications without GCM
I want to implement push notifications in my android apps.is it possible without using GCM(Google cloud messaging)
Your app would need to "handshake" with the server when it was first run, so that the server could get the IP address and any other info it needed. That could be done with a simple HTTP post. (Googling "java http post" came up with a ton of results, but the first one was a Stack Overflow question with a ticked answer that's been upvoted over 100 times. I'd take that as a strong indicator that it's good - http://stackoverflow.com/questions/4205980/java-sending-http-parameters-via-post-method-easily).
After that, you'd need to create a TCP listener in your app and something to send messages to it on the server. Again, a quick Google search came up with a ton of stuff, but this looks concise and useful...
http://systembash.com/content/a-simple-java-tcp-server-and-tcp-client/
I've not done anything like this with Java, so I can't be any more help than give you the principle of it. I've done it in other languages though, and it's all the same thing really.
I hope this helps, and good luck
Edit: I just had a thought - that's all good for people using data, but you'll run into issues when on wifi as you'll only have an external IP address. There's reasons that things like Google Cloud Messaging exist!
nileshandroid18 said:
I want to implement push notifications in my android apps.is it possible without using GCM(Google cloud messaging)
Click to expand...
Click to collapse
GCM is free i think, while the alternatives are not.
For example Parse is not so difficult to program but after exceeding their Free plan you have to pay each month some money . Other similar platforms also exist, like urbanairship

Categories

Resources