Skip to Content

Try Out the SAP BTP SDK Wizard for Android

Use the Android Studio-integrated SAP BTP SDK Wizard for Android to create a mobile app and configure it to make use of SAP 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
flyingfish162Bruce MengMarch 22, 2022
Created by
danielva
October 14, 2018
Contributors
danielva
flyingfish162

Prerequisites

  • Step 1

    Please read Prerequisites first.

    1. Open Android Studio.

    2. Choose New SAP BTP Android App, which is an option created by the SAP BTP SDK Wizard for Android.

      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 Mobile Services
      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 account
      Password Password for your 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 Mobile Services cockpit and under Important Links, both Admin URLs are present and can be copied.

      Admin API and UI URL
      Server 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 Mobile Services provides 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
      Enable Multiple Users uncheck
      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 Crash Reporting optional
      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 BTP SDK create?

  • Step 2

    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
    1. Wait for the build to finish.

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

      If you enabled push service, please make sure you install an emulator with Target labeled as Google Play. 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. Click Get Started and the license agreement screen is displayed.

      License agreement screen

      Read it and click Agree, you will see the Sign-In screen of the app. If you select Disagree, you will be asked to confirm whether to terminate onboarding. If you confirm, you will return to the Welcome screen. Otherwise, you can still select Agree to complete onboarding and start to use the app.

      License agreement disagree
    5. 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
    6. 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 access
      Passcode Policy
    7. 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.

      Usage Reporting Consent Screen
    8. Just like usage reporting, since Enable Crash Reporting is checked as well, this screen will be used to display details of how the collected information will be used. Select either Allow or Deny. If you select Deny, the crash information will only be stored locally.

      Crash Reporting Consent Screen
    9. 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
    10. 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 BTP SDK Wizard for Android!

    What features does the generated app contain?

Back to top