Change background image periodically from website in Phonegap Iphone app - iphone

I'm new to iPhone development and making an app using PhoneGap framework .
In home screen I have used grid with iPhone style icons to make it like sprigboard layout and there is an background image to this homescreen body tag.
What I want to do is this background image should change periodically (once a week or once a month), after the time interval the app should fetch new image from website may be from the same url, and store in local storage somewhere, so until the next interval the app should show this image as homescreen background. I can use JSON to fetch image.
I don't want to use any native IOS features.
How can I do that using PhoneGap?

You would want to store the image using the local file storage system. Check out
http://docs.phonegap.com/en/2.6.0/cordova_file_file.md.html#FileTransfer
You can download the file and store the file name in Localstorage -
Write a javascript function that checks if the name of the file is stored, if so then set the background image using Jquery or the like.
Maybe have a look at this
http://www.raymondcamden.com/index.cfm/2012/1/19/Downloading-files-to-a-PhoneGap-application--Part-1
I ended up saving a dummy file first so I could get the full path to the URL of the folder the file will be stored in (different from each install of the application)

Related

Flutter Menu App that gets pictures from firebase

I have a flutter app that is a menu for a restaurant. Now the problem is that I want to get the pictures from firebase. Currently, if you open the app, the pictures take time to load and you can see that with your eyes, it is a bit annoying and not practical regarding bandwidth data usage.
Is there any chance I can cache the images when I get them from firebase and than appear instantly? I request the links of the images once the page is open using a future and display them with a CachedNetworkImageProvider() with the image URL but that still takes time to load the images. Is there a way to download all the data in the firebase at once when you open the app and not check every time you open the app?
for all apps that require fetching images from a remote location, what i have been doing so far is download the image locally and use the local image instead of the remote one if it exists locally, from my knowledge cachedNetworkImage only caches the image after fetching when the app is currently running and refetches the image when the user restarts the app.
Please if you do find another way to cache images that would be cool and remove a lot of boiler plate code, please do post it, thanks.

save profile image inside app using the built in camera

I have an app that contains a profile of the user.
In the profile editing, he has an option to take a photo of himself, then that photo should be saved in his details and be presented in certain places in the app.
Is there a way to internally save an image (not in his phone's photo gallery, but inside the app itself, so he cannot delete the photo through the phone), and then fetch that image every time I need it?
I understand I cannot use CoreData to save images, so I am wondering if there is an easier way to get it done efficiently.
Or must I do that in a server?
not in his phone's photo gallery, but inside the app itself
You can't store anything at runtime "inside the app itself". But the app has a sandbox, a folder area belonging to you alone, where you can store any file you like — in the Documents folder or the Application Support folder, for example. So why not just use that?

Phonegap App lost images on update, recovering from the camera roll

I have an app where users take images and they are saved along with user notes. Per the following link this is what I was using to save the images to the app. The issues is when some users update the app the images are lost.
Phonegap - Retrieve photo from Camera Roll via path
per the bosses instructions the users aren't allowed to browse the gallery for images as they are being used as proof of work performed (small company, 5-12 employees using the app).
is there any way for iphone to relay back to the app the actuall image location on the camera roll like android does? Then I can just save the URI to the database and call it when the form is submitted...
Thanks
You need to use
window.resolveLocalFileSystemURI()
to convert the filelocation to a fileentry or else your filepath will contain the App UUID which changes when you update/deploy your app.

iPhone App to generate thumbnail images for the image obtained via camera or photo gallery

My app allows user to obtain picture/image from camera/photo gallery and then the app will upload the images to remote storage. Since the thumbnail images of those images will be used in some scenarios, I need to generate the thumbnail images.
The questions are
should the thumbnail images be generated by the app at the time when the original/raw image is obtained?
is it achievable to upload a raw image and at least 2 of its thumbnail images at the same time from the app to the remote storage - let's say its Amazon S3 or Google App Engine
is there any sample code out there that does the image transformation on iPhone?
I think you should, and put a progress indicator on top to tell your user that "please wait, I'm generating thumbnails".
I don't think at the same time is appropriate for you. Instead, you should try to upload them (2 thumbnails and 1 raw) in a serial manner. That is, "try 1st thumbnail, if succeed, try 2nd thumbnail...",since the internet connection for a mobile device like iPhone could be unstable. Requests-timing-out does happen, therefore it's better to always make sure you have finished the previous request before you start the next one.
I think three20's TTThumbsViewController (or TTPhotoViewController) has done a good job in transforming original photos into square-shaped thumbnails. Maybe you should take a look at their source code.
btw, as for uploading photos to servers, I once used the ASIFormDataRequest to post my photos to a server. It worked pretty well.
Hope it helps. :-)

streaming data from a server

I would like to have all my data on a server be streamed into my iphone app.
How does this work?
e.g. images, text and sound
Should this be read into an array and then manipulated?
As I would like the app to be update-able whenever new content is added to the server.
This obviously means building the app in such a way that it wont crash or have errors due to updates.
How is this done? Is there single folder for each which is streamed in e.g. sound clips folder.
Thanks
What i understood from your question is that you want to play sounds, videos on your iphone app over the internet.
Images:
To display image on your iphone over the internet is very easy all you have to do is publish your website somewhere then iphone will use the hyperlink of that image meaning like when you browse any image in your browser you get e.g:
http://www.google.com/images/logos/ps_logo2.png your iphone app will just call this URL to display the image.
For Sound And Videos
They both will also be published on the website and they will have URL so that your iPhone App can access them to pause & stop the sound/video you just have to stop buffering & as a precaution you can save the location of buffer & if you want to Resume just start buffering from the saved buffer location