android-networking

How to upload a bitmap image to server using android volley library?

六月ゝ 毕业季﹏ 提交于 2019-12-18 17:56:40
问题 How to upload a bitmap image to server using android volley library ?I am trying to use android volley to upload images to server . If there is no such option in android volley ,can you please suggest me the best way to make networking actions faster. You are welcome to message me the links to any available tutorials online pertaining to this subject 回答1: As far as I know, Volley isn't the right choice to send a large amount of data (like an image) to a remote server. Anyway, if you want to

Patch Request Android Volley

痞子三分冷 提交于 2019-12-18 13:14:10
问题 I'm currently using Android's Volley networking library in a project I'm working on. I've pulled down the master branch of volley from https://android.googlesource.com/platform/frameworks/volley/, so my library project should be up to date, but only supports the following request methods: /** * Supported request methods. */ public interface Method { int DEPRECATED_GET_OR_POST = -1; int GET = 0; int POST = 1; int PUT = 2; int DELETE = 3; } It probably wouldn't be much trouble to extend the

How to detect upload/download transfer rate in Android?

会有一股神秘感。 提交于 2019-12-18 12:46:04
问题 I am working on an app which uploads a large amount of data. I want to determine the transfer rate of the upload, to show in a notification. One post suggests using the WifiInfo which will not work for mobile data. Another post suggests getting the network type to estimate the speed. I'm not satisfied with the answers in these posts, so I am asking again. I've seen apps which display the upload transfer rate, as well as some custom ROMs like Resurrection Remix. How can I determine the

Changing Android hotspot settings

别来无恙 提交于 2019-12-18 12:02:24
问题 With the release of API level 26, my app's core functionality broke, this being, changing the users' hotspot setting within the application. To get and set this configuration I am using the following functions from the WifiManager hidden api: getWifiApConfiguration and setWifiApConfiguration . Method getWifiApConfiguration = wifiManager.getClass().getMethod("getWifiApConfiguration"); getWifiApConfiguration.invoke(wifiManager); This is working with devices prior to Android O, but in this

Android Volley MalformedURLException Bad URL

大憨熊 提交于 2019-12-18 07:28:54
问题 After making a second network request using Volley , I always get this error. It doesn't seem to matter what the url I put in is. Volley always claims it is malformed. 08-04 20:16:26.885 14453-14470/com.thredup.android E/Volley﹕ [994] NetworkDispatcher.run: Unhandled exception java.lang.RuntimeException: Bad URL java.lang.RuntimeException: Bad URL at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:127) at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java

Check internet connection in android (not network connection)

一个人想着一个人 提交于 2019-12-18 07:17:45
问题 I have a problem with checking internet connection in android at runtime. I use some different methods to check internet connection but i don't know which one is better . because each of them have some problems . Method 1 check internet connection by pinging Google : Runtime runtime = Runtime.getRuntime(); try { Process mIpAddressProcess = runtime.exec("/system/bin/ping -c 1 8.8.8.8"); int mExitValue = mIpAddressProcess.waitFor(); return mExitValue == 0; } catch (InterruptedException |

Retrofit 2 can't upload a file with two additional separate string parameters

岁酱吖の 提交于 2019-12-17 18:52:03
问题 Read edit at bottom of the question for possible alternative solution until the solution is found . This is a successful post file with two parameters using POSTMan. I am trying to do the same with retrofit but receive BadRequest. PostMan Settings: Chrome Network Post Details: Now here is how I am doing this in Android but failing: Retrofit Service Interface: @Multipart @POST("jobDocuments/upload") Call<ResponseBody> upload(@Part("file") MultipartBody.Part file,@Part("folder") MultipartBody

android how to get indicate when the internet connection is lost?

柔情痞子 提交于 2019-12-17 18:29:09
问题 I'm developing an android application and I want to get a notification when the internet (wifi or packet data connection) connection is lost. On my approach I can get the status of the connection as: private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); }

Example: Android bi-directional network socket using AsyncTask

痞子三分冷 提交于 2019-12-17 04:45:29
问题 Most of the network socket examples I found for Android were one directional only. I needed a solution for a bi-directional data stream. I eventually learned of the AsyncTask. This example shows how to get data from a socket and send data back to it. Due to the blocking nature of a socket that is receiving data, that blocking needs to run in a thread other than the UI thread. For the sake of example, this code connects to a webserver. Pressing the "Start AsyncTask" button will open the socket

How to determine if network type is 2G, 3G or 4G

梦想与她 提交于 2019-12-17 02:42:59
问题 I have an indicator on my application to display the network type (2G or 3G or 4G) but after getting the network type, how do I know what speed category it should be in? I know how to detect the network type: private TelephonyManager telephonyManager; telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); CurrentNetworkType = telephonyManager.getNetworkType(); Given the possible return values: // public static final int NETWORK_TYPE_1xRTT // Since: API Level 4 //