Guys, I have a question here.
Currently I have a image with a url that changes every 3 hours. Is it possible to load the image on to
corona app? And how do I make it update automatically every 3 hour and changing the image?
Thanks.
Guys, I have a question here.
Currently I have a image with a url that changes every 3 hours. Is it possible to load the image on to
corona app? And how do I make it update automatically every 3 hour and changing the image?
Thanks.
You would need to set some kind of timer, perhaps a local notification if you want the user to know it’s time to update (but if an app annoyed me every 3 hours to download a photo, I’m not sure I would like that…). The other thing you can do is look for the onResume event when coming back from the background and if it’s been over 3 hours since the last download, fetch a new one. Likewise, on a fresh start you would want to see if over 3 hours has elapsed since the last time you downloaded the file and then fetch the new one.
Rob
I think I would prefer doing the 2nd or 3rd.
For now what I plan to do is that I will load the image for the current time now, but the main problem is that the image is in the form of URL with the time and date,(http://example.com/data/320_480/image/201407041110_0.png) where the date and time will be updated accordingly (http://example.com/data/320_480/image/201407041310_0.png).
How should I start loading the image? Is there anyway that the app will retrieve the url from the web and update itself?
Should I use “display.loadRemoteImage()”? If yes, then the only problem left is updating the url every 3 hr.
I would consider using network.download() to fetch it and store it. Display.loadRemoteImage() will try and load the image every time it runs. By separating the download process from the display process, it lets you use your cached image without hitting the network or if they are in airplane mode.
Downloading an image specific to that your listed above is kind of a bad idea, as if they change the format you would need to update your code and update all your apps. It is better to use some server code somewhere like php, .net etc. so your url is domain.com/myimage and the code behind outputs image as the header and just responses out the correct image.
I would also follow rob’s suggestion on network.download and the just simply check if the file exists etc. if not then download it otherwise just show it.
Now the problem that I have trouble understanding is the updating part.
I am doing an informative application where I need the data image from the website and it is being updated every 3 hours.
Lets just say that the format of the image URL will not change, it only changes the date and time,which is the last part of the URL, is it still possible to update it according to the time on the PC?
Regarding the using of server code, can you explain how should I start with it? What should I need? Using REST Console?
Thanks for the advice on using network.download.
Bumps.
Would like to know more about using the server codes.
Any tutorials or help would be appreciated.
You would need to set some kind of timer, perhaps a local notification if you want the user to know it’s time to update (but if an app annoyed me every 3 hours to download a photo, I’m not sure I would like that…). The other thing you can do is look for the onResume event when coming back from the background and if it’s been over 3 hours since the last download, fetch a new one. Likewise, on a fresh start you would want to see if over 3 hours has elapsed since the last time you downloaded the file and then fetch the new one.
Rob
I think I would prefer doing the 2nd or 3rd.
For now what I plan to do is that I will load the image for the current time now, but the main problem is that the image is in the form of URL with the time and date,(http://example.com/data/320_480/image/201407041110_0.png) where the date and time will be updated accordingly (http://example.com/data/320_480/image/201407041310_0.png).
How should I start loading the image? Is there anyway that the app will retrieve the url from the web and update itself?
Should I use “display.loadRemoteImage()”? If yes, then the only problem left is updating the url every 3 hr.
I would consider using network.download() to fetch it and store it. Display.loadRemoteImage() will try and load the image every time it runs. By separating the download process from the display process, it lets you use your cached image without hitting the network or if they are in airplane mode.
Downloading an image specific to that your listed above is kind of a bad idea, as if they change the format you would need to update your code and update all your apps. It is better to use some server code somewhere like php, .net etc. so your url is domain.com/myimage and the code behind outputs image as the header and just responses out the correct image.
I would also follow rob’s suggestion on network.download and the just simply check if the file exists etc. if not then download it otherwise just show it.
Now the problem that I have trouble understanding is the updating part.
I am doing an informative application where I need the data image from the website and it is being updated every 3 hours.
Lets just say that the format of the image URL will not change, it only changes the date and time,which is the last part of the URL, is it still possible to update it according to the time on the PC?
Regarding the using of server code, can you explain how should I start with it? What should I need? Using REST Console?
Thanks for the advice on using network.download.
Bumps.
Would like to know more about using the server codes.
Any tutorials or help would be appreciated.