Skip to content

Commit

Permalink
fix(sdk): Remove use of android id as unique identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis committed Jul 19, 2024
1 parent 6bd7123 commit 382f32a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v4
- uses: actions/setup-java@v4
- uses: gradle/wrapper-validation-action@v3
- uses: actions/setup-java@v2
with:
java-version: 17
- uses: actions/cache@v2
Expand All @@ -23,4 +23,4 @@ jobs:
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/versions.properties') }}

- name: Run Gradle Tasks
run: ./gradlew build check publishToMavenLocal --continue
run: ./gradlew build check --continue
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class ReelevantSDK(private var context: Context, companyId: String, datasourceId
ReelevantLogger.debug("Unable to collect advertising ID from Amazon Fire OS.")
}
ReelevantLogger.debug("Unable to collect advertising ID from Amazon Fire OS and Google Play Services.")
return Secure.ANDROID_ID
return this.randomIdentifier()
}

private suspend fun getTemporaryUserId(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class SendUnitTest {

@OptIn(ExperimentalCoroutinesApi::class)
@Test
fun shouldSendEventWithAndroidIdWhenNoSharedPreferences () = runTest {
val expected = "{\"eventId\":\"1234567890123456789012345\",\"clientId\":\"UserId\",\"data\":{},\"v\":1,\"tmpId\":\"android_id\",\"name\":\"page_view\",\"key\":\"dummy-company-id\",\"url\":\"unknown\",\"timestamp\":123456789876543}"
fun shouldSendEventWithRandomIdWhenNoSharedPreferences () = runTest {
val expected = "{\"eventId\":\"1234567890123456789012345\",\"clientId\":\"UserId\",\"data\":{},\"v\":1,\"tmpId\":\"1234567890123456789012345\",\"name\":\"page_view\",\"key\":\"dummy-company-id\",\"url\":\"unknown\",\"timestamp\":123456789876543}"
val event = sdk.pageView(emptyMap())

every { sharedPreferences.getString(ReelevantAnalytics.TEMPORARY_USER_ID, null) } returns null
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# Maven settings:
VERSION_NAME=0.0.2-SNAPSHOT
VERSION_NAME=0.0.3-SNAPSHOT
GROUP=com.reelevant.analytics
ARTIFACT=analytics-android
POM_NAME=Reelevant Android Analytics
Expand Down

0 comments on commit 382f32a

Please sign in to comment.