CoolStraw
CoolStraw

Reputation: 5390

Phonegap: flexible iOS app update (No AppStore)

I have a Phonegap iOS app. My app is distributed privately, hence there is and there will be no usage of the app store. The app communicates with a homebrew middleware. In order to manage the app updates, I thought about doing something like:

-> On app start, check if a more recent version is available.

-> If yes then call a home-made Javascript module that will leverage the HTML5 file I/O API in order to update/create/delete files based on the output of the middleware.

Upvotes: 4

Views: 4206

Answers (5)

Ben
Ben

Reputation: 1302

I know this is an old question, but the accepted answer is no longer correct. Here's a complete project showing how it can be done: https://github.com/ben-ng/phonegap-air

In short, the trick is to not write to the app bundle, but to the Documents directory.

Upvotes: 2

zvikico
zvikico

Reputation: 9825

There's an alternate service called Trigger.io. It is a lot like phonegap, but one of its' key features is that it lets you "reload" the app on the device, which is essentially what you're looking for, AFAICT.

Upvotes: 1

Zimmen
Zimmen

Reputation: 121

So it seems that cordava can only load files that are in the app bundle. You cannot simply alter the webroot parameter to take the documents folder.

What you could do is use the FileReader API to read from the persistent store. This would mean you would have to create some sort of bootstrap html / javascript that is in the app bundle and create code that loads the content from the persistent store (which you can update yourself anytime you like)

This is a great place to start looking: Cordava File API docs

Upvotes: 0

Alexander Casassovici
Alexander Casassovici

Reputation: 335

I was considering using the www folder as a bootstrap to download the actual app in a www folder in the document directory, and loading the index.html page from there (and the rest of the app)

I'm wondering if that would be an option

Of course the ObjectiveC UIWebView would point to the downloaded version if it exists

Upvotes: 2

codemonkey
codemonkey

Reputation: 5267

With a PhoneGap/Cordova app you normally load files from your local www folder. The problem with updating files at runtime is that you cannot write to the www location - you can only write to your app's 'documents' folder.

I assume you are using an Enterprise distribution since you are distributing without the app store. You could look at using something like TestFlight to distribute updates if you are happy for the users to have to go and check for updates.

You could also eliminate TestFlight and host the ipa files yourself, check for updates and then ask the user to download and install the update.

EDIT

It is not possible to write to the www folder with or without a plugin. This is due to iOS restrictions rather than PhoneGap/Cordova restrictions.

These links talk about distributing Enterprise apps over-the-air http://developer.apple.com/library/ios/#featuredarticles/FA_Wireless_Enterprise_App_Distribution/Introduction/Introduction.html

IOS Enterprise Distribution Through OTA

Enterprise In-House App distribution

Upvotes: 4

Related Questions