Java 使用挂起的意图通知共享视频mp4
我想使用pending intent共享视频mp4。我写了这段代码Java 使用挂起的意图通知共享视频mp4,java,android,xml,Java,Android,Xml,我想使用pending intent共享视频mp4。我写了这段代码 File file = new File(Environment.getExternalStorageDirectory().toString() + "/Path/Path2/"+ecc); if(file.exists()) { String path = file.toString(); Intent
File file = new File(Environment.getExternalStorageDirectory().toString() + "/Path/Path2/"+ecc);
if(file.exists())
{
String path = file.toString();
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "video/mp4");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notificationBuilder.setContentIntent(pendingIntent);
Intent mIntent = new Intent(Intent.ACTION_SEND);
mIntent.setType("video/mp4");
mIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(path));
PendingIntent p = PendingIntent.getActivity(context, 0, mIntent, 0);
notificationBuilder.addAction (android.R.drawable.ic_input_add, "SHARE", p);
}
当我单击“共享”时,将加载活动以共享文件,但如果我选择whats app,则会出现错误:共享失败。为什么?错误在哪里?我们不知道。我们没有看到错误。Post stacktrace.您可以发布通知中共享视频的examle吗?