Skip to content

Adjust + Amplitude broken on Android #101

@vishna

Description

@vishna

Expected Behavior

[adjust] Install is displayed on Android & iOS

Current Behavior

[adjust] Install is only displayed on iOS

Possible Solution

The root of the problem is Android Amplitude SDK, logs show:

W/com.amplitude.api.DeviceInfo( 3416): Google Play Services not available for advertising id
W/com.amplitude.api.DeviceInfo( 3416): Google Play Services SDK not found for app set id!

Seems like class com.google.android.gms.ads.identifier.AdvertisingIdClient is not getting found in DeviceInfo.java

Followed all the instructions regarding the gradle/proguard setup.

Someone suggested a fix (not using reflection), but afaik it got dismissed dantetam/Amplitude-Android@39c70ab due to "we would have to change our tests" 🤷‍♀️

Now Adjust SDK seems to find and assign advertising id on Android just fine. My fix introduces option to set custom advertising id, this involves changes in both Android and Flutter repos:

Then I can simply use it at initialisation time and supply valid advertising id:

final amplitude = Amplitude.getInstance();
final adId = await Adjust.getGoogleAdId();
await amplitude.setCustomAdvertisingId(advertisingId);

This fixed problem we saw in our amplitude dashboard.

Steps to Reproduce

  1. Integrate Flutter Amplitude SDK
  2. Integrate Flutter Adjust SDK
  3. Publish your apps
  4. Observe Adjust install events are reported on iOS while not reported on Android

Environment

  • SDK Version: 3.8.1
  • Flutter Version: 2.10 stable
  • Device: any Android
  • Device OS and Version: any Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions