- PhoneGap Tutorial
- PhoneGap - Home
- PhoneGap - Overview
- PhoneGap - Environment Setup
- PhoneGap - App Contents
- PhoneGap - App Compilation
PhoneGap - App Contents
Offline websites are copied to local hard drive and accessed whenever the user needs to without any internet connection. Likewise, this offline web app will let you create a web application that is downloaded to its entirety to the mobile devices of a user who can access that offline.
An application for this type of app may include app having collection of stories, short tutorials or any other offline content of users' interest, which he/she can read offline even when internet is not available.
The following image represents the folder structure for offline app. At root directory it requires only two files, config.xml and index.xml.
The config.xml contains app configuration settings which we learnt in previous section. The index.html file contains homepage of web contents.
One important thing to learn here is that all links inside all html files should contain relative path only. That is, no absolute path or base href tag should be there.
The following image shows folder structure for our app to be in online mode. In online mode, entire web content is loaded from internet website.
You may notice that data folder is missing in online mode app, because all the files reside on the actual server and are accessible via internet. The index.html file contains actual links as it contains at the web server and all its links are either absolute or used with base href tag.
After you have decided the mode of your app and organized its files in the file structure mentioned above, you need to zip your file with any standard zip tool and save it. We shall use this file in the next section.
Sign Your App
It is essential for any app to be signed by its developers or developing organization to keep things in order. For this reason, you need to sign your app. You may need keytool which is a part of standard java distribution.
Execute the following command in %JAVA_HOME% in your Windows command prompt or Linux Shell −
keytool -genkey -v -keystore my_keystore.keystore -alias TutorialsPoint -keyalg RSA -keysize 2048 -validity 10000
This should generate my_keystore.keystore file, which we shall need in the next section.
Kickstart Your Career
Get certified by completing the courseGet Started