TelemetryDeck / FlutterSDK

Flutter SDK for TelemetryDeck, a privacy-conscious analytics service for apps and websites.
https://telemetrydeck.com/
MIT License
3 stars 2 forks source link

All Android signals are always send with "testMode=true" while iOS works fine #6

Closed novas1r1 closed 6 months ago

novas1r1 commented 7 months ago

Hey, I just discovered all my Android signals from my app were put in my "in testing" dashboard, while all iOS signals are correctly displayed in the production board.

iOS: image

Android: image

Any idea why? My implementation looks as follows for both - Android and iOS:

Telemetrydecksdk.start(
      TelemetryManagerConfiguration(
        appID: Config.TELEMETRYDECK_APP_ID,
        testMode: flavor == AppFlavor.dev,
        debug: kDebugMode,
      ),
);

The correct value for testMode is definitely set when sending, I double checked this.

kkostov commented 7 months ago

@novas1r1 I noticed your comment and I tried to reproduce the faulty behaviour but so far without success.

Just to double check - the issue is that using the following setup results in signals being set as test mode?

Telemetrydecksdk.start(
      TelemetryManagerConfiguration(
        appID: Config.TELEMETRYDECK_APP_ID,
        testMode: false
      ),
);

The behaviour of the library is expected to be as follows:

In other words, the following will be in test mode for builds where debugging is allowed, but not in test mode for production builds:

Telemetrydecksdk.start(
      TelemetryManagerConfiguration(
        appID: Config.TELEMETRYDECK_APP_ID
      ),
);

Would it be possible to check if the android release is not configured as "debuggable"? There are several ways this may have been done, e.g., by adding <application android:debuggable="true" to the Android manifest or by adding debuggable true to the BuildType configuration in gradle.

novas1r1 commented 6 months ago

Hey @kkostov, sorry for the late response.

So in my app I tried this:

Telemetrydecksdk.start(
  const TelemetryManagerConfiguration(
    appID: Config.TELEMETRYDECK_APP_ID,
   ),
);

and this:

Telemetrydecksdk.start(
  const TelemetryManagerConfiguration(
    appID: Config.TELEMETRYDECK_APP_ID,
    debug: false,
    testMode: false,
   ),
);

and this:

Telemetrydecksdk.start(
  const TelemetryManagerConfiguration(
    appID: Config.TELEMETRYDECK_APP_ID,
    debug: kDebugMode,
   ),
);

On iOS - everything fine: image

Android is broken, all signals (not sure, if its all signals, it would have been only 3 users the past 2 weeks, which is definitely not the case as I can see from registrations in Firebase) end up in the test mode. image

Not sure what else I can try here? I searched for debuggable flags, but couldn't find any. For the release versions I definitely use the --release flag to build the app.

I will try with another project as well.

novas1r1 commented 6 months ago

I just checked it for my other app. And I have the same issue there. IOs seems fine: image

Android ends up in test mode: image

Same implementation like above, using the old telemetry version 0.0.5. Above I used my PR and thought I broke something, but seems not to be related.

kkostov commented 6 months ago

Thanks @novas1r1 , that looks strange indeed. I will do some more testing and try to narrow it down.

kkostov commented 6 months ago

@winsmith I confirmed that the Android SDK is respecting the current mode when setting the isTestMode field. However, the following signals seem to be interpreted as test mode by the server, can you see why that could be?

[
  {
    "receivedAt": "2024-05-07T11:32:24.401Z",
    "appID": "22385f1c-3699-4f04-9d63-24cc0b2e62d8",
    "clientUser": "04f8996da763b7a969b1028ee3007569eaf3a635486ddab211d512c85b9df8fb",
    "sessionID": "5db7d8f1-6307-4d8c-97e5-1c58251e30e7",
    "type": "not_a_test",
    "payload": [
      "dartVersion:3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on 'android_arm'",
      "telemetryClientVersion:Flutter 0.3.0",
      "appVersion:1.0",
      "systemVersion:Android SDK: 30 (11)",
      "majorSystemVersion:11",
      "majorMinorSystemVersion:11.0",
      "locale:English (United Kingdom)",
      "brand:samsung",
      "targetEnvironment:gta3xlwifi",
      "modelName:SM-T510 (gta3xlwifieea)",
      "architecture:armv8l",
      "operatingSystem:Android"
    ],
    "isTestMode": false
  },
  {
    "receivedAt": "2024-05-07T11:32:24.401Z",
    "appID": "22385f1c-3699-4f04-9d63-24cc0b2e62d8",
    "clientUser": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "sessionID": "5db7d8f1-6307-4d8c-97e5-1c58251e30e7",
    "type": "not_a_test",
    "payload": [
      "dartVersion:3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on 'android_arm'",
      "telemetryClientVersion:Flutter 0.3.0",
      "appVersion:1.0",
      "systemVersion:Android SDK: 30 (11)",
      "majorSystemVersion:11",
      "majorMinorSystemVersion:11.0",
      "locale:English (United Kingdom)",
      "brand:samsung",
      "targetEnvironment:gta3xlwifi",
      "modelName:SM-T510 (gta3xlwifieea)",
      "architecture:armv8l",
      "operatingSystem:Android"
    ],
    "isTestMode": false
  }
]
winsmith commented 6 months ago

Will do, but it'll be tomorrow. Thanks!

winsmith commented 6 months ago

Oh wait I see it:

'isTestMode' needs to be a string, either "true" or "false".

A remnant of the old days when our db didn't support any other types

kkostov commented 6 months ago

@novas1r1 version 0.4.0 should help address this!

novas1r1 commented 6 months ago

Thanks a lot @kkostov - will check on friday and provide feedback :)