You are on page 1of 13

Deploy a SAPUI5 Mobile App to Android Device

Deploy a SAPUI5 Mobile App to Android Device

TABLE OF CONTENTS
PREREQUISITE ................................................................................................................................................ 3
http://developer.android.com/sdk/installing/installing-adt.html ................................................................. 3
STEPS TO DEPLOY AN SAPUI5 APP TO ANDROID DEVICE USING PHONEGAP .................................... 3

2
Deploy a SAPUI5 Mobile App to Android Device

PREREQUISITE
You should have installed Android SDK and Android tools for Eclipse
http://developer.android.com/sdk/installing/installing-adt.html

STEPS TO DEPLOY AN SAPUI5 APP TO ANDROID DEVICE USING PHONEGAP


1. Launch Eclipse and go to Java perspective

2. Click on File -> New -> Android Application Project

3. Enter the application name as refapp-msapandroid-companylist as shown in the below pic, select
the minimum required SDK, Target SDK, Compile With, Theme as shown in below pic and click on
Next button

3
Deploy a SAPUI5 Mobile App to Android Device

4. Click on Next button with the default selection

4
Deploy a SAPUI5 Mobile App to Android Device

5. Click on Next button with the default selection

6. Click on Next button with the default selection

5
Deploy a SAPUI5 Mobile App to Android Device

7. Use the default names and click on Finish button to complete the project creation

8. The following window will be opened after the project creation

6
Deploy a SAPUI5 Mobile App to Android Device

9. Select the Assets folder in the project explorer and select New -> Folder

10. Enter the folder name as www and click on Finish button

7
Deploy a SAPUI5 Mobile App to Android Device

11. Download PhoneGap libraries (2.9 Version) from the location and extract it to a folder in your
system. Extract the zip file and copy paste the cordova.js, cordova-2.9.0.jar and res folder to your
project hierarchy as shown in the below picture

12. After this, the libraries should be visible in the project build path libraries section

8
Deploy a SAPUI5 Mobile App to Android Device

13. Add the below two lines in the MainActivity.java file. Also, change the Extends to DroidGap

super.setIntegerProperty("loadUrlTimeoutValue", 60000);
super.loadUrl("file:///android_asset/www/index.html");

14. Copy and paste the following content into the AndroidManifest.xml. Paste it below the use sdk
section.

supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />

android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"

9
Deploy a SAPUI5 Mobile App to Android Device

10
Deploy a SAPUI5 Mobile App to Android Device

15. Copy and paste the content of WebContent directory under your SAPUI5 project to www
directory of the Android project

16. Download SAPUI5 resources from http://scn.sap.com/community/developer-center/front-end In the


download section, download the available version accepting the license agreement. Extract the zip
file to a location and copy the resources folder to folder www in your project.

11
Deploy a SAPUI5 Mobile App to Android Device

17. Open the index.html and add the following lines as shown below

<script type="text/javascript" src="resources/sap/ui/thirdparty/jquery/jquery-1.7.1.js"></script>


<script type="text/javascript" src="resources/sap/ui/thirdparty/jqueryui/jquery-ui-position.js"></script>

<script src="resources/sap-ui-core-nojQuery.js"

<script type="text/javascript" src="cordova.js"></script>

18. Congratulation. You have successfully wrapped your SAPUI5 application in PhoneGap container
that can be run on Android Emulator and devices

12
www.sap.com

2013 SAP AG. All rights reserved.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP


BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP
products and services mentioned herein as well as their respective
logos are trademarks or registered trademarks of SAP AG in Germany
and other countries.

Business Objects and the Business Objects logo, BusinessObjects,


Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as
well as their respective logos are trademarks or registered trademarks
of Business Objects Software Ltd. Business Objects is an SAP
company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL


Anywhere, and other Sybase products and services mentioned herein
as well as their respective logos are trademarks or registered
trademarks of Sybase Inc. Sybase is an SAP company.

Crossgate, m@gic EDDY, B2B 360, and B2B 360 Services are
registered trademarks of Crossgate AG in Germany and other
countries. Crossgate is an SAP company.

All other product and service names mentioned are the trademarks of
their respective companies. Data contained in this document serves
informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials


are provided by SAP AG and its affiliated companies ("SAP Group")
for informational purposes only, without representation or warranty of
any kind, and SAP Group shall not be liable for errors or omissions
with respect to the materials. The only warranties for SAP Group
products and services are those that are set forth in the express
warranty statements accompanying such products and services, if
any. Nothing herein should be construed as constituting an additional
warranty.