1. Extending the SDK
In addition to the core SDK, we also provide an extension SDK, which is a library that relies on the core SDK and provides various applet APIs that are not available in the core SDK. The reason for providing an extension SDK is to ensure that the core SDK is light enough and the applet API is rich enough. The core SDK is responsible for setting up the basic framework for running the app and providing a small number of the most inaccessible APIs, while retaining only basic permissions such as storage, camera, geolocation, etc., and is only a little over 1MB in size.
Get the extended SDK
You can download the Android SDK file at the Resource Download Centre. The extended SDK is also included in the downloaded zip file.
If you wish to use the API in the extension SDK, you can rely on the extension SDK library in gradle at
implementation 'com.finogeeks.mop:plugins:x.y.z' //x.y.z must be
replaced with the specific version number1.1 Overview of the extension SDK SMP API
| api name | api description information |
|---|---|
| getLocation | Get Location |
| startRecord | Start Recording |
| stopRecord | Stop Recording |
| RecorderManager | A globally unique recording manager |
2. MapSDK
The MapSDK supports the Map component and the Location API. It relies on the core SDK as a complement to the Map and Location functions. The map and location capabilities provided depend on a third-party map and location SDK, which supports the use of three combinations of Gode Subscribe to DeepL Pro to edit this document. Visit www.DeepL.com/profor more information. Map|Gode Location, Baidu Map|Baidu Location and Google Map|Google Location.
Note
Please see "Development-API-Location" for the location API support of the Gaode, Baidu and Google solutions.
2.1 Integration
- Dependency on MapSDK library in gradle.
implementation 'com.finogeeks.mop:map:x.y.z' //x.y.z must be replaced with the specific version number- Since the map and location capability implemented by MapSDK depends on the third-party map and location SDK, it is also necessary for the host APP to integrate the third-party map and location SDK and complete API_KEY, Service registration, etc.
Note
Please select one of the following third party SDK providers for integration.
For detailed integration instructions for third party SDKs, please refer to the official third party SDK integration documentation.
Reliance on third party SDK libraries: (please select one)
//Gaudet
implementation 'com.amap.api:3dmap:8.0.0' // you can replace it with the version number you need
implementation 'com.amap.api:location:5.5.1' // you can replace it with the version number you need
implementation 'com.amap.api:search:7.9.0' // you can replace it with the version number you need// Baidu
implementation 'com.baidu.lbsyun:BaiduMapSDK_Map:7.4.0' // you can replace it with the version number you need
implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.1.8' // you can replace it with the version number you need
implementation 'com.baidu.lbsyun:BaiduMapSDK_Search:7.4.0' // you can replace it with the version number you need//Google
implementation 'com.google.android.gms:play-services-maps:16.1.0' //this version is recommended and can be replaced with the version number you need, but it is not supported above this version
implementation 'com.google.android.gms:play-services-location:16.0.0'
// this version is recommended and can be replaced with the version number you need, but it is not supported above this versionRegister the API_KEY and Service of the third party SDK in AndroidManifest.xml: (choose one depending on the third party SDK you depend on)
//Gaudet
< meta-data
android:name="com.amap.api.v2.apikey"
android:value="The ApiKey you requested" />
< service android:name="com.amap.api.location.APSService" />// Baidu
< meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="The ApiKey you requested" />
< service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote" />/Google
< meta-data
android:name="com.google.android.geo.API_KEY"
android:value="The ApiKey you requested" />Configure the SO library architecture supported by the third party SDK in build.gradle.
android {
defaultConfig {
ndk {
//Set the supported SO library architecture (you can select one or more platforms of so as required)
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86",
"x86_64"
}
}
}3. Bluetooth SDK
Using the Bluetooth interface requires a separate integration of the Bluetooth SDK, once integrated the interface will take effect and no configuration is required. Integration method.
implementation 'com.finogeeks.mop:bluetooth:x.y.z'3.1 Overview of Bluetooth SDK related api
| api name | api description information |
|---|---|
| bluetooth-universal | a range of api |
| Bluetooth - low-power central device | A range of api |
| Bluetooth - Low Power Peripherals | A range of api |
| bluetooth-beacon | a range of api |
4. SoundNet SDK
The use of the SoundNet related interfaces requires a separate integration of the SoundNet SDK, which will take effect once the interfaces are integrated and no configuration is required. Integration method.
implementation 'com.finogeeks.mop:agora:x.y.z'If you use the aar import to access the SoundNet SDK, you will need to add an additional SoundNet dependency.
implementation 'io.agora.rtc:full-sdk:3.5.0'4.1 Overview of SoundNet SDK-related api
| api name | api description information |
|---|---|
| init | Initialize SoundNet SDK |
| setRole | setClientRole |
| join | Join Channel |
| publish | Start pushing streams |
| muteLocal | Mute Local |
| unmuteLocal | unmuteLocal |
| mute | remote mute |
| unmute | unmute remote |
| renewToken | refreshToken |
| setRemoteVideoStreamType | Set the subscribed video stream type |
| destroy | Stop pushing the stream and release resources |
5. WebRTCSDK
Using WebRTC-related interfaces requires a separate WebRTCSDK integration, which takes effect once the interface is integrated and requires no configuration. Integration method.
implementation 'com.finogeeks.mop:webrtc:x.y.z'If you are using the import aar to access the WebRTCSDK, you will need to add additional WebRTC dependencies.
implementation 'org.webrtc:google-webrtc:1.0.32006'5.1 Overview of WebRTCSDK-related api
| api name | api description information |
|---|---|
| mediaDevices | MediaDevices related interfaces provide access to devices connected to media inputs such as cameras and microphones, as well as screen sharing. It enables you to obtain media data from any hardware resource. |
| rtcPeerConnection | RTCPeerConnection related interface representing a WebRTC connection from the local computer to the remote end. This interface provides the implementation of methods to create, hold, monitor and close the connection. |
| mediaStream | MediaStream-related interface representing a stream of media content. A stream contains several tracks, e.g. video and audio tracks. |
| mediaRecorder | MediaRecorder related interfaces, providing media recorder and other related api. |
6. Contact SDK
The use of contact-related interfaces requires a separate integration of the contact SDK, which takes effect once the interface is integrated and requires no configuration. Integration method.
implementation 'com.finogeeks.mop:contact:x.y.z'6.1 Overview of contact SDK-related api
| api name | api description information |
|---|---|
| addPhoneContact | Add the name of the Phone Contacts API |
7. Clipboard SDK
Using the clipboard-related interfaces requires a separate integration of the clipboard SDK, which takes effect once the interface is integrated and requires no configuration. Integration method.
implementation 'com.finogeeks.mop:clipboard:x.y.z'7.1 Overview of the clipboard SDK related api
| api name | api description information |
|---|---|
| setClipboardData | setClipboardContent |
| getClipboardData | getClipboardContent |
8. Media SDK
Supported from version 2.38.0 onwards This SDK is required for the video component to be integrated with the Play as you go. Integration method:
android {
packagingOptions {
doNotStrip "*/arm64-v8a/libijkffmpeg.so"
doNotStrip "*/arm64-v8a/libijkplayer.so"
doNotStrip "*/arm64-v8a/libijksdl.so"
doNotStrip "*/armeabi/libijkffmpeg.so"
doNotStrip "*/armeabi/libijkplayer.so"
doNotStrip "*/armeabi/libijksdl.so"
doNotStrip "*/armeabi-v7a/libijkffmpeg.so"
doNotStrip "*/armeabi-v7a/libijkplayer.so"
doNotStrip "*/armeabi-v7a/libijksdl.so"
doNotStrip "*/x86/libijkffmpeg.so"
doNotStrip "*/x86/libijkplayer.so"
doNotStrip "*/x86/libijksdl.so"
doNotStrip "*/x86_64/libijkffmpeg.so"
doNotStrip "*/x86_64/libijkplayer.so"
doNotStrip "*/x86_64/libijksdl.so"
}
}
dependencies {
implementation 'com.finogeeks.mop:media:x.y.z' //x.y.z must be replaced with the specific version number
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
}Add obfuscation rules to the proguard-rules.pro file:
# Media SDK
-keep public class
com.finogeeks.PhizClip.plugins.media.player.ijk.FinIjkMediaPlayerFactory
{
public <init> ();
}
-keep class
com.finogeeks.PhizClip.plugins.media.player.ijk.IjkMediaPlayerOptionsApp
lier {
public static <fields>;
public static <methods>;
}
-keep class
com.finogeeks.PhizClip.plugins.media.player.ijk.IjkMediaPlayerOptionsApp
lier$Applier {*;}
-keep class
com.finogeeks.PhizClip.plugins.media.player.ijk.IjkMediaPlayerOptionsApp
lier$Options {*;}
#ijkplayer
-keep class tv.danmaku.ijk.media.player.** {*;}
-keep class tv.danmaku.ijk.media.player.IjkMediaPlayer{*;}
-keep class tv.danmaku.ijk.media.player.ffmpeg.FFmpegApi{*;}After the integration of the Media SDK, the player implementation of the video component will automatically switch from the system solution MediaPlayer to the IjkMediaPlayer solution without any other action.
8.1 Related APIs of the Media SDK
Since IjkMediaPlayer has so many configuration items and the needs of each app are different, the Media SDK exposes the configuration functions to the app developer to call.
class SampleApplication : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
IjkMediaPlayerOptionsApplier.setIjkMediaPlayerOptionsApplier(this) {
it.setOption(
IjkMediaPlayer.OPT_CATEGORY_PLAYER,
"start-on-prepared",
0
) // Disable auto-start playback and leave it to the upper
levels to control
it.setOption(
IjkMediaPlayer.OPT_CATEGORY_PLAYER,
"max-buffer-size",
(1024 * 24).toLong()
) // Maximum buffer size, in kb
it.setOption(
IjkMediaPlayer.OPT_CATEGORY_PLAYER,
"packet-buffering",
0L
) // So set that the loading status will only be displayed
when it stops in time
it.setOption(
IjkMediaPlayer.OPT_CATEGORY_PLAYER,
"enable-accurate-seek",
1
) // set to precise seek
}
// Other initialisation codes ......
}
}The configuration in the code snippet above is the default configuration of the Media SDK and can be configured by the app developer to suit their needs.
8.2 Some problems with IjkMediaPlayer
8.2.1 keeps loading and won't play
On some models, there may be a problem where it keeps loading and cannot be played. With Logcat, if you find the following forms of bugs.
Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr
0x7783dd1920 in tid 25128 (ff_read), pid 22268If the app is running on Android 11 and the CPU architecture is armv8a, you need to add an attribute android:allowNativeHeapPointerTagging="false" to the application tag of the Manifest.xml file. See: [issues/5342](Crashing with arm64-v8aFatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr0x7783dd1920 in tid 25128 (ff_read), pid 22268 (rmdzh .ijkplayer) -Issue #5342 - bilibili/ijkplayer - GitHub)
8.2.2 Progress inaccuracies
When dragging the progress bar or cutting in and out of full screen, progress may be backed up, this is because the player needs to parse keyframes and can only go from keyframes to play, the following configuration needs to be added to enable exact seekTo.
it.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurateseek", 1) // set to accurate seekNote that turning on exact seekTo can cause problems with the screen not updating after seekTo when paused.
9. PhizSDK
Quick access to the Phiz SDK provides the ability to call up Phiz to get login, user information, mobile phone number and payment via the PhizClip. Integration method.
implementation 'com.finogeeks.mop:wechat:x.y.z'and add the Phiz App ID you applied for in the Phiz Open Platform to the build.gradle file of your project (e.g. app/build.gradle) at
android {
// ... Other configurations omitted
defaultConfig {
// ... Other configurations omitted
resValue "string", "phiz_sdk_app_id", "Your Phiz SDKAPPID"
}
}Note
To use the PhizSDK you must ensure that the core SDK version is 2.37.13 or above.
Note
As the PhizSDK needs to override the open-type related methods in the IAppletHandler, specifically chooseAvatar, contact, feedback, getPhoneNumber, launchApp, shareAppMessage. So if you have implemented IAppletHandler and have implemented the above six methods, PhizSDK will take over getPhoneNumber and the remaining five methods will be migrated as follows, if you have not implemented IAppletHandler or do not use the above six methods, you can ignore this.
- Implement the
IWeChatOpenTypeHandlerinterface.
class MyWeChatAppletOpenTypeHandler : IWeChatOpenTypeHandler {
override fun chooseAvatar(callback:
IAppletHandler.IAppletCallback) {
// The logic of your implementation
}
override fun contact(json: JSONObject): Boolean {
// The logic of your implementation
}
override fun feedback(bundle: Bundle): Boolean {
// The logic of your implementation
}
override fun launchApp(appParameter: String?): Boolean {
// The logic of your implementation
}
override fun shareAppMessage(
appInfo: String,
bitmap: Bitmap?
callback: IAppletHandler.
) {
// The logic of your implementation
}
}- After the core SDK has been successfully initialised, set up your implementation class. (Note that, as with the core SDK, it is important to ensure that it is set up in the main process).
WeChatOpenTypeClient.instance.iWeChatOpenTypeHandler =
MyWeChatAppletOpenTypeHandler()9.1 Overview of PhizSDK-related api
| api name | api description information |
|---|---|
| login | Raise the Phiz applet, get the login credentials and return the result to the PhizClip applet |
| getUserProfile | Raises the Phiz applet, gets the user information, and returns the results to the PhizClip applet |
| requestPayment | invokes the Phiz applet, initiates a Phiz payment, and returns the result to the PhizClip applet |
| getPhoneNumber | Raises the Phiz applet, gets the dynamic token, and returns the result to the PhizClip applet |