Android Application Automation channel packaging process Analysis

Source: Internet
Author: User

Android apps are generally uploaded to the market after development. The release of the time to face a variety of markets, we call the channel. Now that we are uploading the market, we may need some data analysis for each market: for example, which market users download a larger number? Sometimes we also need to know which channel the app was downloaded from. For example, we may have some profit needs and specific channels to divide. These are statistical channels of information.


How do I add channel information to an app?

In order to statistic the channel information, we have to add the channel information somewhere in the program, and then play different packages for different channels. You can typically include channel numbers in the manifest file instead of directly in your code. The advantage of this is that you can automate to modify the channel number in the manifest file for different channels, and then automatically package it for that channel.

The manifest file supports meta data tags and is recommended for use with this custom label. For example, the following file fragment.

<?xml version= "1.0″encoding=" utf-8″?>

<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"

Android:versioncode= "X"

Android:versionname= "x.x.x"

Package= "Com.xxx" >

......

<application android:icon= "@drawable/icon"

Android:label= "@string/app_name" >

......

<meta-data android:name= "CHANNEL" android:value= "c_001″/>

</application>

</manifest>

In this code example, we add a meta-data tag under the application node, the name is channel, and the value is c_001, which is the number of a channel we specify.

For different channels of packaging, you have to manually or automatically modify c_001 to become c_002, c_003 and so on other we define the channel number, and then hit a different package.


How does the program read the packaged channel number?

In the program code, you can read the Meta-data defined in the manifest file. The following is a code instance.

public static String Getchannelcode (context context) {

String Code = GetMetaData (Context, "CHANNEL");

if (code! = null) {

return code;

}

Return "C_000″;

}

private static string GetMetaData (context context, string key) {

try {

ApplicationInfo ai = Context.getpackagemanager (). Getapplicationinfo (

Context.getpackagename (), packagemanager.get_meta_data);

Object value = Ai.metaData.get (key);

if (value = null) {

return value.tostring ();

}

} catch (Exception e) {

//

}

return null;

}

How do I automate the packaging process?

Here are two tools: Ant, love encrypted channel monitoring.

With ant packaging, there are two points to note: One is to support the for loop in ant to automate multiple packaging actions, and one is how to modify the manifest file in ant to support different markets.

1. Ant

There is no related for loop task in Ant's Core package to download the appropriate expansion pack. You can use the Open source Ant-contrib package.

: http://ant-contrib.sourceforge.net/

After the download is complete, copy the Lib package from the Ant-contrib to the installed ant library Apache-ant-xxx\lib below and you can use it.

For specific use, refer to the official website of Ant-contrib.

2. Love Encryption Channel Monitoring

Use Address: Http://www.ijiami.cn/Channels

Can be one-click Multi-channel package, accurate access to 600 of domestic and foreign app promotion channel information, including the application store, download station, forum and so on. One-stop monitoring of all app-related channels, including: version, channel, download source, download volume, etc. Convenient and quick to assist developers to manage the application in the major channels of the launch and promotion operations.

specific use of the process see http://www.ijiami.cn/ Love encryption official website.

Android Application Automation channel packaging process Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.