Reputation: 7014
I want to do the replication between sql server & android sqlite.I have done downloading(sql server to Android) using WCF service.Uploading part also that way I can do it.
My Problem is: After user change/enter table contents (e.g enter new invoice), it should start the upload(sqlite to sql sever) backed without effecting my current work/activity.
How we can implement this?
If it is mutithreading how it is possible.Need to run two activity same time.One will run foreground other one run in background....
Please help me or give me idea reading this?
Thanks in advance?
Upvotes: 3
Views: 886
Reputation: 6788
Activity will be used for foreground tasks. Using that User can interact to your application. In Android we have a Mechanism to do long running task in background using Services. But it doesn't mean you should write your code to upload the data on server in Service only. Give service a task to just invoke a background thread and tell that , Upload data to server. Using AsyncTask you can achieve this.
So the flow should be. Activity --> Service --> AsyncTast --> To Your Server.
Upvotes: 0
Reputation: 10193
The recommended design practice for this is to use a content provider which handles concurrent thread access to the database.
To handle the background service actions, just implement an IntentService and simply call startService(intent);
Upvotes: 2