android-networking

What is proper usage of requestCellInfoUpdate()?

本小妞迷上赌 提交于 2021-02-18 08:23:24
问题 Utilizing onSignalStrengthsChanged , getAllCellInfo() , and related methods, my app monitors cell signal data and displays the results in realtime. My code works very well when targeting API 28 and lower, automatically refreshing the data as it changes. Targeting API 29 results in some Android 10 devices failing to update the data -- but not all. I discovered TelephonyManager.requestCellInfoUpdate() was added to API 29, which may(?) be needed to resolve this issue. However, I have been unable

Android Q ConnectivityManager.requestNetwork with timeout shows error Dialog that stops any subsequent requests

可紊 提交于 2021-02-11 14:19:27
问题 I'm using Android's ConnectivityManager.networkRequest(..) with a timeout to get a hold of a specific network after a queue from user input. Everything works fine most of the time, but if I let the request timeout, I notice I get another Dialog saying Something came up. The application has cancelled the request to choose a device." which requires the user to manually dismiss it before we can do any other network requests. My questions is: How can I dismiss this dialog programmatically? I do

Is it possible to throttle bandwidth when using OkHttp?

不羁岁月 提交于 2021-02-07 14:47:29
问题 Is it possible when using OkHttp to throttle the bandwidth? (possibly using a network interceptor). 回答1: You can make it work in two ways: Send request and read stream manually, and throttle while reading there. Add an Interceptor. Using OkHttp the best way is Interceptor. There are also a few simple steps: To inherit the Interceptor interface. To inherit the ResponseBody class. In custom ResponceBody override fun source(): BufferedSource needs to return the BandwidthSource's buffer. Example

Is it possible to throttle bandwidth when using OkHttp?

人走茶凉 提交于 2021-02-07 14:47:29
问题 Is it possible when using OkHttp to throttle the bandwidth? (possibly using a network interceptor). 回答1: You can make it work in two ways: Send request and read stream manually, and throttle while reading there. Add an Interceptor. Using OkHttp the best way is Interceptor. There are also a few simple steps: To inherit the Interceptor interface. To inherit the ResponseBody class. In custom ResponceBody override fun source(): BufferedSource needs to return the BandwidthSource's buffer. Example

Is it possible to throttle bandwidth when using OkHttp?

我与影子孤独终老i 提交于 2021-02-07 14:46:41
问题 Is it possible when using OkHttp to throttle the bandwidth? (possibly using a network interceptor). 回答1: You can make it work in two ways: Send request and read stream manually, and throttle while reading there. Add an Interceptor. Using OkHttp the best way is Interceptor. There are also a few simple steps: To inherit the Interceptor interface. To inherit the ResponseBody class. In custom ResponceBody override fun source(): BufferedSource needs to return the BandwidthSource's buffer. Example

POST with Android Retrofit

谁都会走 提交于 2021-02-06 14:58:28
问题 I'm new to Android programming and working with Retrofit. I've done a bunch of research on this topic, but haven't been able to find a solution specific to my needs. I'm working with our API and trying to make a POST request. I successfully achieved this with the following non-Retrofit code: private class ProcessLogin extends AsyncTask<Void, String, JSONObject> { private ProgressDialog pDialog; String email,password; protected void onPreExecute() { super.onPreExecute(); inputEmail = (EditText

Android Q always reusing the first entered credentials to connect to the WiFi network

♀尐吖头ヾ 提交于 2021-02-04 07:00:48
问题 I am trying to connect to WiFi using the WifiNetworkSpecifier on Android Q. The problem which I run into is Android always using the last valid credentials to connect to the AP, even after I manually provide the new, updated credentials to the WifiNetworkSpecifier. This is the flow: Successfully connect to the AP. Change the password of the WiFi network. Run the app, try to connect again with the updated credentials (new, valid password provided) but the app can't connect to the WiFi