【发布时间】:2018-05-21 06:50:17
【问题描述】:
我正在使用Retrofit从服务器下载APK文件。
下面是代码sn-p。
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();
}
还有
public interface RetrofitInterface {
@GET("development/filename.apk")
@Streaming
Call<ResponseBody> downloadFile();
}
但是有问题。
下载的 APK 总是不同的。 所以
我怎样才能设置一些public static String in
@GET(Utils.APK_FILE_NAME)
在我的 Utils 类中
public static String APK_FILE_NAME = ""
目前我正在接受
属性值必须是常数
【问题讨论】:
标签: android annotations retrofit