Tuesday, 3 September 2013

Share Intent does not work for videos causing gmail to crash

Share Intent does not work for videos causing gmail to crash

I am trying to share a video that is being created and stored on external
sdcard whose path has been obtained by.
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()
I am using SEND_INTENT as follows:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
shareIntent.setType("video/mp4");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Subject");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"My Text");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(video_path));
startActivityForResult(Intent.createChooser(shareIntent, "Share Your
Video"),SHARE_INTENT);
Problem: While I share through gmail, it shows me compose window with
video attached. But no size being shown of the video and when you either
send or cancel the window, gmail will crash with inputstream NPE on
contentresolver.
In case of youtube, it says you cannot upload videos from cloud service,
my video clearly resides on the device.
In case of facebook, it is silently discarded. This works fine with
wassup. :-)
Any ideas how to get this to work?

No comments:

Post a Comment