Skip to content
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

network-selection library #128

Closed
yschimke opened this issue May 9, 2022 · 1 comment
Closed

network-selection library #128

yschimke opened this issue May 9, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@yschimke
Copy link
Collaborator

yschimke commented May 9, 2022

Network selection library for efficient, correct and validated network selection logic in 3P apps.

Uplift the network selection logic from the media reference app.

/**
 * Implementation of app rules for network usage.  A way to implement logic such as
 * - Don't download large media items over BLE.
 * - Only use LTE for downloads if user enabled.
 * - Don't use metered LTE for logs and metrics.
 */
interface NetworkingRules {
    /**
     * Is this request considered high bandwidth and should activate LTE or Wifi.
     */
    fun isHighBandwidthRequest(requestType: RequestType): Boolean

    /**
     * Checks whether this request is allowed on the current network type.
     */
    fun checkValidRequest(
        requestType: RequestType,
        currentNetworkType: NetworkType
    ): RequestCheck

    /**
     * Returns the preferred network for a request.
     */
    fun getPreferredNetwork(
        networks: Networks,
        requestType: RequestType
    ): NetworkStatus?
class NetworkRepository(
    val connectivityManager: ConnectivityManager,
    val coroutineScope: CoroutineScope,
    val logger: NetworkStatusLogger,
) {
...
    val networkStatus: MutableStateFlow<Networks>
@yschimke yschimke added the enhancement New feature or request label May 9, 2022
@yschimke
Copy link
Collaborator Author

yschimke commented May 9, 2022

Justification: Media apps need to make conscious decisions about which networks to use.

  • Avoiding LTE for downloads unless user has granted permission
  • Requesting LTE automatically for a window of requests
  • Avoiding using the BT paired connection for large downloads (over 1MB?)
  • Short circuiting optional requests (logs, artwork images) to stop them waking up radio.

@yschimke yschimke mentioned this issue May 16, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant