Open mikehardy opened 6 years ago
On Android the recommendation if you have Play Services is to use an Instance ID, but this library exists because of licensing concerns with Play Services, so the fallback recommendation is UUID.getRandom() which the code is using.
Storage should be internal file storage so it is private and is removed after the installation is removed, API here https://developer.android.com/reference/android/content/Context.html#getFilesDir()
Need to verify that setting the clientId on default request works well, since they client app may actually use Instance ID, and/or may already have an install ID (such as an ACRA id) and they could be re-used by injecting it to this library during setup - https://github.com/mikehardy/google-analytics-java/blob/master/src/main/java/com/brsanthu/googleanalytics/request/GoogleAnalyticsRequest.java#L613
Clients using ACRA (as the primary-at-the-moment client is) may use ACRA's Installation.id and inject it, getting work-a-like behavior. For others, we could let them inject a directory for config
Is there any ETA for this issue (and for v2.1.0 in general)?
Sorry, the reason I forked this was for a project that uses Acra so I haven't had a need for this but it's a simple change I think, probably easily copied from ACRA even, I'd be happy to take a PR for it. As for 2.1 I think all current changes are published at the moment?
Some further research - the standard way to do this would be to implement the Google AdvertisingId https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient
But this requires google play services, which this library avoids on purpose.
If you want to be accepted in the play store you must use advertising ID for marketing purposes if that is why you use thi slibrary: https://support.google.com/googleplay/android-developer/answer/6048248?hl=en - so you'd have to extend this library if this is for marketing - more info on requirements here: https://play.google.com/about/monetization-ads/ads/ad-id/
For pure analytics (such as my usage) the restrictions don't seem to apply. No personalization or marketing is performed with the data. So we could use anything available on the device but we also can just make something up and it is sufficient. Here is how ACRA does it: https://stackoverflow.com/a/24303639/9910298
A PR implementing a UUID.randomUUID().toString() call and persisting / retrieving that to scoped preferences file in app storage would be perfect.
This bears confirmation but it appears the clientId (a randomly generated UUID) is not persisted except in memory as a static. For android this should be persisted into application preferences, and a mechanism to clear it (re-generated) should be exposed
Interaction with #12 sampling strategy should be taken into account
This is fundamental to mobile user tracking and needs implementation before it is used large-scale