android - File sharing using Intent.ACTION_SEND gives access denied on BBM -
i trying share audio file saved application. file added media store apps can access it.
intent mediascannerintent = new intent(intent.action_media_scanner_scan_file); uri filecontenturi = uri.fromfile(finalfile); mediascannerintent.setdata(filecontenturi); this.sendbroadcast(mediascannerintent);
i use intent.action_send share files other apps:
public void sharerecording(view view) { intent = new intent(intent.action_send); i.setflags(intent.flag_grant_read_uri_permission); i.settype("audio/mp3"); i.putextra(intent.extra_stream, uri.parse("file:///" + recording.getfilepath())); try { startactivity(intent.createchooser(i, "share " + recording.getname())); } catch (android.content.activitynotfoundexception ex) { toast.maketext(this, "there no app installed share audio file.", toast.length_short).show(); } }
all working apps gmail, yahoo mail, whatsapp, ... except bbm, gives access denied. need make work on bbm ?
thanks help.
update:
i used
uri fileuri = uri.parse("content://" + recording.getfilepath());
instead of
uri fileuri = uri.parse("file:///" + recording.getfilepath());
and worked on bbm not othe apps
so difference between havin uri parsed with: "file:///" , "content://" ? , how can used share working apps ?
the solution use actual file initialize uri object.
file recordingfile = new file(recording.getfilepath()); uri fileuri = uri.fromfile(recordingfile);
this worked apps can share file.
Comments
Post a Comment