I am writing an application that allows notes to be written on a web interface, and then be viewed on a handset.
I have gotten it into place using:
JSON + PHP scripts to get table information
Creating a class for 'note'
Filling an ArrayList with JSON code
If JSON code == "" then read in JSON string from local SQL
- if JSON code has text (i.e website has been reached), then delete all from local SQL and then update local SQL with new JSON string (this is inefficient I know but I'm a novice and it's sort of the chain of steps I figured out myself and I don't care about having 'backups' or whatever.
The problem I have though, is now I want to mark as complete, and at the moment when the button is pressed, a PHP script is run, and the MySQL web DB gets updated, and then the phone next reads in the JSON code again and updates its local DB. The issue is if I have no connection, I don't know what to do, because the code will be set locally but when it next connects it will copy in the code over the local SQL and the task will be set as incomplete again.
Is there any way I can create a sort of 'buffer' i.e keep trying to run php script when connecting or something before the website next gets contacted and values get read in?
Sorry if I'm being a bit slow or missing something here I've been working for hours now I'm going a bit loopy haha.