Debugging Android Object API Development

Device client and SAP Mobile Server troubleshooting tools for diagnosing Google Android development problems.

Client-side debugging

Problems on the device client side that may cause client application problems:
  • SAP Mobile Server connection failed.
  • Data does not appear on the client device.
  • Physical device problems, such as low battery or low memory.
To find out more information on the device client side:
  • Check the log record on the device. Use the <PkgName>DB.getLogRecords (com.sybase.persistence.Query) or Entity.getLogRecords() methods. Use this method for logs corresponding to MBO classes.

    This is the log format:

    level,code,eisCode,message,component,entityKey,operation,requestId,timestamp

    This is a log sample:

    5,500,'','java.lang.SecurityException:Authorization failed: Domain = default Package = end2end.rdb:1.0 mboName = simpleCustomer action = delete','simpleCustomer','100001','delete','100014','2010-05-11 14:45:59.710'
    • level – the log level currently set. Values include: 1 = TRACE, 2 = DEBUG, 3 = INFO, 4 = WARN, 5 = ERROR, 6 = FATAL, 7 = OFF.
    • code – replication synchronization, SAP Mobile Server administration codes, based on HTTP return codes:
      • 200 – success.
      • 401 – the client request included invalid credentials, or authentication failed for some other reason.
      • 404 – the client tried to access a nonexistent package or MBO.
      • 409 – backend EIS is deadlocked.
      • 412 – backend EIS threw a constraint exception.
      • 500 – failure.
      • 503 – backend EIS is not responding, or the connection is terminated.
      • 601 – the cache database (CDB) reported an error.
    • eisCode – a value specific to the EIS backend, if any. Typically defaults to blank or 0 (zero); can be set via result checker.
    • message – the message content.
    • component – Mobile Business Object (MBO) name.
    • entityKey – MBO surrogate key, used to identify and track MBO instances and data.
    • operation – operation name.
    • requestId – operation replay request ID or messaging-based synchronization message request ID.
    • timestamp – message logged time, or operation execution time.
  • For other issues, you can use tracing on the device side to trace Client Object API activity. SAP Mobile Platform supports three levels of tracing:
    • 1 = Tracing is disabled
    • 3 = SQL Trace without payload
    • 5 = SQL Trace with payload (values displayed)
    There are two ways to enable tracing on the client side:
    • Via SAP Control Center through the Applications folders:
      1. Click on the Applications folder in the SAP Mobile Platform Cluster frame.
      2. In the Applications tab, select the application you wish to enable tracing for.
      3. Select the Application Connections tab and select the user you wish to enable tracing for.
      4. Click on the Properties button to open the Application Connection Properties window.
      5. Click on Device Advanced to display advanced connection properties.
      6. Change the value of the Device Level Trace property to the appropriate level.
      7. Click OK to save your changes.
    • Via code by calling the appropriate API. In the SUPConnectionProfile class, there are two APIs that can be used:
      - enableTrace(boolean enable)
      - enableTrace(boolean enable, boolean with Payload)
    • The application in the initialization code can invoke these APIs to enable/disable tracing:
      ConnectionProfile *cp = SMP101DB.getConnectionProfile();
      
      // To enable trace of client database operations (SQL statements, etc.)
      cp.enableTrace(true);
      
      // To enable trace of client database operations with values also displayed
      cp.enableTrace(true, true);
      
      // To disable trace of client database operations
      cp.enableTrace(false);
      
      
    Note: Once the trace level is set, the application must be restarted for the tracing to take effect. When using SAP Control Center, SQL tracing (level 3 and 5) can cause significant performance degradation, so it should be used with caution. SQL tracing should only be enabled via SAP Control Center long enough for the device application to capture relevant tracing. When finished, you should shut down the application and relaunch it to run with tracing disabled. (When using code you can turn tracing on and off at any time).

Server-side debugging

Problems on the SAP Mobile Server side that may cause device client problems:
  • The domain or package does not exist.
  • Authentication failed for the synchronizing user.
  • The operation role check failed for the synchronizing user.
  • Back-end authentication failed.
  • An operation failed on the remote, replication database back end, for example, a table or foreign key does not exist. Detailed messages can be found in the Log Record.
  • An operation failed on the Web service, REST, or SAP® back end. You can find detailed messages in the log record.
To find out more information on the SAP Mobile Server side:
  • Check the MMS server log files. See the SAP Control Center for SAP Mobile Platform documentation for more information.
Related reference
SAP Mobile Platform End-to-End Process Flow
Debugging the Cache
Debugging Data Change Notification
Debugging BlackBerry Object API Development
Debugging iOS Object API Development
Debugging Windows and Windows Mobile Object API Development
Debugging OData End-to-End Process Flow
Debugging DOE-C End-to-End Process Flow
Debugging JCO End-to-End Process Flow