# Extension SDK

The Extension SDK is a supplement to the core SDK, so to use the Extension SDK, you must also depend on the core SDK.

To ensure the security and stability of the SDK, APIs requiring permissions are placed in the Extension SDK as much as possible. FinClip splits the SDK into a core SDK and extension SDKs, where the latter are supplements to the former. Therefore, using an Extension SDK also requires depending on the core SDK.

Some APIs involving permissions have been split into various extension SDKs. You can integrate the corresponding extension SDKs based on your actual situation.

Obtaining the Extension SDK

You can log in to the Resource Download Center (opens new window) to download the iOS SDK files. The extension SDKs are also included in the downloaded compressed package.

# 1 Extension SDK

FinAppletExt is the first extension SDK we have split out.

# 1.1 Registering the Extension SDK

// Register the extension SDK
[[FATExtClient sharedClient] fat_prepareExtensionApis];

# 1.2 Included Mini-Program APIs

API Name API Description
chooseLocation Choose a location.
getLocation Get location information.
openLocation View a location using a map.
choosePoi Open the POI list to choose a location.
startRecord Start recording.
stopRecord Stop recording.
RecorderManager Recording manager and a series of APIs.

# 2 WebRTC Extension SDK

FinAppletWebRTC contains the WebRTC component we have encapsulated based on Google's WebRTC library.

# 2.1 Registering the Extension SDK

// WebRTC initialization
[FATWebRTCComponent registerComponent]

# 2.2 Included Mini-Program APIs

API Name API Description
webrtc-video component Component and a series of WebRTC APIs.

# 3 Baidu Map Extension SDK

FinAppletBDMap contains the map-view component we have implemented based on the Baidu Map SDK.

# 3.1 Registering the Extension SDK

// Baidu Map extension SDK initialization
[FATBDMapComponent setBDMapAppKey:@"The key you applied for"]

# 3.2 Included Mini-Program APIs

API Name API Description
Map component View component.
MapContext A series of APIs.

# 4 AMap Extension SDK

FinAppletGDMap contains the map-view component we have encapsulated based on the AMap SDK.

# 4.1 Registering the Extension SDK

// AMap extension SDK initialization
[FATGDMapComponent setGDMapAppKey:@"The key you applied for"]

# 4.2 Included Mini-Program APIs

API Name API Description
Map component View component.
MapContext A series of APIs.

# 5 Tencent Map Extension SDK

FinAppletTXMap contains the map-view component we have encapsulated based on the Tencent Map SDK.

# 5.1 Registering the Extension SDK

// Tencent Map extension SDK initialization
[FATTXMapComponent setTXMapAppKey:@"The key you applied for"]

# 5.2 Included Mini-Program APIs

API Name API Description
Map component View component.
MapContext A series of APIs.

# 6 Google Maps Extension SDK

FinAppletGMSMap contains the map-view component we have encapsulated based on the Google Maps SDK.

# 6.1 Registering the Extension SDK

// Google Maps extension SDK initialization
[FATGMSMapComponent setGMSMapAppKey:@"The key you applied for"]

# 6.2 Included Mini-Program APIs

API Name API Description
Map component View component.
MapContext A series of APIs.

Note

  1. You can choose to integrate any one of Baidu Map/AMap/Tencent Map/Google Maps, and then call the initialization method of that map. The Map component and Map APIs will then use that map implementation.
  2. If none of Baidu Map/AMap/Tencent Map/Google Maps are integrated, the Map component and Map APIs will use the system's built-in map implementation. Therefore, regarding the Map component and related APIs, you only need to choose one of the four solutions: the system's built-in map, Baidu Map, AMap, or Tencent Map.

# 7 Bluetooth Extension SDK

FinAppletBLE contains a series of Bluetooth-related APIs.

# 7.1 Included Mini-Program APIs

API Name API Description
Bluetooth - General A series of APIs.
Bluetooth - Low Energy Central A series of APIs.
Bluetooth - Low Energy Peripheral A series of APIs.
Bluetooth - Beacon A series of APIs.

# 8 Contacts Extension SDK

FinAppletContact is the Contacts extension SDK.

# 8.1 Registering the Extension SDK

// ContactSDK initialization
[FATContactComponent registerComponent]

# 8.2 Included Mini-Program APIs

API Name API Description
addPhoneContact Add a contact to the device's address book.

# 9 Clipboard Extension SDK

FinAppletClipBoard: Since clipboard functionality is also quite sensitive, we have encapsulated the two clipboard-related APIs in this extension SDK.

# 9.1 Registering the Extension SDK

// ClipBoard initialization
[FATClipBoardComponent registerComponent];

# 9.2 Included Mini-Program APIs

API Name API Description
setClipboardData Set clipboard content.
getClipboardData Read clipboard content.

Note

Since clipboard permissions are quite sensitive and the APIs are relatively niche, you can also add the two clipboard-related APIs by registering custom APIs.

The injected source code is as follows:

// Register setClipboardData
[[FATClient sharedClient] registerExtensionApi:@"setClipboardData" handler:^(FATAppletInfo *appletInfo, id param, FATExtensionApiCallback callback) {
    NSString *data = param[@"data"];
    if (!data) {
        callback(FATExtensionCodeFailure, @{@"errMsg" : @"Parameter data is empty"});
        return;
    }
        
    [UIPasteboard generalPasteboard].string = data;
    NSDictionary *result = @{@"data" : data};
    callback(FATExtensionCodeSuccess, result);
}];

// Register getClipboardData
[[FATClient sharedClient] registerExtensionApi:@"getClipboardData" handler:^(FATAppletInfo *appletInfo, id param, FATExtensionApiCallback callback) {
    NSString *data = [UIPasteboard generalPasteboard].string;
    NSDictionary *result = @{@"data" : data == nil ? @"" : data};
    callback(FATExtensionCodeSuccess, result);
}];

# 10 Agora Extension SDK

Note

It is recommended to use the live SDK instead of the Agora SDK.

FinAppletAgoraRTC: Currently, the live-player and live-pusher components can be implemented using the Agora extension SDK.

Note

The series of protocol methods corresponding to the live-player and live-pusher components have already been encapsulated in FATAppletNativeViewProtocol. The Agora extension SDK is our implementation of the live-player and live-pusher protocol methods using the Agora SDK. Therefore, when using live-player and live-pusher, you can either implement the protocol methods yourself in your App, or directly integrate the Agora extension SDK.

# 10.1 Registering the Agora Extension SDK

// AgoraRTC initialization
[FATAgoraRTCComponent registerComponent]

# 10.2 Included Mini-Program APIs

API Name API Description
init Initialize the Agora SDK.
setRole Set the client role.
join Join a channel.
publish Start publishing the stream.
muteLocal Mute the local audio.
unmuteLocal Unmute the local audio.
mute Mute remote audio.
unmute Unmute remote audio.
renewToken Refresh the token.
setRemoteVideoStreamType Set the type of subscribed video stream.
destroy Stop publishing and release resources.
live-pusher live-pusher component.
live-player live-player component.

# 11 WeChat Extension SDK

FinAppletWXExt: Some WeChat-related APIs require the WeChat Open SDK to function, and we have also encapsulated these.

# 11.1 Registering the WeChat Extension SDK

// WeChat extension SDK initialization
[FATWXExtComponent registerComponent:@"WeChat appid" universalLink:@"universalLink"];

# 11.2 Included APIs

API Name API Description
login Launches the WeChat Mini-Program, obtains the login credential, and returns the result to the FinClip Mini-Program.
getUserProfile Launches the WeChat Mini-Program, obtains user information, and returns the result to the FinClip Mini-Program.
requestPayment Launches the WeChat Mini-Program, initiates a WeChat payment, and returns the result to the FinClip Mini-Program.
getPhoneNumber Launches the WeChat Mini-Program, obtains a dynamic token, and returns the result to the FinClip Mini-Program.

# 12 Live SDK

FinAppletLive: Provides quick integration for the live SDK, offering capabilities for live streaming push, pull, and playback.

# 12.1 Using the Live Extension SDK

// The default value is NO. When set to YES, it indicates using the built-in live component.
FATUIConfig *uiConfig = [[FATUIConfig alloc] init];
uiConfig.useNativeLiveComponent = YES;

// Live initialization
#ifdef __arm64__
[FATLiveComponent registerComponent];
#endif
API Name API Description
play Play.
stop Stop.
pause Pause.
resume Resume.
mute Mute.
API Name API Description
start Start publishing the stream.
stop Stop publishing the stream and stop the camera preview.
pause Pause publishing the stream.
resume Resume publishing the stream.
startPreview Start the camera preview.
stopPreview Stop the camera preview.
switchCamera Switch between the front and rear cameras.

# 12.3.1 Sensitive Permissions Involved in LiveSDK

Permission Related Interfaces/Components
Camera Permission is requested during initialization.
Microphone (Audio Recording) Permission is requested during initialization.

# 13 Advertisement Extension SDK

FinAppletAdvertisement: Provides Mini-Program advertisement-related APIs. We have encapsulated capabilities such as ad requests, display, event callbacks, and monitoring/reporting. Currently, it supports interstitial ads, rewarded video ads, and feed ads.

# 13.1 Importing the Advertisement Extension SDK

#import <FinAdvertisementExt/FinAdvertisementExt.h>

# 13.2 Registering the Advertisement Extension SDK

// Advertisement extension SDK initialization
[FATAdvertisementClient initSDK];

# 13.3 Included APIs

API Name API Description
invokeNativeAd Create, load, display, or destroy interstitial ads and rewarded video ads, and return ad events via onNativeAdEvent.
showAdComponent Retrieve and display Mini-Program ad component data; the result is returned via onAdData.
adComponentEvent Receive events such as display, click, playback completion, and closing for ad components, and complete the corresponding monitoring and reporting.
destroyAdComponent Destroy the specified ad component instance and clean up the corresponding ad resources and context.
© FinClip with ❤ , Since 2017