I am using Retrofit
for download APK file from the server.
Below is code snippet.
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Util.APK_DOWNLOAD_URL)
.build();
RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);
Call<ResponseBody> request = retrofitInterface.downloadFile();
try {
downloadFile(request.execute().body());
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_SHORT).show();
}
And
public interface RetrofitInterface {
@GET("development/filename.apk")
@Streaming
Call<ResponseBody> downloadFile();
}
But there is problem.
Download APK is always different. So
How can I set Some public static String
in
@GET(Utils.APK_FILE_NAME)
And in my Utils class
public static String APK_FILE_NAME = ""
Currently I am getting
Attribute Value Must be Constant