Create a new Android project in the eclipse workspace. Add library resources to the
project and set other application properties.
Creating an Android Project
- Start the Eclipse workspace.
- Select .
- Select Android > Android Application
Project, then Next.
- In the Creates a new Android Application page of the New Android Application
wizard, enter the appropriate values.
- Click Next.
- In the Configure Launcher Icon window, accept the default settings and click
Next.
- In the Create Activity window, select Create Activity,
then select BlankActivity, and click Next.
- In the New Blank Activity window, use the appropriate values and click
Finish.
Setting Up the Android SDK Library in the Plug in
Set up the Android SDK in the ADT Plugin.
- In the Eclipse environment, from the Window menu, select
Preferences.
- In the left navigation pane, select the Android
node.
- Click Browse to search for the location where you have
stored the Android SDK.
- Click Apply and OK.
Adding User Permissions in Android Manifest File
- In the Eclipse project, open the Android manifest file.
- Add the user permissions in the AndroidManifest.xml file.
To use the
applications offline, AndroidManifest.xml should have
permission for accessing network state along with registered broadcast
receiver.
:<! -- adding Permission to access network state -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<! -- adding Permission to access network state -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" ></uses-permission>
(Optional) For Offline-Capability
<application
.
.
.
.
>
<receiver android:name="com.sap.mobile.lib.request.NetworkStateListener"
android:label="NetworkStateListener">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>
<activity
.....
</activity>
.
.
.
</application>
Importing Libraries to your Android Application Project
- Download the OData SDK library files from
<SMP_HOME>\MobileSDK3\NativeSDK\ODataFramework\Android\
to a <Parent directory> in your host development
system.
(Online capability), Download the following libraries:
- CoreServices
- Connectivity
- Common
- DataVaultLib
- gson
- Parser
- perflib
- Request
- Sap-e2etrace
(To use Applications offline) Download the following libraries
along with the above mentioned libraries:
- Cache
- Persistence
- sqlcipher-android-2.1.1
- commons-codec-1.3
- guava-r09
- libs/armeabi (includes libdatabase_sqlcipher.so,
libsqlcipher_android.so and libstlport_shared.so)
- icudt46l.zip file from assets folder
- (Optional) If you did not use the project wizard to create your project, create
a new folder, named libs, in your Eclipse/Android
project.
- Right-click the libs folder and choose
Import > General >
File System, then click
Next.
- Browse the file system to find the library's parent directory (where you have
downloaded it).
Note If you use AfariaSLL.jar to provision
configuration data and certificates for your
SAP Mobile Platform client application, ensure to remove
libcrypto.jar and libssl.jar,
as AfariaSLL internally has these two libraries.
- (Optional) Click OK, then click the directory name (not
the checkbox) in the left pane and select the relevant JAR in the right pane
from
AndroidoDataSDK-3.0.0-CIAT-SNAPSHOT-bin[1].zip\Android\libraries.
This step physically places the library into your project.
- (Optional) Right-click your project, choose Build Path >
Configure Build Path, click the
Libraries tab, then click Add
JARs.
- (Optional) Navigate to the JAR in the libs directory and add it. (This step
converts JAR for use on Android.)
This procedure includes a Dalvik-converted
JAR in your Android project and makes Java definitions available to Eclipse
in order to find the third-party classes when compiling your project's
source code.
- Add the files from assets folder into your application assets folder.
- Build the application.