public object Conservative : NetworkingRules { override fun isHighBandwidthRequest(requestType: RequestType): Boolean { return requestType is RequestType.MediaRequest } override fun checkValidRequest( requestType: RequestType, currentNetworkType: NetworkType ): RequestCheck { if (requestType is RequestType.MediaRequest) { return if (requestType.type == RequestType.MediaRequest.MediaRequestType.Download) { if (currentNetworkType is NetworkType.Wifi || currentNetworkType is NetworkType.Cellular) { Allow } else { Fail("downloads only possible over Wifi/LTE") } } else { Fail("streaming disabled") } } return Allow } override fun getPreferredNetwork( networks: Networks, requestType: RequestType ): NetworkStatus? { val cell = networks.networks.firstOrNull { it.type is NetworkType.Cellular } val ble = networks.networks.firstOrNull { it.type is NetworkType.Bluetooth } return networks.networks.firstOrNull { it.type is NetworkType.Wifi } ?: if (requestType is RequestType.MediaRequest) { cell } else { ble } } } }
Conservative rules don't allow Streaming, and only allow Downloads over high bandwidth networks.