0

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.

aspirant_sensei
  • 1,568
  • 1
  • 16
  • 36
  • 1
    I think [this](http://stackoverflow.com/questions/1560788/how-to-check-internet-access-on-android-inetaddress-never-timeouts) is what you are looking for. Checking if there is internet connection. – Akyl Apr 17 '13 at 18:11
  • thanks, i shall read it now – aspirant_sensei Apr 17 '13 at 18:26
  • Btw, you really had one issue btw you should just say "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." put it on bold or something. I probably read to much unnecessary things. – Akyl Apr 17 '13 at 18:44
  • sorry, was always known for being a little too verbose :P – aspirant_sensei Apr 17 '13 at 21:08

0 Answers0