Skip to Content

Try Out the SAP Cloud Platform SDK for Android Wizard

test
0 %
Try Out the SAP Cloud Platform SDK for Android Wizard
Details

Try Out the SAP Cloud Platform SDK for Android Wizard

May 20, 2020
Created by
October 14, 2018
Use the Android Studio-integrated SAP Cloud Platform SDK for Android Wizard to create a mobile app and configure it to make use of SAP Cloud Platform Mobile Services features.

You will learn

  • How to create and run an Android app using the wizard
  • How to use Google Firebase to enable push notifications when generating an Android app using the wizard
  • Which screens are generated by the wizard

Prerequisites


Step 1: Create the project
  1. Open Android Studio.

    Android Studio
  2. Choose Start a new SAP Cloud Platform Android project, which is an option created by the SAP Cloud Platform SDK for Android Wizard.

    New project
  3. The wizard can save the server connection details for multiple servers. Fill in the required fields as shown below.

    Field Value
    Account Name SAP Cloud Platform Mobile Services Trial
    Admin API URL See below for how to get this URL
    Admin UI URL See below for how to get this URL
    Authentication Type Basic
    Username Username for your trial account
    Password Password for your trial account
    Save Account Information Check this so that you do not have to re-enter account information on subsequent runs of the wizard
  4. Go to the SAP Cloud Platform Mobile Services website and under Important Links, both Admin URLs are present and can be copied.

    Admin API and UI URLServer connection
  5. Click Next on the Server Connection tab.

  6. On the Cloud Configuration tab, select Create and provide the required information.

    Field Value
    Application Name Wiz App
    Application ID com.sap.wizapp
    Authentication Type Basic
    Create tab information
  7. Click Next to proceed to configuring the OData Services.

  8. Click Add… to add an OData service.

    OData services blank
  9. SAP Cloud Platform mobile services provide a sample back-end destination named com.sap.edm.sampleservice.v2 that is being used here to provide data for the application. It contains product categories, product, supplier, customer and sales order data. Since you are creating a new application, add com.sap.edm.sampleservice.v2.

    OData services add service
  10. Click Next to continue to the project configuration.

    OData services done
  11. On the Android Studio Project tab, provide the following configuration data.

    Field Value
    Project Name Wiz App
    Project Namespace com.sap.wizapp
    Target Language Java / Kotlin

    The screenshot below provides a Java example. Depending on which Target Language you choose, either Java or Kotlin code will be generated.

    Project configuration
  12. On the Project Features tab, provide the following configuration data.

    Field Value
    Use Discovery Service as Configuration Provider uncheck
    OData Online
    Create a sample user experience for the selected OData Destination check
    Enable Logging check
    Enable Upload check
    Enable Usage Reporting check
    Enable Push optional
    Project features
  13. If you would like to add push notification support to your app, proceed to Step 2 which describes how to acquire the google-services.json file required for push messaging. Otherwise, uncheck Enable Push, click Finish and proceed to Step 3.

What kind of project does the wizard from SAP Cloud Platform SDK create?
×
Step 2: Enable push notifications

If you check the Enable Push checkbox, an error message is displayed explaining that you need to specify a google-services.json file. We will obtain this file from the Cloud Messaging feature in Google Firebase.

Push Notifications enabled
  1. Open the Firebase console and click Create project.

    Add project in Firebase
  2. Access Project settings for the newly created project.

    Project settings
  3. Add Firebase to your app.

    Add Firebase to your Android app

    The Android package name must match the Project Namespace you used to create the app in Android Studio. In our example, the Android package name is com.sap.wizapp.

    Register App
  4. Download the google-services.json file.

    Download google-services.json file
  5. Now browse for the google-services.json file in the wizard. This file is placed into the app folder of the generated project and helps enable the app to work with Google Firebase notifications.

    Add google-services.json file to wizard

    You can add push configuration on the server as in the Send Notifications to Your Android Application tutorial.

  6. Click Finish and proceed to Step 3.

What file is required from Google Firebase to enable the project to receive push messages?
×
Step 3: Explore the app
  1. Wait for the build to finish.

    Project created
  2. Choose an emulator for running the app.

    For more information on creating virtual devices that run in the Android Emulator, see Create and manage virtual devices in the Android Studio User Guide.

    Deployment target
  3. Click the Run toolbar icon.

    Run the project

    The welcome screen is shown the first time the app is run.

    Welcome screen
  4. Log in with your username and password.

    Authentication screen

    The credentials you enter are securely stored by the app, and do not need to be re-entered the next time you open the app.

    The passcode (or fingerprint if enabled) screen provides an additional layer of security for your app.

    Passcode screen
  5. You can modify the passcode policy in the Mobile Service Cockpit under Client Policies. The passcode screen will not be displayed if the Enable Passcode Policy is not checked.

    Passcode Policy
  6. Because Enable Usage Reporting is checked, this screen can be used to show details of how the collected data will be used. For now, select either NOT NOW or OK. Usage Reporting is covered in a later tutorial in this mission.

    Data Collection screen

    The first screen of the app shows the different entities that are in the sample OData service.

    Entities screen
  7. Tap Products to navigate to the Products list.

    Products screen
  8. Tap a list item to display the below editable detail screen.

    Category detail

For further information on generating your app, see Running the wizard.

Congratulations! You have created your first Android app using the SAP Cloud Platform SDK for Android Wizard!

What features does the generated app contain?
×

Next Steps

Back to top