invokeSync

View Markdown

Last edited on 2026-04-06

When wmpf.Channel.invokeSync is called in Mini Program, the Client side must use the call operation to complete the synchronous invocation.

Input Parameters

command corresponds to the "method" field in the call method, and data corresponds to the "arg" field in the call method.

Parameter Type Required Description
command String Yes Mini Program Command name passed through wmpf to the third-party app
data String No Mini Program Command parameters passed through wmpf to the third-party app

Return Parameters

Returned via Bundle

Parameter Type Required Description
data String No The invocation return result transmitted by the third-party app to Mini Program via wmpf

Sample Code

// Synchronous call
override fun call(method: String, arg: String?, extras: Bundle?): Bundle? {
 Log.i(TAG, "method: $method, arg: $arg, extras: $extras")
 // Implement specific functional logic
 val bundle = Bundle()
 bundle.putString("data", "call success, method: $method, arg: $arg, extras: $extras")
 // Return the execution result to the Mini Program side
 return bundle
}