File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
react-native-mcu-manager/android/src/main/java/uk/co/playerdata/reactnativemcumanager Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import io.runtime.mcumgr.dfu.mcuboot.model.ImageSet
15
15
import io.runtime.mcumgr.exception.McuMgrException
16
16
import io.runtime.mcumgr.image.McuMgrImage
17
17
import java.io.IOException
18
+ import android.webkit.MimeTypeMap
18
19
19
20
val UpgradeModes =
20
21
mapOf (
@@ -71,7 +72,8 @@ class DeviceUpgrade(
71
72
}
72
73
73
74
private fun extractImagesFrom (updateBundleUri : Uri ): ImageSet {
74
- val type = context.contentResolver.getType(updateBundleUri)
75
+ val fileExtension = MimeTypeMap .getFileExtensionFromUrl(updateBundleUri.toString())
76
+ val mimeType = MimeTypeMap .getSingleton().getMimeTypeFromExtension(fileExtension)
75
77
val binData = uriToByteArray(updateBundleUri) ? : throw IOException (" Failed to read update file" )
76
78
77
79
if (type == " application/zip" ) {
You can’t perform that action at this time.
0 commit comments