相关疑难解决方法(0)

创建APK扩展文件的步骤

我已经开发了应用程序并成功运行.

我在应用程序中使用了应用程序许可功能.现在我要在谷歌播放上传一个应用程序.

请让我知道步骤,如何使用应用程序许可以及如何创建APK扩展文件?

android apk-expansion-files

39
推荐指数
4
解决办法
6万
查看次数

android播放电影里面的扩展文件

我的应用程序正在尝试向用户提供大量内容,因此应用程序的大小远远超过50mb.我们无法减少或删除某些内容,因此我们决定采用扩展方法.

我正在尝试按照本教程:Android APK扩展文件,并已成功将扩展文件放入我的设备进行测试.我可以在扩展中获取任何视频文件的输入流.但是当我尝试为VideoView设置VideoUri时,它会开始崩溃.这是一些代码:

ZipFileContentProvider contentProvider = new ZipFileContentProvider();
String contentPath = "content://";
File root = Environment.getExternalStorageDirectory();
String EXP_PATH = File.separator + "Android" + File.separator + "obb" + File.separator;
String path = root.toString() + EXP_PATH + context.getPackageName() + File.separator + "main.1.com.c4e1.in2cricket.obb";
String zipFileName =  contentPath + path + "/" + fileName;
Uri uri = Uri.parse(zipFileName);
videoView.setVideoUri(uri);


public class ZipFileContentProvider extends APEZProvider {

    @Override
    public String getAuthority() {
        return "com.c4e1.in2cricket.provider.ZipFileContentProvider";
    }
}
Run Code Online (Sandbox Code Playgroud)

android expansion android-videoview

9
推荐指数
1
解决办法
3151
查看次数

从扩展文件中读取mp3

从扩展文件中读取mp3文件

我有名称的创建和扩展文件

"main.1.com.example.app.obb"

其中包含和音频文件名"about_eng.mp3"

现在问题我编写了以下代码来阅读和播放mp3文件

    private final static String EXP_PATH = "/Android/obb/";

static String[] getAPKExpansionFiles(Context ctx, int mainVersion, int patchVersion) {
    String packageName = ctx.getPackageName();
    Vector<String> ret = new Vector<String>();
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        // Build the full path to the app's expansion files
        File root = Environment.getExternalStorageDirectory();
        File expPath = new File(root.toString() + EXP_PATH + packageName);

        // Check that expansion file path exists
        if (expPath.exists()) {
            if ( mainVersion > 0 ) {
                String strMainPath = expPath + File.separator + …
Run Code Online (Sandbox Code Playgroud)

mp3 android file expansion

6
推荐指数
1
解决办法
4417
查看次数

从APK扩展文件中读取内容(来自obb文件)

我已经实施了APK扩展文件下载服务,全部来自http://developer.android.com/google/play/expansion-files.html

我可以下载APK扩展文件,我可以使用下面的代码看到该文件

try {
        ZipResourceFile expansionFile = APKExpansionSupport
                .getAPKExpansionZipFile(this, 3, 0);

        ZipEntryRO[] zip = expansionFile.getAllEntries();
        Log.e("", "" + zip[0].mFile.getAbsolutePath());
        Log.e("", "" + zip[0].mFileName);
        Log.e("", "" + zip[0].mZipFileName);
        Log.e("", "" + zip[0].mCompressedLength);

        AssetFileDescriptor fd = expansionFile
                .getAssetFileDescriptor(zip[0].mFileName);

        if (fd != null && fd.getFileDescriptor() != null) {
            MediaPlayer mp = new MediaPlayer();
            mp.setDataSource(fd.getFileDescriptor());
            mp.start();
        } else {
            Log.e("", "fd or fd.getFileDescriptor() is null");
        }

    } catch (IOException e) {
        e.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

我的obb有文件test.mp4和我的代码Log.e("", "" + zip[0].mFileName);打印test.mp4.

我的 …

android apk-expansion-files

3
推荐指数
2
解决办法
2万
查看次数