0
我有res/raw/suono1.mp3中的音頻mp3,我需要在whatapp上共享(在我的應用程序中)我的代碼是它,但是當我發送時,不要共享HELP ME PLS。爲Android工作室在內部存儲器中保存文件android爲我的應用程序
pulsante2.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
//condividere
InputStream inputStream;
FileOutputStream fileOutputStream;
try {
inputStream = getResources().openRawResource(R.raw.suono2);
fileOutputStream = new FileOutputStream(new File(Environment.getExternalStorageDirectory(), "sound.mp3"));
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) > 0) {
fileOutputStream.write(buffer, 0, length);
}
inputStream.close();
fileOutputStream.close();
}
catch (IOException e) {
e.printStackTrace();
}
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file://" + Environment.getExternalStorageDirectory() + "/sound.mp3"));
intent.setType("audio/mpeg");
startActivity(Intent.createChooser(intent, "Share audio"));
return false;
}
});
發送代碼我需要他們
這很好,只要你在應用程序的私有內存中工作,但是如果你想嘗試類似** Environment.getExternalStorageDirectory()(不再是你的私有應用程序內存)**,調試日誌和發佈例外將進一步幫助你和其他人瞭解你的問題 – ShayHaned
我有原始音頻可以爲我的應用程序代碼?我不會說英語很好,但我沒有足夠的代碼,我需要共享一個audio.mp3從我的應用程序到Whatapp –
從YourApp分享到WhatsApp對任何人都不是問題,除了帳戶。因此,一旦您開始通過代碼嗅探WhatsApp的帳戶訪問權限和可修改性規則,這就是創建漏洞漏洞的地方。所以WhatsApp通過** WhatsApp第三方集成填補了這些漏洞,並且WhatsApp Api Usage僅僅被禁止**。也許你正試圖將原始聲音寫入WhatsApp文件夾?如果您正在尋找將聲音存儲在WhatsApp文件夾中,這是您可以做的事情,但您無法以編程方式通過WhatsApp或通過WhatsApp播放媒體! – ShayHaned