我有一个应用程序,从相机或画廊拍摄视频并将其转换为base64数据,并将数据发送到服务器,但问题是每当我转换base64数据时,它将不是视频数据变量中的正确数据.为此我用下面的代码:
FileInputStream objFileIS = null;
try
{
System.out.println("file = >>>> <<<<<" + selectedImagePath);
objFileIS = new FileInputStream(selectedImagePath);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
ByteArrayOutputStream objByteArrayOS = new ByteArrayOutputStream();
byte[] byteBufferString = new byte[1024];
try
{
for (int readNum; (readNum = objFileIS.read(byteBufferString)) != -1;)
{
objByteArrayOS.write(byteBufferString, 0, readNum);
System.out.println("read " + readNum + " bytes,");
}
}
catch (IOException e)
{
e.printStackTrace();
}
videodata = Base64.encodeToString(byteBufferString, Base64.DEFAULT);
Log.d("VideoData**> " , videodata);
Run Code Online (Sandbox Code Playgroud)
请纠正......
我已在清单文件中进行设置android:installLocation="preferExternal"
,但未作为 USB 安装在外部存储中。
我可以作为 SDCARD 安装在外部存储上。
另外,我尝试过 adb 命令,例如:
adb devices
adb shell pm set-install-location 2
adb shell pm get-install-location
Run Code Online (Sandbox Code Playgroud)
但只能在SDCARD上转账。
请提供直接在 OTG Pen Drive 上安装应用程序的建议。
谢谢...!!!