android cannot automatically select the appropriate application when the receiving file is opened over bluetooth

  • 2020-05-10 18:47:44
  • OfStack

Receive files via bluetooth, open from the history transfer record, unable to automatically select the appropriate application
However, when opening this newly received file from file manager, you can select the corresponding application (for example, video player opens the.3gp,.mp4 files).

The history record opens the download file by selecting the appropriate APP to open the file through mime type, which was sent to the other party when the file was received
If you are prompted for "unformatted file" or if you use the wrong APP to open the file
The reason is that there is a problem with mime type that the sender filled in when sending the file

log below is log for mtk receiver, please note tag in yellow
Bluetooth.OPP(299): opps newTask: [total=801728][result=null][_id=1][peer_addr=00:23:AF:D5:F6:8B][done=0][name=Eternal Blue.mp3][data=/mnt/sdcard/Received File/Eternal Blue.mp3][state=0][mime=audio/mpeg][type=11][uri=null][peer_name=XT502]

mime type is a description of the file type, with its associated criteria for associating different types of files
mime type is incorrect and needs to be checked for sender issues first
1. The sender is a non-mtk mobile phone. Please confirm whether the file can be opened normally for all the comparison phones sent to different platforms
2. The sender is mtk mobile phone, which installs APK through the third party (such as the third party gallery sends pictures) to send the file. The problem of the third party installing APK should be checked first, and the mime type of the outgoing intent is wrong
3. The sender is mtk mobile phone. Send documents by APK, please submit eservice for processing by mtk

To be clear 1, some of the recipients of the comparison do not have this problem, because some vendors will re-examine the file after receiving it and generate a new mimetype
If only certain files are problematic, refer to this method for mimetype conversion from the mtk receiver as a means of circumvention

\xintong\packages\apps\Bluetooth\profiles\opp\src\com\mediatek\bluetooth\opp\adp\OppManager.java
 
oppsStartPushActivity { 
... 
//add begin 
// According to unrecognizable mime type To transform the  
if( mimeType.equals(" unrecognizable mimetype"); 
this.mOppsTask.setMimeType(" The correct mimetype"); 
/* 
 Convert the corresponding by the suffix name mimetype 
String extname = objectName.substring(objname.lastIndexOf(".")); 
if(extname.equals(".xxx")) 
this.mOppsTask.setMimeType(" The correct mimetype"); 
*/ 
else 
//add end 
this.mOppsTask.setMimeType(mimeType); 

Related articles: