扩展文件无法从Play商店下载

时间:2017-02-20 09:40:01

标签: android google-play google-play-services apk-expansion-files

我正在创建一个从Play商店下载扩展文件的cordova插件。 我像this一样实现了它。

但是,当我启动我的应用程序时,没有任何反应。 REQUEST TO START DOWNLOAD被召唤了。但没有更进一步。例如,onStart()应该被调用(我的类实现了IDownloaderClient)。

Log.d(TAG, "REQUEST TO START DOWNLOAD");
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(context, pendingIntent, DownloaderService.class);

我的apk文件描述如下:

private static final XAPKFile[] xAPKS = {
        new XAPKFile(
                true, // true signifies a main file
                1000012, // the version of the APK that the file was uploaded against
                443975466L // the length of the file in bytes
        )
};

版本号是我的apk文件之一。我的扩展文件有1000006.

我手机的文件管理器显示了字节长度。实际上,它是423 MB,但在字节中它是443975466.这说经理。

在我的downloaderService实现中,我添加了Base 64密钥:

public static final String BASE64_PUBLIC_KEY = "MY_KEY";
private static final byte[] SALT = new byte[]{4, 7, -32, -3, 43, 4, -9, -44, 51, 22, -28, -1, 2, 22, -6, -11, -1, 4, -2, 38}; // TODO Replace with random numbers of your choice

(SALT实际上是什么?为什么是随机数?)

那么,这些条目是否正确?

如果是:为什么没有发生?

修改

我在alpha版本中下载了扩展文件并测试了我的应用程序直接在我的设备上构建它。

编辑2

应在mDownloaderClientStub.connect(context);中调用

onResume()。但我没有调用onResume(multitasking)方法。直接在

后面添加此代码
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, DownloaderService.class);

也没有工作。

0 个答案:

没有答案