aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 549 forks source link

Create `TransferNetworkLossHandler` substitution that would not use `ConnectivityManager.CONNECTIVITY_ACTION` #2489

Closed dariuszseweryn closed 1 year ago

dariuszseweryn commented 3 years ago

Which AWS Services is the feature request for? aws-android-sdk-s3

Is your feature request related to a problem? Please describe. As of version 2.23.0 TransferNetworkLossHandler is expecting ConnectivityManager.CONNECTIVITY_ACTION intent which is deprecated since API 28

Describe the solution you'd like An alternative to TransferNetworkLossHandler that would be easy to integrate with an Android application and would not use deprecated functionalities.

Describe alternatives you've considered Android source suggests these approaches:

 * @deprecated apps should use the more versatile {@link #requestNetwork},
 *             {@link #registerNetworkCallback} or {@link #registerDefaultNetworkCallback}
 *             functions instead for faster and more detailed updates about the network
 *             changes they care about.

Additional context I have not seen any issue that would track this case. Feel free to close if this is a duplicate.

val transferNetworkLossHandler = TransferNetworkLossHandler.getInstance(context)
val connectivityActionIntentFilter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)
context.registerReceiver(transferNetworkLossHandler, connectivityActionIntentFilter)
Zrzut ekranu 2021-05-25 o 19 31 15
sdhuka commented 1 year ago

We recommend upgrading to Amplify 2.0 where we re-architected the storage plugin implementation to use the workmanager library which uses the latest api to manage network changes.