User level: All
Original publication date: 26/11/2014
By downloading software from the Adobe Web site you agree to the terms of our license agreement. Please read it before downloading.
Begin by downloading the sample files that are provided at the beginning of this article. The sample contains a .zip file that can be added directly to your iOS DPS App Builder. The figures below show the various views of the app.
To correctly use all the features of the provided template, you must have already setup your Entitlement Server. The template uses some of the Library and Store APIs V2. All other features are packaged with your viewer.
Download and decompress the sample files folder to see the contents.
The application can detect when it is offline and unable to access any online resource. For this case, there is a separate offline banner image that is implemented. Since purchase, download, and entitlement are not possible when offline, this banner simply asks the user to connect the application by getting online. (Figure 1)
Logged out banner
In the other case, when the internet connection is detected, the archive will be loaded from the URL set at Banner page URL. Now, depending on the state of the user, a different banner will be displayed. By default, when the app is installed and opened for the first time, the logged out banner will appear. (Figure 2)
Logged in banner
After the user logs in, the banner will be changed into logged in banner, just after the first library update. (Figure 3)
During development, Adobe recommends that you first build and test your content on the desktop using Safari. This allows you to adjust the user interface (UI) without having to generate a new viewer to see each change. When testing on your desktop, the API file is not available, so the viewer loads the data from the Adobe fulfillment XML feed.
While testing on the desktop, ensure that you remove the include for AdobeLibraryAPI.js in the index.html file - otherwise you can't view the files in the desktop browser. When testing on the desktop, if nothing displays, open the debugger to check whether there are file paths that cannot be resolved.
The following list contains descriptions of the key files in the template:
- entitlement_banner_sample.zip - The file that is uploaded to App Builder. It is included as an example. This file can be uploaded to App Builder as - is for testing purposes.
- AdobeLibraryAPI.js - The file that contains the library and store APIs.
- index.html - The HTML file used to display the content.
- jquery-1.11.0.min.js - The jQuery library.
- banners - The folder where all the three different banners are kept
- Upload the same files that you have in the archive to your server and add its URL to the Banner page URL
- Change the Banner height to Fixed size: 195 px (Figure 4)
APIs used in this example
Here are the API calls used in this example:
- adobeDPS.deviceService.isOnline - Boolean variable that shows whether the device is connected to the internet or not. Note: HTML5's navigator.onLine property and "offline" and "online" events should be used in most cases.
- adobeDPS.authenticationService.isUserAuthenticated - Boolean variable that shows whether a user is currently authenticated. It returns true, if the user is authenticated.
There are also the following articles that can be very useful: