tencent cloud

Feedback

SDK Extension Components

Last updated: 2024-11-21 17:35:49
    A mini program's main SDK (mini_core) provides the basic runtime capabilities of the mini program. In addition to mini_core, the mini program SDK also offers the following extension components, which can be integrated to the host app as needed.

    QR code scanning extension SDK

    Component description: If your mini program uses the QR code scan capability, you need to add the following SDK to support the scanning function. If not used, it is recommended not to add it to reduce the app package size.
    Integration method: Add the QR code scanning extension library dependency as follows:
    // QR code scanning extension component
    implementation 'com.tencent.tcmpp.android:mini_extra_qrcode:${version}' // For version information, see Android SDK Updates
    After the QR code scanning extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    wx.scanCode
    Opens the client’s QR code scanning interface to scan the QR code
    Required permissions:
    Permission
    Description
    Camera
    Camera permission is required for QR code scanning
    File read/write
    File read/write permissions are required to recognize QR codes in local images

    Tencent Maps extension SDK

    Component description: Developed for apps in the Chinese mainland. If your mini program uses the map capabilities, you need to add the following SDK. If not used, it is recommended not to add it to reduce the app package size.
    Integration method: Add the map extension library dependencies as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_map:${version}'// For version information, see Android SDK Updates
    Implementation 'com.tencent.map:tencent-map-vector-SDK:4.5.10' // For version information, seeTencent Maps Documentation
    implementation 'com.tencent.map:sdk-utilities:1.0.7'
    implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.4.7'
    You need to configure the project in the Tencent Location Service console and obtain the API key required to access the Tencent Maps service. For detailed steps, see Developer Guide.
    Once you've completed the above steps, you need to configure your API key in the Android project. Add the following meta-data in the AndroidManifest.xml file, and replace (YOUR_API_KEY) with your actual API key:
    <application
    ...
    <meta-data
    android:name="TencentMapSDK"
    android:value="(YOUR_API_KEY)" />
    ...
    </application>
    After the Tencent Maps extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    Map
    Supports map-related APIs, including map display, location selection, and POI query, etc.
    Required permissions:
    Permission
    Description
    Location permission
    Required to use location services for displaying map locations

    Google Maps and Huawei Maps extension SDKs

    Component description: Developed for apps outside the Chinese mainland. If your mini app uses map capabilities, you need to add the following SDK. If not used, it is recommended not to add it to reduce the app package size.
    Integration method: Add the map extension library dependencies as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_google_map:${version}'// For version information, see Android SDK Updates
    implementation 'com.google.android.gms:play-services-maps:18.1.0' // For version information, seeGoogle Maps Documentation (public network access required)
    implementation 'com.google.maps.android:android-maps-utils:2.3.0'
    Since some Huawei devices do not support embedded Google Maps, the map may not be displayed. You can integrate Petal Map as a supplementary solution, and the mini-program framework will prioritize the use of Petal Map on Huawei devices.
    repositories {
    maven {url 'https://developer.huawei.com/repo/'}
    }
    implementation 'com.tencent.tcmpp.android:mini_extra_huawei_map:${version}'// For version information, see Android SDK Updates
    implementation 'com.huawei.hms:maps:6.9.0.300' // For version information, seeHuawei Maps Documentation
    implementation 'com.huawei.hms:maps-basic:6.9.0.300'
    implementation 'com.huawei.hms:site:6.5.1.300'
    For Google Maps, you need to configure the Google Cloud project in the Google Cloud Console and obtain the API key required to access the Google Maps service. For detailed steps, see Setting Up in Google Cloud Console and Using API Keys.
    Once you've completed the above steps, you need to configure your API key in the Android project. Add the following meta-data in the AndroidManifest.xml file, and replace (YOUR_API_KEY) with your actual API key:
    &lt;application
    ...
    &lt;meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="(YOUR_API_KEY)" />
    ...
    </application>
    For Petal Map, you need to create a project in the Huawei Maps console, activate the map and location services, and obtain the API key used to access the location service. For detailed steps, see Configuring App Information in AppGallery Connect. Then follow the guide of Integrating the HMS Core SDK to download the “agconnect-services.json” file to your project and configure the Huawei AGC plugin.
    To use Huawei's location service properly, you need to add the following meta-data to the AndroidManifest.xml file and replace (YOUR_API_KEY) with your actual key:
    &lt;application
    ...
    &lt;meta-data
    android:name="HuaweiApiKey"
    android:value="(YOUR_API_KEY)" />
    ...
    </application>
    Notes:
    For security purpose, it is recommended to request a separate API key for location services.
    After the Google Maps and Huawei Maps extension SDKs are added, the supported mini program APIs are as follows:
    API name
    Description
    Map
    Supports map-related APIs and components, including map display, location selection, and POI query, etc.
    Required permissions:
    Permission
    Description
    Location permission
    Required to use location services for displaying map locations

    Live streaming component extension SDK

    Component description: If you need to use the live streaming components (live-player and live-pusher) for developing capabilities of live streaming push and pull, you need to add the following SDKs.
    Integration method: Add the live streaming component dependencies as follows.
    // Live streaming component support library
    implementation 'com.tencent.tcmpp.android:mini_extra_trtc_live:${version}'// For version information, seeAndroid SDK Updates
    // Live streaming component library
    implementation 'com.tencent.liteav:LiteAVSDK_Professional:latest.release' // For version information, seeTencent Cloud Documentation
    In addition to adding the above dependencies, you need to override the following methods of implementing BaseMiniAppProxyImpl and provide the licenseURL and licenseKey required for the live streaming component. This is necessary to complete the initialization configuration for the live streaming component. If you do not configure the correct LicenseUrl and LicenseKey, the live streaming component will not function properly.
    Notes:
    For the method of obtaining the LicenseURL and LicenseKEY, see Adding and Renewing a License.
    @ProxyService(proxy = MiniAppProxy.class)
    public class MiniAppProxyImpl extends BaseMiniAppProxyImpl {
    @Override
    public MiniConfigData configData(Context context, int configType, JSONObject params) {
    if(configType == MiniConfigData.TYPE_LIVE) {
    // Live streaming configuration
    MiniConfigData.LiveConfig liveConfig = new MiniConfigData.LiveConfig();
    // The following key and url can only be used for demo
    liveConfig.licenseKey = "";
    liveConfig.licenseUrl = "";
    
    return new MiniConfigData
    .Builder()
    .liveConfig(liveConfig)
    .build();
    }
    
    return null;
    }
    }
    After the live streaming extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    wx.createLivePusherContext
    Creates a live streaming push context
    LivePusherContext
    Supports LivePusherContext related APIs
    wx.createLivePlayerContext
    Create a live streaming pull context
    LivePlayerContext
    Supports LivePlayerContext related APIs
    Component
    -
    live-pusher
    Push tag
    live-player
    Play tag
    Required permissions:
    Permission
    Description
    Camera
    -
    Recording
    -

    LBS extension SDK

    Component description: The LBS component provides capabilities related to location information, compass, accelerometer, positioning, and device orientation.
    Integration method: Add the LBS extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_lbs:${version}'// For version information, seeAndroid SDK Updates
    After the LBS extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    Location information
    Supports location information related APIs
    Compass
    Supports compass related APIs
    Accelerometer
    Supports accelerometer related APIs
    Device orientation
    Supports device orientation related APIs
    Gyroscope
    Supports gyroscope related APIs
    Required permissions:
    Permission
    Description
    Location permission
    Required to obtain the location

    Bluetooth extension SDK

    Component description: After the Bluetooth extension library is added, you can use Bluetooth related APIs.
    Integration method: Add the Bluetooth extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_bluetooth:${version}'// For version information, seeAndroid SDK Updates
    After the LBS extension SDK is added, the supported mini program APIs are as follows:
    API
    Description
    Bluetooth - general
    General Bluetooth API
    Bluetooth - Low-power peripheral device
    Peripheral device related APIs
    Bluetooth-Low-power center device
    Center device related APIs
    Bluetooth-beacon
    Bluetooth beacon related APIs
    Required permissions:
    Permission
    Description
    Bluetooth
    Required to operate the Bluetooth
    Location permission
    Required to search the Bluetooth device

    NFC extension SDK

    Component description: The NFC extension SDK can be added to enable NFC read/write capabilities.
    Integration method: Add the NFC extension SDK dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_nfc:${version}'// For version information, seeAndroid SDK Updates
    After the NFC extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    wx.getNFCAdapter
    Gets the NFC operation management instance object
    NFCAdapter
    Supports NFCAdapter related APIs
    NFC instances (NFCA, NFCB, NFCV, NFCF, NDEF, IsoDep, MifareUltralight, MifareClassic)
    Supports NFC tag instance related APIs
    Required permissions:
    Permission
    Description
    NFC
    Requires the NFC permission

    Biometric authentication extension SDK

    Component description: Biometric authentication extension SDK provides capabilities related to device fingerprinting and face recognition.
    Integration method: Add the biometric authentication extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_soter:${version}'// For version information, seeAndroid SDK Updates
    After he biometric authentication extension SDK is added, the supported mini program APIs are as follows:
    API
    Description
    wx.startSoterAuthentication
    -
    wx.checkIsSupportSoterAuthentication
    -
    wx.checkIsSoterEnrolledInDevice
    -
    Required permissions:
    Permission
    Description
    Fingerprint access
    Required to access fingerprint data for authentication purposes

    Clipboard extension SDK

    Component description: Provides clipboard access capability.
    Integration method: Add the extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_clipboard:${version}'// For version information, seeAndroid SDK Updates
    After the LBS extension SDK is added, the supported mini program APIs are as follows:
    API
    Description
    wx.getClipboardData
    -
    wx.setClipboardData
    -
    Required permissions:
    Permission
    Description
    Clipboard permission
    Required to access and modify clipboard data

    Address book extension SDK

    Component description: Provides contact access related capabilities.
    Integration method: Add the extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_contact:${version}'// For version information, seeAndroid SDK Updates
    After the address book extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    wx.addPhoneContact
    Adds a contact
    wx.chooseContact
    Selects a contact
    Required permissions:
    Permission
    Description
    Contacts read/write permission
    Required to access and write contacts information

    PDF extension SDK

    Component description: Provides the capability to open PDF document.
    Integration method: Add the extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_pdf:${version}'// For version information, seeAndroid SDK Updates
    After pdf extension SDK is added, the supported mini program APIs are as follows:
    API name
    Description
    wx.openDocument
    Open a pdf document

    Media extension SDK

    Component description: Provides default implementations for chooseMedia and previewMedia.
    Integration method: Add the extension library dependency as follows.
    implementation 'com.tencent.tcmpp.android:mini_extra_media_support:${version}'// For version information, seeAndroid SDK Updates
    Implement the MediaImageLoaderProxy class to enable custom image loading for the mini_extra_media_support library.
    Notes:
    You can also implement the MediaChooseJsProxy class to customize the logic for chooseMedia.
    @ProxyService(proxy = MediaImageLoaderProxy.class) public class CustomMediaImageLoaderProxy implements MediaImageLoaderProxy { private GlideImageEngine glideImageEngine = new GlideImageEngine(); @Override public ImageEngine getCustomImageEngine() { return glideImageEngine; } static class GlideImageEngine implements ImageEngine { @Override public void loadPhoto(@NonNull Context context, @NonNull Uri uri, @NonNull ImageView imageView) { Glide.with(context).load(uri).transition(withCrossFade()).into(imageView); } @Override public void loadGifAsBitmap(@NonNull Context context, @NonNull Uri gifUri, @NonNull ImageView imageView) { Glide.with(context).asBitmap().load(gifUri).into(imageView); } @Override public void loadGif(@NonNull Context context, @NonNull Uri gifUri, @NonNull ImageView imageView) { Glide.with(context).asGif().load(gifUri).transition(withCrossFade()).into(imageView);
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support