Quantcast
Channel: SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 789

SAPUI5 Mobile App for cross Android Platform using Phone Gap (Cordova) plugin

$
0
0

SAPUI5 is advanced framework which used to provide or design the views , those views will flexible to run in all device breakpoints(like Desktop, Tablet and Mobile).

Android is mobile technology.

Now SAPUI5 application can convert into the Android application using Phone Gap(Cardova) plugin.

 

Prerequisites:

 

     1.Android Setup in Eclipse IDE

 

     2.Phone gap plug in

 

    3.SAPUI5 libraries

 

     4.SAPUI5 developed application

 

     5. Other required changes

 

1.Android Setup in Eclipse IDE:


         a) Download Android SDK from the link http://developer.android.com/sdk/index.html

              11.jpg

        b)Once you have downloaded the SDK , execute the .exe file

 

                 12.jpg



 

   click next

          


               13.jpg

             

         click next



                 14.jpg

                 click next


                   

                  15.jpg

                 click next

 

                   16.png

                  click Install.

 

 

                 

c)Download the ADT plug in from Eclipse. For this go to Help->Install New Software

              

                     17.jpg

    

       Click the ADD button and enter Name and location for the ADT download from https://dl-ssl.google.com/android/eclipse/

       18.jpg

 

 

 

      Click OK and select the developer tool as mentioned in the below screen shot and click Next.

 

         19.jpg

       You will see the below screen and click Next button,

 

            20.jpg

 

        Accept the license agreements and click finish. Eclipse will automatically ask for the restart. Perform the Restart.

 

            21.jpg

 

      Once you finish this step, Eclipse will restart. Do not open the Android SDK manager and choose the Close button to close all the pop up.

    Go to system preference and specify the path for Android as where you have downloaded the SDK.

     

                      22.jpg

   

 

 

 

          Once you are done with the above step, open the Java perspective.

            Java perspective (Windows -> Open Perspective ->Java) and click the highlighted Android SDK Manager.

 

                   23.jpg

         Select the below packages and install.

 

          24.jpg

 

        25.jpg

 

       Once  performed the above steps, after successful installation, restart the eclipse.

 

    Create Android Applications in Eclipse:

 

          Enter the application name , minimum required SDK, Target SDK, Compile With, Theme as shown in below pic and click on “Next” button

 

         26.jpg

 

 

click next

     

          27.jpg

 

 

      click next

  

          28.jpg

 

 

       click next

 

            29.jpg

 

        click next

 

       30.jpg

  

        Then you will get project directory in Eclipse Package Explorer

 

                    31.jpg

 

     Create the AVD for this,

   Go to Windows->Android Virtual Device Manager->create->Enter the AVD details as your want, finally you will get created AVD.


   32.jpg

 

 

Click Start button->launcher, finally will show Android view automatically.


2.Phone gap plug in:

   

      

        Download the PhoneGap2.9.0 plug in from link http://phonegap.com/download

 

       Extract the phonegap2.9.0 zip file.

 

       Create the www folder under assets folder in the project, copy the cordova.js into www folder.

 

      Copy the cordova-2.9.0.jar file from phonegap2.9.0->lib->android into the libs folder in the project .

 

      Create the xml folder in res folder of project and copy the config.xml file into this xml folder.



3.SAPUI5 libraries:


      

                     For this have to download the zip files sapui5-mobile-static.zip, sapui5-sdk-static.zip andsapui5-static.zip(no need to use these 3 zips files for         one project, have to use based on our requirement).


                          33.jpg

 

 

 


After downloading the zip file and extract this zip file and copy the resource folder from this zip file into the assets->www folder of project as above screen.


4.SAPUI5 developed application:

          

                Once SAPUI5 application is ready ,


           34.jpg


            then,  have to copy the all content or files into assets->www folder of project.


       

                        35.jpg

5. Other required changes:


             changes in AndroidManifest.xml file:

    

                       add the following code in AndroidManifest.xml file,

               

               

          <supports-screensandroid:largeScreens="true"

          android:normalScreens="true"

          android:smallScreens="true"

          android:resizeable="true"

          android:anyDensity="true"/>

          <uses-permissionandroid:name="android.permission.VIBRATE"/>

          <uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>

          <uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>

          <uses-permissionandroid:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>

          <uses-permissionandroid:name="android.permission.READ_PHONE_STATE"/>

          <uses-permissionandroid:name="android.permission.INTERNET"/>

          <uses-permissionandroid:name="android.permission.RECEIVE_SMS"/>

          <uses-permissionandroid:name="android.permission.RECORD_AUDIO"/>

          <uses-permissionandroid:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

          <uses-permissionandroid:name="android.permission.READ_CONTACTS"/>

          <uses-permissionandroid:name="android.permission.WRITE_CONTACTS"/>

          <uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

          <uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>

          <uses-permissionandroid:name="android.permission.GET_ACCOUNTS"/>

          <uses-permissionandroid:name="android.permission.BROADCAST_STICKY" />


need to change following code in same AndroidManifest.xml file which are highlighted:


         

          <activity

                          android:name="com.example.horseapp1.MainActivity"

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

                          android:label="@string/app_name">

                          <intent-filter>

                          <actionandroid:name="android.intent.action.MAIN"/>

                          <categoryandroid:name="android.intent.category.LAUNCHER"/>

                          </intent-filter>

                     </activity>


changes in index.html file:

            

          add the following 3 lines as like screen in index.html file,

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

                  <scripttype="text/javascript"src="//assets/www/resources/sap/ui/thirdparty/jqueryui/jquery-ui

position.js">         

          </script>

              and,

         <scripttype="text/javascript"src="/ScimsApp/assets/www/cordova.js"></script>


          36.jpg

 

 

 

Output:

 

            lform.JPG

 

 

 

 

 

            lform2.JPG

 

              After entering the User ID and Password,  the page is navigate next page like below,

 

                  lform3.JPG


Note:Need to include the required SAPUI5 library properly as mentioned above.




 


Viewing all articles
Browse latest Browse all 789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>