Umeng+ Android Integration Demo

repository·master·Indexed 19 days ago

https://github.com/umeng/multifunctionandroiddemo

Official Android integration examples for Umeng+ developer products, including U-App (mobile statistics), U-Push (notifications), U-APM (crash analysis and performance monitoring), and U-Share (social sharing). This demo specifically covers integration using offline package dependencies (.aar or .jar files) and provides guidance on privacy compliance initialization, ProGuard configuration, and SDK version compatibility.

Tokens
1.1K
Snippets
4
Records
8
Agent score
15%

What's inside umeng-multifunctionandroiddemo

  1. Overview of Umeng+ Android SDK Products

    master

    The Umeng+ Android SDK Demo provides integration examples for several developer products:

    • U-App: Mobile statistics and user behavior analysis.
    • U-Push: Message push notifications and manufacturer channels.
    • U-APM: Crash analysis and application performance monitoring.
    • U-Share: Social media sharing.
    • Privacy Compliance: Examples for initializing the SDK in compliance with privacy regulations.
  2. Initialize Statistics SDK in Application.onCreate

    master
    When integrating mobile statistics, it is highly recommended to call the UMConfigure.init initialization function within the Application.onCreate method. If your application cannot guarantee this, consult the official documentation for alternative initialization strategies.
  3. Initialize Umeng SDK with privacy compliance

    master

    To comply with privacy regulations, you must not initialize the Umeng SDK until the user has consented to the privacy policy.

    1. Pre-initialization: Call UMConfigure.preInit early in the application lifecycle to prepare the SDK without accessing sensitive user data.
    2. Consent Check: Use a storage mechanism (like SharedPreferences) to track whether the user has agreed to the privacy policy (e.g., a flag uminit).
    3. Formal Initialization: Once consent is granted, call UMConfigure.UMinit to perform the full SDK initialization.
    4. Third-party Permissions: If using social features (like QQ), explicitly grant permission via Tencent.setIsPermissionGranted(true) after user consent.
    // 1. Pre-initialization (Safe to call before consent)
    UMConfigure.preInit(getApplicationContext(), "YOUR_APP_KEY", "YOUR_APP_NAME");
    
    // 2. Check for consent (Example using SharedPreferences)
    if (sharedPreferencesHelper.getSharedPreference("uminit", "").equals("1")) {
        // 3. Formal Initialization (Call after consent)
        UmInitConfig umInitConfig = new UmInitConfig();
        umInitConfig.UMinit(getApplicationContext());
        
        // 4. Grant third-party permissions
        Tencent.setIsPermissionGranted(true);
    }
  4. Verify SDK version compatibility for Statistics SDK 9.3.0

    master

    If you are using Statistics SDK v9.3.0, you must ensure that other business SDKs meet the minimum version requirements listed below. Mixing Statistics SDK 9.3.0 with older versions of Push or Share SDKs may cause unpredictable consequences such as crashes or data loss.

    Business SDKMinimum Required Version
    Push SDK>= v6.2.0
    Share SDK>= v7.1.0
    Game Statistics SDK>= v9.2.0+G
    Smart Login SDK>= v1.4.0
  5. Perform Umeng SDK pre-initialization

    master

    Use UMConfigure.preInit(Context context, String appKey, String appName) to perform a lightweight initialization of the Umeng SDK. This step is intended to be called before the user has consented to the privacy policy, as it does not trigger the collection of sensitive information.

    UMConfigure.preInit(getApplicationContext(), "59892f08310c9307b60023d0", "Umeng");