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

August 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

Please read Prerequisites first.

  1. Open 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 cockpit 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 Sample and set the Application ID to be com.sap.wizapp.

    Sample tab information
  7. 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. Select it and click Next.

    Odata service destination screen
  8. 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
  9. 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
  10. 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. (If you have created any before, click Add project.)

    Add project in Firebase
  2. Click Continue until a new project is successfully created.

  3. Access Project settings for the newly created project.

    Project settings
  4. Scroll down and 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
  5. Download the google-services.json file.

    Download google-services.json file
  6. 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.

  7. 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 Configuration in Mobile Settings Exchange page. The passcode screen will not be displayed if the Enable Passcode Policy is not checked.

    Mobile Settings Exchange page accessPasscode 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 ALLOW or DENY. Usage Reporting is covered in a later tutorial in this mission.

    Data Collection screen
  7. The license agreement screen is displayed.

    License agreement screen

    Read it and click AGREE, you will see the first screen of the app. If you select DISAGREE, you will be asked to confirm whether to terminate onboarding. If you confirm, you will be back to welcome screen. Otherwise, you can still select AGREE to complete onboarding and start to use the app.

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

    Entities screen

    Tap Products to navigate to the products list.

    Products screen
  9. Tap a list item to display the following editable detail screen.

    Category detail

For further information on generating your app, see Creating Apps with 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