If you update Push SDK to V4.4.2 or later, you must use a license for authorization. This topic describes how to obtain and integrate a Push SDK license.
Usage notes
- A license is not required for Push SDK of a version that is earlier than V.4.4.2. For Push SDK V.4.4.2 and later, you must use a license for authorization before you can ingest streams.
- You can use an all-in-one license to authorize all applications within the same Alibaba Cloud account to access video cloud SDKs. From Push SDK V4.4.2, an all-in-one license is used.
- When you request a license for Push SDK and a license for another video cloud SDK such as Queen SDK at the same time, the same license key and license file are used for both SDKs. You need to configure LicenseKey and LicenseFile only once. The latest version of the license file must be used. Note
If you requested and obtained an all-in-one license for a video cloud SDK other than Push SDK, such as Queen SDK, you can submit a request that includes the information about the application with which you want to integrate Push SDK on the Create Application and Bind License page to renew the authorization scope of the license. If you do not perform the preceding operation, license verification fails.
Only the authorization scope of the license is changed. The license key and license file remain the same. Therefore, you do not need to reconfigure the license. However, you must register Push SDK before you use the stream ingest feature.
Request a license
To request a Push SDK license, submit the required information on the Request Push SDK License page. After your request is received, Alibaba Cloud handles the request within two business days.
- The Push SDK license is free of charge. The validity period of the license is one year. You must request a new license after your license expires.
- Make sure that the request information is complete and in the valid format. If you need to change the package name, signature, or bundle ID, submit a request again.
- If you do not have an Alibaba Cloud account, create one first. For more information, see Create an Alibaba Cloud account.
- Information about the package name and MD5 signature of an Android application:
- The MD5 signature is a string of lowercase letters. Do not include colons (:) in the string.
- You can obtain the package name and signature by using one of the following methods:
Method 1: Use the signature tool to obtain the package name and signature. After you install the tool, follow the instructions of the tool.
Method 2: Download the source code of the demo of Push SDK for Android V4.4.2 or later from SDK download and release notes. Then, call the getSingInfo method of the SignatureUtils utility class to generate a signature.
Configure a license
After you request a license, the license key and license file are sent to you by email. Perform the following steps to configure the Push SDK license.
Configure a license for Android
- Copy the obtained license file to the assets directory.
- Configure LicenseKey and LicenseFile in the
AndroidManifest.xml
file. For example, replace Your licenseKey and Your licenseFile.crt in the file with the values that you obtained.<application> <! -- android:name: the name of the metadata item. The value is fixed. --> <! -- android:value: the specified value of the metadata item. Enter the license key obtained from your email. --> <meta-data android:name="com.aliyun.alivc_license.licensekey" android:value="Your licenseKey" /> <! -- android:name: the name of the metadata item. The value is fixed. --> <! -- android:value: the specified value of the metadata item. Enter the assets path in which the license file obtained from your email is stored. --> <meta-data android:name="com.aliyun.alivc_license.licensefile" android:value="assets/Your licenseFile.crt" /> </application>
Important If the license fails to be verified after you configure the license, check whether <meta-data> is placed under <application> and whether the name of the metadata item is correct.
Configure a license for iOS
- Import the obtained license file to the application project.
- Add the following keys to the Info.plist file:
- AlivcLicenseKey
- AlivcLicenseFile
key value AlivcLicenseKey The value of LicenseKey. Example: MoCTfuQ391Z01mNqG8f8745e23c8a457a8ff8d5faedc1****
.AlivcLicenseFile The path in which the license file is stored.
Register Push SDK
Before you can use the stream ingest feature, you must register Push SDK. You must configure the Push SDK license before you register Push SDK.
Register Push SDK for Android
AlivcLiveBase.setListener(new AlivcLiveBaseListener() {
@Override
public void onLicenceCheck(AlivcLivePushConstants.AlivcLiveLicenseCheckResultCode result, String reason) {
Log.e(TAG, "onLicenceCheck: " + result + ", " + reason);
}
});
AlivcLiveBase.registerSDK();
You can call the AlivcLiveBase class to perform operations such as setting the log level and local log path and obtaining the SDK version.
You must call the registerSDK method in AlivcLiveBase to register an SDK license. You must also listen to the onLicenceCheck callback in AlivcLiveBaseListener to asynchronously receive the license verification result. This allows you to determine whether the license key and license file that you provide pass the verification.
Register Push SDK for iOS
[AlivcLiveBase registerSDK];
You can call the AlivcLiveBase class to perform operations such as setting the log level and local log path and obtaining the SDK version.
You must listen to the onLicenceCheck callback in AlivcLiveBaseObserver to determine whether the license key and license file that you provide pass the verification.