Uploading file to server using Okhttp Android
In this post, i will show you how to upload a file to the server using the okhttp library. OkHTTP is an open source project designed to be an efficient HTTP client. It supports the SPDY protocol. SPDY is the basis for HTTP 2.0 and allows multiple HTTP requests to be multiplexed over one socket connection. Step 1. Create a new project in the android studio and add following permission in android manifest.xml for the Internet, Storage, Camera, Network State. < uses-permission android :name= "android.permission.ACCESS_NETWORK_STATE" /> < uses-permission android :name= "android.permission.INTERNET" /> < uses-permission android :name= "android.permission.READ_EXTERNAL_STORAGE" /> < uses-permission android :name= "android.permission.WRITE_EXTERNAL_STORAGE" /> < uses-permission android :name= "android.permission.CAMERA" /> Step 2. Add Okhttp dependency to build.gradle and click on sync. compile ...
Comments
Post a Comment