# Other Methods
# 1 Mini-Program WebView Management
# 1.1 Get Current Mini-Program WebView URL
Example
MopSdk.getCurrentWebViewURL(
(ret)=>{
},
(ret)=>{
},
(ret)=>{
})
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| onSuccess | Function | Success callback for getting the current Mini-Program WebView URL |
| onFail | Function | Failure callback for getting the current Mini-Program WebView URL |
| onProgress | Function | Progress callback for getting the current Mini-Program WebView URL |
# 1.2 Get Current Mini-Program WebView UserAgent
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| onSuccess | Function | Success callback for getting the current Mini-Program WebView userAgent |
| onFail | Function | Failure callback for getting the current Mini-Program WebView userAgent |
| onProgress | Function | Progress callback for getting the current Mini-Program WebView userAgent |
Example
MopSdk.getCurrentWebViewUserAgent(
(ret)=>{
},
(ret)=>{
},
(ret)=>{
})
# 1.3 Set Cookies for Specified URL in WebView (Android Only)
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| appId | String | Mini-Program appId |
| url | String | WebView URL |
| cookies | String | Cookies |
Example
MopSdk.setWebViewCookie({
appId,
.url,
cookies
})
# 1.4 Delete Cookies for Specified URL (Android Only)
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| appId | String | Mini-Program appId |
| url | String | WebView URL |
Example
MopSdk.removeWebViewCookie({
appId,
.url
})
# 1.5 Delete All Cookies (Android Only)
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| appId | String | Mini-Program appId |
Example
MopSdk.removeWebViewAllCookie({
appId
})
# 2 Mini-Program Event Management
# 2.1 Native Sends Event to Mini-Program
Example
MopSdk.sendCustomEvent(appId, {
});
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| appId | String | Mini-Program appId |
| params | Object | Parameters to send |
# 2.2 Native Sends Event to All Mini-Programs
Example
MopSdk.sendCustomEventToAll({
});
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| params | Object | Parameters to send |
# 3 Other Functions
# 3.1 Set Current User Identifier for Mini-Program
Typically used for Mini-Program data isolation (ft.getStorage) after App login.
Example
MopSdk.setUserId(userId);
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| userId | String | Unique identifier of the current App logged-in user |
# 3.2 Convert Mini-Program File Path to Absolute Path
Example
MopSdk.getFinFileAbsolutePath(appId,finPath,(ret) =>{
});
Parameters
| Parameter Name | Type | Description |
|---|---|---|
| appId | String | Mini-Program appId |
| finPath | String | Mini-Program file path (e.g., path after taking photo or download) |
| onCallback | Function | Callback after successful conversion |
Success Return Value
| Parameter Name | Type | Description |
|---|---|---|
| path | String | Absolute path |