Testing the Device Application on the Android Emulator

Run the SMP101Android application on the Android emulator, and change customer information to update the interface.

  1. In WorkSpace Navigator, right-click SMP101Android and select Run As > Android Application.


    Android Tutorial SMP101 Android project Run As
                                Android Application Menu

    Note: It may take several minutes for the Android emulator's home screen to appear.

    The application activation (on boarding) image indicates that the application is registering data from SAP Mobile Server.
    Android Tutorial SMP101 Android Project Onboarding
                                Data Window

    During initialization, the system enables the operation to target change notifications using:
    SynchronizationGroup sg=SMP101DB.getSynchronizationGroup("default"); 
    sg.setEnableSIS(true);
    sg.save();
                            

    When the data finishes synchronizing, the device application shows the SMP101Android application with a list of customer data in a ListView control. You can scroll through the customer list to see more data and to make changes. The data loads from the database on demand.

    When the application queries the customer list, it uses an SMP101DB.executeQuery() API to get only columns that are needed, such as (fname, lname...), instead of the entire customer object; this results in better performance.


    Android Tutorial SMP101 Android Project Customer
                                List

  2. Select the customer to update.
  3. In the customer detail screen, change the first name of the customer and click Submit.

    Android Tutorial SMP101 Android Project Customer
                            Detail Screen

    The Submit button is mapped to the synchronize operation using SMP101DB.beginSynchronize. The synchronization occurs in the background, so the user interface is unaffected.

    Any back-end changes initiate notifications from the server. The device application uses a ChangeLog API to query those managed items and update the user interface if needed.
    GenericList<ChangeLog> changeLogs=SMP101DB.getChangeLogs(query);
  4. Close the emulator to stop the SMP101Android application.