[Feat] Add HTTP header OneSignal-Install-Id #2072
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Add HTTP header
OneSignal-Install-Id
, a persistent id. Allows OneSignal's backend to know where traffic is coming from.Details
OneSignal-Install-Id
is a UUIDv4 locally generated on the device and added to as an HTTP Header to all calls made to OneSignal's backend.State for the new
installId
is encapsulated in a newInstallIdService
class, where it handles generating the id and persisting it. Tests were also added to ensure the persisting behavior works as expected.Motivation
Allows the OneSignal's backend know where traffic is coming from, no matter if the
SubscriptionId
orOneSignalId
changes or isn't available yet.Scope
OneSignal-Install-Id
HTTP header added to all network calls.Testing
Unit testing
Added
InstallIdServiceTest
to test the newInstallIdService
class.Manual testing
Tested on an Android 6 device, ensuring the new
OneSignal-Install-Id
header is sent. Restarted app to ensure the value stays the same as well.Affected code checklist
Checklist
Overview
Testing
Final pass
This change is