我试图在 React Native 中添加扩展文件,在其中我可以在React Native和Android类之间架起桥梁,但是要在React Native应用程序中获取OBB数据,我不会出现安装错误,因为ObbStateChangeListener获取路径,但返回状态为21。这MOUNT
下面是我用来在react native中获取模块类内部数据的代码
storageManager = (StorageManager) getApplicationContext().getSystemService(STORAGE_SERVICE);
mOBBFilePath = new File(Environment.getExternalStorageDirectory(), mOBBFileName).getPath();
OnObbStateChangeListener mount_listener = new OnObbStateChangeListener() {
@Override
public void onObbStateChange(String path, int state) {
super.onObbStateChange(path, state);
if (state == OnObbStateChangeListener.MOUNTED) {
if (storageManager.isObbMounted(mOBBFilePath)) {
Log.d("Main", "Mounted successful");
String obbInsideFile = storageManager.getMountedObbPath(mOBBFilePath);
File mountedObbContent = new File(obbInsideFile);
if (mountedObbContent.isDirectory() == true) {
if (DEBUG)
Log.v(TAG, mountedObbContent + " is a folder");
mContentFiles = mountedObbContent.listFiles();
mNumberOfFiles = mContentFiles.length;
if (mNumberOfFiles > 0) {
}
}
}
}
}
};
storageManager.mountObb(mOBBFilePath, "xxxxxxxxx", mount_listener);
有人知道此代码有什么问题吗,为什么它返回状态为21?