SAP Precision Marketing Android SDK
concepts and can provide a working base to build your own application.
Prerequisites
- Sign up for a Free Trial account on SDN: http://scn.sap.com/docs/DOC-35829
- Once you have accepted the EULA you will receive your SPM account, developer and consumer id, your private key and a link where you can download the SDK.
- Update the developer key/secret in the SDK to use the ones you received in the previous step.
Install following on your system to work with the SAP Precision Marketing App Example for Android:
- Android SDK Tools
- Eclipse
If you have already set up Eclipse for Android development, then move to the next section.
To setup Eclipse perform the following steps:
- Download and install the Android SDK Tools for your system. Refer to: http://developer.android.com/sdk/index.html
- Download and install Eclipse. Refer to: http://www.eclipse.org/downloads/
- Install the Eclipse plugin for Android development. Refer to:http://developer.android.com/sdk/installing/installing-adt.html
.
- After installing the Android SDK, open the Android SDK Manager and ensure that you download Android 4.0 (API 14) and Extras - Google Play Services (Rev 13 or later).
Import the App Example into an Eclipse Workspace
Import the App Example into an Eclipse workspace by following these steps:
1. Unzip the SPM Java API Kit
Unzip the apikit-1.0.zip file (for example: on your desktop). Remember this location, as you will need to find it later.
2. reate a folder for an Eclipse workspace.
You can use any name you like. In this App Example, we use SAP_Precision_Marketing_Workspace.
3. Start Eclipse.
Select the workspace you created above. In the Workspace Launcher that appears after Eclipse is started, choose Browse... to specify the path to the workspace folder, and then choose OK.
4. Import SAP Precision Marketing Android Example into Workspace.
5. Choose File --> Import. The Import dialog box displays.
6. Under Android, choose Existing Android Code into Workspace and then choose Next.
7. The Import Projects dialog box displays. Use the Browse... button to select the location of the unzipped app example (from step 1 above). Ensure that Copy Projects into Workspace is checked and then choose the Finish button. Note that after clicking Finish, Eclipse will report errors in the project until the remainder of the steps in this section are completed.
8. Import Google Play Services Lib into the Eclipse Workspace.The Google Play Service lib contains additional functionality beside the standard Android
platform. It is part of the Android SDK tools. You must import this library so that the app example has access to the Google Maps V2 functionality.
To begin, in Eclipse, choose File --> Import. The Import dialog appears as displayed below. Under Android, choose Existing Android Code into Workspace and then choose Next.
The Import Projects dialog box displays. Use the Browse... button to select the location of the Google Play Service lib (it is located with the Android SDK tools: <AndroidHome>/extras/google/google_play_services/libproject). Ensure that Copy Projects into Workspace is unchecked, and then choose Finish.
9. Add Google Play Services Lib to the App Example .To add the Google Play Services Lib, right-click on MainActivity in the Eclipse Project
Explorer and then select Properties. The Properties dialog box displays. Choose Android from the list on the left to view the android properties:
In the Library section above, highlight the existing entry with the red X and choose the Remove button. The Library section will now be empty.Next, choose the Add... button in the Properties dialog box above. The Project Selection dialog box appears, as displayed below. Highlight google-play-services_lib and choose OK.
The project properties dialog box displays again. To display the Google Play Services library in the Library section, choose OK.
Google Maps Key

<meta-data android:name="com.google.android.maps.v2.API_KEY"android:value="your-key-here" /> |
Device API Developer ID and Secret
private static String DEVELOPERID = "your-developer-id-here"; private static String DEVELOPERSECRET = "your-developer-secret-here"; |
If you are using a real device:
- Android 4.0 or later must be running
If you are using an emulator:
- Ensure the target is set to Android 4.0 (API 14)