App add CNZZ Statistics Plugin tutorial Android version add phonegap_android

Source: Internet
Author: User

Keymob Mobile advertising platform is a precise and stable advertising SDK, mobile advertising platform, is committed to shaping the most influential mobile advertising platform. Main mobile advertising services, across the iOS, Android two major platforms, including banners, Shing, Full-screen, video ads, banner and other forms of advertising.
first, import jar package
users who develop with eclipse will first extract the downloaded Mobileprobe.jar into the Libs subdirectory under the local engineering directory (for example, your project directory is, D:workspacexxproject, Put Mobileprobe.jar in the D:workspacexxprojectlibs directory, and then open your project project for the app application that you developed in eclipse.
Right-click the project's root directory in Package Explorer, select Properties, and then click Java Build Path-> libraries-> Add External JARs, Select the local Mobileprobe.jar file, and finally click OK to import success.
Second, configure Androidmanifest.xml
Version requirements:
android:minsdkversion = 8: need Android 2.2 and above support.

Permission requirements:

    • Android.permission.ACCESS_NETWORK_STATE: For getting network link status, sending statistics.
    • Android.permission.ACCESS_WIFI_STATE: For getting network link status, sending statistics.
    • Android.permission.INTERNET: For network communication, send statistics.
    • Android.permission.READ_PHONE_STATE: Used to get the hardware information of the mobile phone, mainly used to differentiate users.
    • Android.permission.ACCESS_COARSE_LOCATION: Used to get rough geographic information. (optional, recommended)

Meta Data:

    • Cnzz_app_key: Please fill in the app key that you got when you registered the app.
    • CNZZ_CHANNEL_ID: You can fill in the corresponding channel name according to the different distribution channels of app for the data released by the back-end statistic channel. (If you use the Packaging tool to automatically package, do not fill in the channel name).

Code:

 <manifest ...> <uses-sdk android:minsdkversion= "8" android:targetsdkversion= " 8 "/> <uses-permission android:name=" Android.permission.GET_TASKS "/> <uses-permission" Android.permission.INTERNET "></uses-permission> <uses-permission android:name=" Android.permission.READ_PHONE_STATE "></uses-permission> <uses-permission android:name=" Android.permission.ACCESS_NETWORK_STATE "></uses-permission> <uses-permission android:name=" Android.permission.ACCESS_WIFI_STATE "></uses-permission> <application ...> <activity .../> < Meta-data android:value= "cnzz.a_6bf43dcde8e085951522422e" android:name= "Cnzz_app_key" ></meta-data> < Meta-data android:value= "Cnzz" android:name= "cnzz_channel_id" ></meta-data> </application> </ Manifest> 

1). Data collection and burying point
introduce the data acquisition package in the code.
Import Com.cnzz.mobile.android.SDK.MobileProbe;
2). Basic Statistics
Simply call the corresponding collection function in the OnCreate method in the entry activity class of the program, and the other activity does not require any burial points:
Mobileprobe. Startstatistic (activity activity, string Appkey, String channel)
Parameters: Current Activity references, application Appkey, application channels.
Sample code:

public class Demoactivity extends activity{public
void Create (Bundle savedinstancestate) {
super.oncreate ( Savedinstancestate);
Mobileprobe.startstatistic (This, "cnzz.a_099b46617ca2180c7d741936", "Cnzz");
Setcontentview (R.layout.main);
}

3). PhoneGap can be added below:

public void OnCreate (Bundle savedinstancestate) { 
super.oncreate (savedinstancestate); 
Mobileprobe.startstatistic (This, "CNZZ.A_QWV6WE0TNLQKEU2QZP2WCHRB", "Niulanapp"); 
Super.setintegerproperty ("SplashScreen", r.drawable.load); 
Super.loadurl ("file:///android_asset/www/index.html", 3000); 
  }

Third, testing
1. Whether the jar package is imported correctly
2. Whether the correct permissions are added to the androidmanifest.xml:access_network_state, Access_wifi_state, INTERNET, Read_phone_state, get _tasks.
3. Whether to call the startstatistic buried point function in the OnCreate function of the main activity class
4, whether in the buried function correctly filled in the Appkey
5, confirm the Android simulator (or test mobile phone) network status
6, start the application, do some more attempt to operate (Switch page, open shutdown application)

Keymob Mobile advertising platform is a precise and stable advertising SDK, mobile advertising platform, is committed to shaping the most influential mobile advertising platform. Main mobile advertising services, across the iOS, Android two major platforms, including banners, Shing, Full-screen, video ads, banner and other forms of advertising.

The above is the entire content of this article, I hope to help you learn, to help you quickly install.

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.