All Products
Search
Document Center

Mobile Platform as a Service:Android API

Last Updated:Jun 03, 2026

The MPSync class encapsulates all Android API operations for the mPaaS mobile synchronization service (MSS), including connection lifecycle, user session management, and data push callbacks.

Note

As of June 28, 2020, mPaaS no longer provides maintenance for baseline 10.1.32. Use the 10.1.68 or 10.1.60 series baselines. To upgrade your baseline version, see mPaaS 10.1.68 Upgrade Guide or mPaaS 10.1.60 Upgrade Guide.

In baseline 10.1.32 and later, the MPSync class in the mPaaS middle layer encapsulates all MSS API operations. Access all mobile synchronization features through the MPSync object.

java.lang.Object
  - com.mpaas.mss.adapter.api.MPSync

Public methods:

Return value

Description

void

setup(Application application): Initializes services that MSS depends on. Call before initialize. Available only in baseline 10.1.60 and later.

void

appToBackground(): Notifies the SDK that the app moved to the background and disconnects from the server. Call each time the app backgrounds.

void

appToForeground(): Notifies the SDK that the app started and establishes a server connection. Call each time the app foregrounds.

void

clearUserInfo(): Logs out the user.

void

initialize(Context context): Initializes the mobile synchronization service.

boolean

isConnected(): Returns whether MSS is connected.

void

registerBiz(String bizType, ISyncCallback syncCallback): Registers a callback to receive business data. The SDK invokes the syncCallback implementation when synchronized data arrives.

void

reportMsgReceived(SyncMessage syncMessag): Acknowledges data receipt to the server after syncCallback delivers data. Without a reportMsgReceived acknowledgment, the server retries up to six times, then deletes the data.

void

unregisterBiz(String bizType): Unregisters a synchronization configuration. The SDK stops invoking syncCallback for pushed data under that configuration.

boolean

updateUserInfo(String sessionId): Updates user logon information when userId or sessionId changes. Must be called at least once.

setup(Application app)

Declaration

public static void setup(Application application)

Description

Initializes the services that MSS depends on. Call this method before initialize. Available only in baseline 10.1.60 and later.

Parameters

Parameter

Type

Description

application

Application

The Application instance.

Return value

None.

appToBackground()

Declaration

public static void appToBackground()

Description

Notifies the client SDK that the app entered the background and disconnects from the server. Call this each time the app moves to the background.

Call this in the onStop() method of your home activity. Without this call, the connection stays active in the background, increasing power consumption and data usage.

Parameters

None.

Return value

None.

appToForeground()

Declaration

public static void appToForeground()

Description

Notifies the client SDK that the app moved to the foreground and establishes a connection with the server. Call this each time the app resumes.

Call this in your home activity's onResume() method.

Parameters

None.

Return value

None.

clearUserInfo()

Declaration

public static void clearUserInfo()

Description

Logs the user out.

Parameters

None.

Return value

None.

initialize(Context ctx)

Declaration

public static void initialize(Context ctx)

Description

Initializes the mobile synchronization service. Must be called before using the service.

Call only once per app lifecycle.

Parameters

Parameter

Type

Description

ctx

Context

A non-empty Context.

Return value

None.

isConnected()

Declaration

public static boolean isConnected()

Description

Returns whether the mobile synchronization service is currently connected.

Parameters

None.

Return value

Returns true if connected, false otherwise.

registerBiz(String bizType, ISyncCallback syncCallback)

Declaration

public static void registerBiz(String biz, ISyncCallback callback)

Description

Registers a callback to receive business data. The client SDK invokes the syncCallback implementation when synchronized data arrives.

Call this for each synchronization configuration.

Parameters

Parameter

Type

Description

bizType

String

The synchronization identity.

syncCallback

ISyncCallback

The callback implementation class.

Return value

None.

reportMsgReceived(SyncMessage syncMessag)

Declaration

public static void reportMsgReceived(SyncMessage msg)

Description

Call this after receiving pushed data in syncCallback to acknowledge receipt to the server. Without a reportMsgReceived acknowledgment, the server retries delivery up to six times, then permanently deletes the data.

Parameters

Parameter

Type

Description

syncMessag

SyncMessage

The synchronization message.

Return value

None.

unregisterBiz(String bizType)

Declaration

public static void unregisterBiz(String biz)

Description

Unregisters a synchronization configuration. After unregistering, the service stops invoking syncCallback for data received under that configuration.

Parameters

Parameter

Type

Description

biz

String

The synchronization identity.

Return value

None.

updateUserInfo(String sessionId)

Declaration

public static boolean updateUserInfo(String sessionId)

Description

Internally calls LongLinkSyncService.getInstance().updateUserInfo(String userId, String sessionId). The userId is the user ID set in MPLogger. Call this whenever userId or sessionId changes, a session expires, or auto-logon succeeds. Neither parameter can be empty. Returns false if userId is not set.

Parameters

Parameter

Type

Description

sessionId

String

The session ID.

Return value

Returns true if user information is updated successfully, or false if userId is not set.