Program Structure

marcel

Active Member
Licensed User
Longtime User
Hi,

I am new to basic4android. I have programmed on dotnet and iPhone. now I need to make my app working on android and I think using basic4android should do it. I already made some simple tests and it worked great!

My questions. I strugle a little bit how to setup the code structure.

My app would be very simple

It needs to poll every x minutes data from a webservice and store this in the app using SQLite and based on the GPS Location it will display items on a listview.

So I was thinking to use a service Module to download the data and store this into a SQLDatabase every x minutes.

But I do not know eaxtly what to do with the GPS. Can I put this also in the service and send an event everytime there is a reasonable gps change to the main thread to update the listview?

Is this possible? Is this correct thinking?

Thanks for an anwser!
 
Last edited:

marcel

Active Member
Licensed User
Longtime User
Use HttpUtils2 to download the data.

You can use a single service for both the GPS and the data download. Your code always runs in the main thread (unlike libraries code). You can use CallSubDelayed to update the activity with the ListView whenever required.

Ok. Thanks again Erel. I will try this.
 
Upvote 0

marcel

Active Member
Licensed User
Longtime User
SQL Decleration

Hi,

Where do I put the SQL decleration, i need this in my activity, service and helper modules...

Is this save to put this on Process_Globals in the Main Activity?

Marcel
 
Last edited:
Upvote 0
Top