-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: offline support #171
Conversation
Save events on offline and send out when back to online automatically
core/src/main/java/com/amplitude/core/platform/plugins/AmplitudeDestination.kt
Outdated
Show resolved
Hide resolved
core/src/main/java/com/amplitude/core/platform/plugins/AmplitudeDestination.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/utilities/AndroidNetworkConnectivityChecker.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/utilities/AndroidNetworkListener.kt
Show resolved
Hide resolved
android/src/test/java/com/amplitude/android/plugins/AndroidLifecyclePluginTest.kt
Outdated
Show resolved
Hide resolved
core/src/main/java/com/amplitude/core/platform/plugins/AmplitudeDestination.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/plugins/AndroidNetworkConnectivityCheckerPlugin.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move network listener from Amplitude to the network connectivity plugin. So that customers can remove the plugin and have their own offline implementation.
android/src/main/java/com/amplitude/android/plugins/AndroidNetworkConnectivityCheckerPlugin.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/plugins/AndroidNetworkConnectivityCheckerPlugin.kt
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/utilities/AndroidNetworkConnectivityChecker.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/plugins/AndroidNetworkConnectivityCheckerPlugin.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/utilities/AndroidNetworkConnectivityChecker.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check how to remove a plugin.
Plugins are removed by reference. So come up with another way to disable the default plugin by setting config.offline
to null.
samples/java-android-app/src/main/java/com/amplitude/android/sample/MainApplication.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/amplitude/android/plugins/AndroidNetworkConnectivityCheckerPlugin.kt
Outdated
Show resolved
Hide resolved
...d/src/test/java/com/amplitude/android/plugins/AndroidNetworkConnectivityCheckerPluginTest.kt
Show resolved
Hide resolved
samples/java-android-app/src/main/java/com/amplitude/android/sample/MainApplication.java
Outdated
Show resolved
Hide resolved
samples/java-android-app/src/main/java/com/amplitude/android/sample/MainApplication.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Justin Fiedler <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Mercy811 !
# [1.13.0](v1.12.2...v1.13.0) (2024-01-24) ### Features * offline support ([#171](#171)) ([669eead](669eead))
🎉 This PR is included in version 1.13.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Summary
Requirements
ACCESS_NETWORK_STATE
permission is required. If not, this feature will not supported and will fallback to previous behavior (causing an error)User interfaces
This feature is enabled by default.
To opt out of using
AndroidNetworkConnectivityPlugin
and implement custom offline logic, settingconfig.offline
tonull
will prevent plugin setup.Implementation
config.offline
accordinglyChecklist