1. Are you ready for the Galaxy S20? Here is everything we know so far!

Have app check a url and decide what to do from the result

Discussion in 'Android Development' started by cr5315, May 24, 2011.

  1. cr5315

    cr5315 Android Enthusiast
    Thread Starter

    I want to add the ability for my app to check if there is an update by checking a .txt I uploaded. Is there any way to make the app check a url and read the .txt and determine what to do if the txt says there's an update or not?

    1. Download the Forums for Android™ app!


  2. JamTheMan

    JamTheMan Well-Known Member

    It is possible, and fairly simple:

    Download the file. Take a look at this example on how to do that (set up for an image file, but any file will do):

    How to download file/image from url to your device | Hello Android

    Red the txt file, by doing something like this:

    read text file data in android - Stack Overflow

    And there you have it. All you now need is a simple way of checking if there are any updates. You could for example have the very first line of your txt file say when it was last updated.Then you could simply read this line and check if it has been updated since you last checked...

Share This Page