Delaying App Measurement not working as expected

2,238 views
Skip to first unread message

Liam

unread,
Mar 19, 2020, 7:25:03 AM3/19/20
to google-adm...@googlegroups.com
Hi,

I've been tasked with resolving an issue raised by our compliance team. Despite using DELAY_APP_MEASUREMENT_INIT in our manifest:

<meta-data
           
android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT"
           
android:value="true"/>

We still see the app contacting: app-measurement.com/172.217.20.142 pre our age gate and consent flow. 
The issue only occurs once on first boot of the app after install. Each boot there after doesn't contact that endpoint.

Here are the logs(I've hidden ids etc.) :

03-18 19:13:49.057 23858-23858/? V/FA: Registered activity lifecycle callback

03-18 19:13:49.147 23858-23905/? V/FA: Collection enabled

   App package, google app id: com.****.************, *:***********:android:************

03-18 19:13:49.147 23858-23905/? I/FA: App measurement is starting up, version: 16250

   To enable debug logging run: adb shell setprop log.tag.FA VERBOSE

   To enable faster debug mode event logging run:

     adb shell setprop debug.firebase.analytics.app com.****.*************

03-18 19:13:49.147 23858-23905/? D/FA: Debug-level message logging enabled

03-18 19:13:49.147 23858-23905/? V/FA: Persisting first open: ******************

03-18 19:13:49.157 23858-23905/? V/FA: Updating deferred analytics collection: false

03-18 19:13:49.232 23858-23905/? V/FA: Checking service availability

   Service available

   Setting useService: true

03-18 19:13:49.237 23858-23905/? V/FA: Connecting to remote service

03-18 19:13:49.282 23858-23905/? V/FA: Connection attempt already in progress

03-18 19:13:49.307 23858-23905/? I/FA: Tag Manager is not found and thus will not be used

03-18 19:13:49.312 23858-23905/? D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=ActivityGame, firebase_screen_id(_si)=-*********************}]

03-18 19:13:49.382 23858-23905/? V/FA: Connection attempt already in progress

   Connection attempt already in progress

03-18 19:13:49.392 23858-23905/? V/FA: Activity resumed, time: 1940048094

03-18 19:13:49.402 23858-23905/? V/FA: Session started, time: 1940048400

03-18 19:13:49.427 23858-23905/? D/FA: Setting user property (FE): _sid, *******************

03-18 19:13:49.467 23858-23905/? V/FA: Connection attempt already in progress

03-18 19:13:49.487 23858-23905/? D/FA: Logging event (FE): session_start(_s), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=ActivityGame, firebase_screen_id(_si)=-*******************, session_id(_sid)=********************}]

03-18 19:13:49.592 23858-23905/? V/FA: Connection attempt already in progress

03-18 19:13:49.627 23858-23905/? D/FA: Connected to remote service

03-18 19:13:49.632 23858-23905/? V/FA: Processing queued up service tasks: 6

03-18 19:13:54.997 23858-23905/? V/FA: Inactivity, disconnecting from the service


The only way I could stop it was by disabling the service and receiver in the manifest:

        <service android:name="com.google.android.gms.measurement.AppMeasurementService"
            android:enabled="false"
            android:exported="false" tools:replace="android:enabled"/>

        <receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
            android:enabled="false" tools:replace="android:enabled">
            <intent-filter>
                <action android:name="com.google.android.gms.measurement.UPLOAD" />
                <action android:name="com.android.vending.INSTALL_REFERRER"/>
            </intent-filter>
        </receiver>


Which produces the following log:
03-18 23:35:24.547 3055-3153/? I/FA: Collection disabled with firebase_analytics_collection_enabled=0
03-18 23:35:24.547 3055-3153/? I/FA: App measurement is starting up, version: 13001
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
    To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.sec.android.app.samsungapps
03-18 23:35:24.547 3055-3153/? D/FA: Debug-level message logging enabled
03-18 23:35:24.582 3055-3153/? V/FA: Connecting to remote service
03-18 23:35:24.617 3055-3153/? V/FA: Connection attempt already in progress
03-18 23:35:24.617 3055-3153/? D/FA: Setting app measurement enabled (FE): true
03-18 23:35:24.617 3055-3153/? V/FA: Setting measurementEnabled: true
03-18 23:35:24.622 3055-3153/? D/FA: Updating Scion state (FE)
03-18 23:35:24.632 3055-3153/? V/FA: Connection attempt already in progress
03-18 23:35:24.637 3055-3153/? D/FA: Connected to remote service
03-18 23:35:24.642 3055-3153/? V/FA: Processing queued up service tasks: 3
03-18 23:36:23.462 4223-4223/? V/FA: Registered activity lifecycle callback
03-18 23:36:23.852 4223-4367/? V/FA: Collection enabled
    App package, google app id: com.****.********, *:***********:android:************
03-18 23:36:23.852 4223-4367/? I/FA: App measurement is starting up, version: 16250
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
    To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.*******.***********
03-18 23:36:23.852 4223-4367/? D/FA: Debug-level message logging enabled
03-18 23:36:23.852 4223-4367/? V/FA: Persisting first open: ************
03-18 23:36:23.857 4299-4299/? V/FA: Registered activity lifecycle callback
03-18 23:36:23.892 4223-4367/? E/FA: AppMeasurementReceiver not registered/enabled
03-18 23:36:23.912 4223-4367/? E/FA: AppMeasurementService not registered/enabled
    Uploading is not possible. App measurement disabled


I also tried adding as you can see from the logs above:
        <meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />


But we only use firebase on one flavour and see this issue on all of them.

Other info - Here is the log I see on app install:

03-18 19:10:41.482 23737-23737/? V/FA: Registered activity lifecycle callback

03-18 19:10:41.567 23737-23798/? I/FA: Collection disabled with firebase_analytics_collection_enabled=0

03-18 19:10:41.567 23737-23798/? I/FA: App measurement is starting up, version: 13001

    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE

    To enable faster debug mode event logging run:

      adb shell setprop debug.firebase.analytics.app com.sec.android.app.samsungapps

03-18 19:10:41.567 23737-23798/? D/FA: Debug-level message logging enabled

03-18 19:10:41.592 23737-23798/? V/FA: Connecting to remote service

03-18 19:10:41.612 23737-23798/? V/FA: Connection attempt already in progress

03-18 19:10:41.612 23737-23798/? D/FA: Setting app measurement enabled (FE): true

03-18 19:10:41.612 23737-23798/? V/FA: Setting measurementEnabled: true

03-18 19:10:41.612 23737-23798/? D/FA: Updating Scion state (FE)

03-18 19:10:41.622 23737-23798/? V/FA: Connection attempt already in progress

03-18 19:10:41.622 23737-23798/? D/FA: Connected to remote service

03-18 19:10:41.622 23737-23798/? V/FA: Processing queued up service tasks: 3

03-18 19:10:46.677 23737-23798/? V/FA: Inactivity, disconnecting from the service




So to summarise my questions are:
Look forward to your response,
Liam

  • Google Play services SDK version you're integrating with( com.google.gms:google-services:4.0.1)
  • Version of the Google Play services apk installed on your device( 20.06.16 )
  • model and OS version of the device that exhibits the issue (Samsung Galaxy Tab 2, SM-T710, Android Version 5.0.2)
  • Your SDK integration code, if relevant( com.google.android.gms:play-services-ads:18.2.0)

Mobile Ads SDK Forum Advisor Prod

unread,
Mar 19, 2020, 3:21:14 PM3/19/20
to liam...@gmail.com, google-adm...@googlegroups.com
Hi Liam,

Thank you for reaching out to us. To simplify your consent issue could you try adding privacy compliance to one of our
sample apps to see if this occurs on a clean build?

Regards,
Aryeh Baker
Mobile SDK Team


ref:_00D1U1174p._5001UXVW4C:ref

Liam

unread,
Mar 19, 2020, 3:50:35 PM3/19/20
to Google Mobile Ads SDK Developers
Yes I can certainly try build a sample app and add privacy compliance. Any particular sample and version you would like me to try or add.

Just wanted to add after another day investigating, enabling FA-SVC logging revealed the events being sent were: first_open, user_engagement, screen_view and session_start.

I've only just now had success in stopping the events by including this in the manifest:
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
The log now states:
03-19 19:34:24.132 13154-13338/? I/FA: Collection disabled with firebase_analytics_collection_deactivated=1
    App measurement is starting up, version: 16250
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
    To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.****.***********
03-19 19:34:24.132 13154-13338/? D/FA: Debug-level message logging enabled
03-19 19:34:24.132 13154-13338/? V/FA: Persisting first open: ************
03-19 19:34:24.227 13154-13338/? V/FA: Checking service availability
    Service available
    Setting useService: true
03-19 19:34:24.232 13154-13338/? V/FA: Connecting to remote service
03-19 19:34:24.257 13154-13338/? D/FA: Event not sent since app measurement is disabled

I confirmed this didn't send anything using my external packet sniffer.

But I want to be able to re-enable it. My understanding from documentation I read here https://firebase.google.com/docs/analytics/configure-data-collection?platform=android#temporarily_disable_collection was I need to use:

<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
And then call:
setAnalyticsCollectionEnabled(true);

Hopefully this helps and you can shed some light on things for me.

In the mean time, I'll try build a reproduction project.

Thanks,

Liam

Mobile Ads SDK Forum Advisor Prod

unread,
Mar 19, 2020, 5:11:13 PM3/19/20
to liam...@gmail.com, google-adm...@googlegroups.com
Hi Liam,

Thanks for sharing the other details. We are looking into the issue and meanwhile, can you please try with our sample apps and let us know if you are seeing the same issue? 

Regards,
Aryeh Baker
Mobile Ads SDK Team 

ref:_00D1U1174p._5001UXVW4C:ref

Liam

unread,
Mar 24, 2020, 6:32:13 AM3/24/20
to Google Mobile Ads SDK Developers
Hi,

Just to update, despite previous attempts of adding:

<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />

This now appears to have started working.

So to summarise the current issue:

com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT doesn't appear to work on its own and requires firebase_analytics_collection_enabled to be set to false to truly disable anything being sent from the client.

I was unable to reproduce with the sample apps I tried, however that is unsurprising as we include multiple different Ad SDKs along with other SDKs for our app.

The difficulty in resolving the issue was also exacerbated by the move from the measurement api to the firebaseAnalytics api, I couldn't find docs relating to disabling this when not using Firebase Analytics.
Our SDKs haven't made the switch yet.


I actually have to call:

import com.google.android.gms.measurement.AppMeasurement;

AppMeasurement appMeasurement = AppMeasurement.getInstance(s_activity.getApplicationContext());
appMeasurement.setMeasurementEnabled(true);

Which is of course using the deprecated API.

I hope all this information helps someone. I'll leave it with you to decide if the behaviour I'm seeing is expected or not.

Regards,

Liam

Mobile Ads SDK Forum Advisor Prod

unread,
Mar 24, 2020, 9:22:01 AM3/24/20
to liam...@gmail.com, google-adm...@googlegroups.com

Hi Liam,

 

Thank you for getting back to us with your efforts to clarify how to stop information sharing. If someone has a similar setup and issue such as yours they will be helped by your efforts.

Reply all
Reply to author
Forward
0 new messages