How to publish to iOS/Android with PhoneGap Build |
Introduction:
With C#/XAML for HTML5 you can create your app by writing C#/XAML code, and when you build your project, it generates a series of HTML5/JavaScript files. Those files are located inside the "bin/Debug/output" folder that is located inside your project folder. Those files are stand-alone, which means that they don't require a server - such as ASP.NET - to run, and they don't have any external dependencies. In fact, you can even run them locally from your hard disk by simply opening the file "index.html" with your web browser. No plugins are required, and no installation is necessary.
Therefore, distributing your application created with C#/XAML for HTML5 is very easy. There are at least 3 options to distribute your application:
1st option: you upload the generated HTML5/JavaScript files to a file server for online access, such as Azure or your own website. In this case, your application can be accessed with any modern web browser. To access your application, users simply open their web browser and navigate to the URL that you give them.
2nd option: you put the generated HTML5/JavaScript files into a ZIP archive, and you give the ZIP archive to your users. All they have to do to use your application is to extract the ZIP archive and to open the file "index.html". Please note that Internet Explorer users will need to click "Allow Blocked Content", and cross-domain server calls may not be available when running this way.
3rd option: you package the generated HTML5/JavaScript files into a stand-alone application for any of the following platforms: Android, iOS*, Windows, Mac, Linux, WP, ChromeOS, etc. The packaged application is a binary executable. It can be submitted to online stores such as the Apple App Store*, Android Google Play, the Windows Store, etc. Each platform requires a different package.
Note |
---|
* Note: Apple requires users to have access to a Mac or to have a valid PhoneGap Build subscription in order to be able to compile apps for iOS or to publish them to the Apple App Store. This requirement applies to all the solutions in the market. |
This article will detail the 3rd option. It will explain how to package your application for distribution as a downloadable application for iOS or Android.
This topic contains the following sections:
Packaging your application means creating a binary executable that contains your HTML5/JavaScript files and that can run on the target platform. The executable has the following extension:
The executable works like this: it contains only one simple control, which is an instance of the native web browser control - also called WebView in Android or UIWebView in iOS - that is used to render the HTML5/JavaScript files. In order words, you can consider the executable as a sort of small web browser that serves no other function than rendering your particular HTML5/JavaScript application. It has no navigation bar, it is branded with your application name, and it can only navigate to the pages of your application. The end-user really sees it as a native application.
To create such an executable, a third party tool is required. There are multiple choices:
You can manually compile the executable using Apache Cordova. The drawback here is that you need a Mac in order to build for iOS and to test on your iOS device.
You can get a subscription to PhoneGap Build, which is free for 1 application and is very affordable for more applications. The advantage is that you do not need a Mac to build for iOS and to test on your iOS device. You only need access to a Mac during the final step of the submission to the App Store, but that step takes only a few minutes and can be done on someone else's computer.
This guide will assume that you choose the second option, that is, you subscribe to PhoneGap Build.
The rest of this tutorial will be available in the coming weeks. Please check back soon!
The rest of this tutorial will be available in the coming weeks. Please check back soon!