The APK dynamic packaging plugin recognizes certain parameters in request URLs of end users and dynamically writes the information carried in such parameters to the APK on a CDN node for dynamic packaging.
Note:
Currently, only nodes in the Chinese mainland support the APK dynamic packaging feature.
Currently, only Tencent Cloud COS is supported as the origin for APK dynamic packaging.
Applicable Scenario
You need to release and promote an app through various channels, such as app market, ad alliance, search engine, and performance-based ad, but don't want to manually maintain an overwhelming number of channel packages.
You want to implement hot app startup; that is, you can dynamically insert a link into the APK, so that end users will be automatically redirected to the specified page when they open the app for the first time.
Process Flow
1. Log in to the CDN console and complete the relevant configuration of the APK dynamic packaging plugin feature in the plugin center.
2. Upload the original APK to the specified upload directory on the COS origin.
3. Wait for the CDN node to process the parent package.
4. An end user initiates a request with certain parameters.
5. The CDN edge returns the APK file after dynamic packaging.
Configuration Guide
Step 1. Add a dynamic packaging configuration
1. Log in to the CDN console, select Plugin Center in the menu bar, and click the switch button on the APK dynamic packaging plugin feature card to enable APK dynamic packaging and enter the configuration page.
2. After the feature is activated, you can enter the configuration list and usage view pages through Basic configurations and Usage Statistics at the bottom of the card.
3. On the Basic Configuration page, click Adding a configuration to complete the configuration of the APK packaging task.
Bucket selection: Choose COS as the origin server. This feature requires using COS in Beijing, Shanghai, Guangzhou, or Chengdu as the origin server.
Domain Name: The system will automatically select all domain names using the specified COS bucket as the origin. The domain names are used to release the APK, and you can add or remove domain names as needed.
Upload Directory: Set the upload directory for the original APK in COS. Manually upload the original APK to this directory after completing the configuration.
Output directory: Set the output directory after the CDN node processes the master package. After uploading the original APK, the system will automatically process, generate a master package with the same name, and upload it to this directory. When constructing the request URL, please point the user request to this directory, not the upload directory.
Signature Method: Currently, you can dynamically package an APK with Android APK Signature Scheme v1 or v2. A v2 signature supports open-source multi-channel packaging solutions such as Walle and VasDolly. In addition, you can also write a comment to the specified custom block ID.
Rename Parameter: The rename parameter allows users to generate a new file name based on parameters when downloading files. If not configured, the downloaded file name will be the same as the master package file name.
Channel Parameter: Fixed at comment and cannot be modified.
SCF configuration: After authorization, the system will automatically generate the SCF based on the configuration.
Note
Do not delete this SCF in the SCF console!
Step 2. Upload the original APK
Log in to the COS console and upload the original APK to the specified upload directory.
Note:
The original APK can be up to 10 GB in size.
Step 3. Wait for the parent package to be processed
Return to the dynamic packaging feature page in the CDN console, click mother package status to check if the processing progress of the mother package on the CDN node is "processing completed".
If failed processing, you can check the specific reason for the failure.
Step 4. Release the dynamic packaging URL
After the parent package is processed, you can release the dynamic packaging URL as follows:
If the task information is as follows:
The corresponding published URL is: https://www.example.com/ext/test2_edge_pack.apk?comment=pipeline.
An end user can request this URL to get the APK package containing the pipeline channel information from the CDN edge.
If the rename parameter is configured, the URL can be: https://www.example.com/ext/test2_edge_pack.apk?comment=pipeline&filename=newfilename, which means the file name will be displayed as "newfilename" after the user requests the download.
1. After uploading the mother package, you find that the channel information is not packaged through the src directory download?
src is the upload directory. The mother package is processed through scf and finally output to the ext directory. You need to access the ext directory for automatic packaging.
2. walle format, comment=123456, walle-cli query error, indicating incorrect json format?
walle's channel information format requires json format and urlencode. The backend will urldecode the comment information and directly write it into the corresponding blockid-value, so the comment content should be urlencode(json). For example: if the channel information is 123456, the walle value is {"channel":"123456"}, comment=%7B%22channel%22%3A%22123456%22%7D.
3. The Android client extracts the channel name with %00, %00, etc.?
%00, %00, etc. are placeholders reserved for edge packaging. There are two resolutions.
Resolution one: You can handle it yourself by deleting the whitespace characters after the channel information.
Resolution two: If using the V2-vasdolly signing method, you can upgrade the vasdolly sdk version to 3.0.6 to automatically remove the reserved placeholders.