You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static void saveImage(URL url, String outputPath) throws IOException {
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(outputPath);
byte[] b = new byte[2048];
int length;
while ((length = is.read(b)) != -1) {
os.write(b, 0, length);
}
is.close();
os.close();
}
How can i change that code for accept audio file from url ?
thx a lot.
Sorry for my french
The text was updated successfully, but these errors were encountered:
hi,
i would like to send some audio file with this plugin but when i try.
it send audio file like picture.
like that :
var message = {
text: txtmms,
audio: "http://quoteit.fr/quote.mp3"
};
if (image != null && image.length() > 0) {
sendIntent.setType("image/*");
final URL url = new URL(image);
String storageDir = Environment.getExternalStorageDirectory().getPath();
final String path = storageDir + "/" + image.substring(image.lastIndexOf("/") + 1, image.length());
cordova.getThreadPool().execute(new Runnable() {
@OverRide
public void run() {
try {
saveImage(url, path);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
cordova.getActivity().startActivityForResult(sendIntent, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} else {
sendIntent.setType("text/plain");
cordova.startActivityForResult(this, sendIntent, 0);
}
}
How can i change that code for accept audio file from url ?
thx a lot.
Sorry for my french
The text was updated successfully, but these errors were encountered: