Mon approche a été jusqu'ici de laisser la part de l'utilisateur la vidéo via gmail, youtube et ce avec une option de partager via mms
ContentValues content = new ContentValues(4);
content.put(Video.VideoColumns.TITLE, "Cool Video");
content.put(Video.VideoColumns.DATE_ADDED,
System.currentTimeMillis()/1000);
content.put(Video.Media.MIME_TYPE, "video/3gp");
content.put(MediaStore.Video.Media.DATA, videoFile.getAbsolutePath());
ContentResolver resolver = parentActivity.get().getContentResolver();
//I use two URI's. One for the intent with mms(MMSUri) and the
//other(ShareURi) is for sharing video with other social apps like
//gmail, youtube, facebook etc.
Uri ShareUri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,content);
Uri MMSUri = Uri.fromFile(videoFile);
List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(sendIntent, 0);
if(!resInfo.isEmpty())
{
for (ResolveInfo resolveInfo : resInfo)
{
String packageName = resolveInfo.activityInfo.packageName;
Intent targetIntent = new Intent(Intent.ACTION_SEND);
targetIntent.setType("video/3gp");
targetIntent.setPackage(packageName);
if(packageName.contains("mms"))
{
targetIntent.putExtra("sms_body", "Some text here");
targetIntent.putExtra(Intent.EXTRA_STREAM, MMSUri);
}
else
{
targetIntent.putExtra(Intent.EXTRA_SUBJECT, "I can has videos?");
targetIntent.putExtra(Intent.EXTRA_TITLE, "Some title here");
targetIntent.putExtra(Intent.EXTRA_TEXT,"You have gots to watch this");
targetIntent.putExtra(Intent.EXTRA_STREAM, ShareUri);
}
targetedIntents.add(targetIntent);
}
Intent chooserIntent = Intent.createChooser(targetedIntents.remove(0), "Select app to share");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedIntents.toArray(new Parcelable[]{}));
startActivity(chooserIntent);
return;
}
Toast.makeToast(this, "No intents found for this action", Toast.LENGTH_SHORT, Gravity.CENTER).show();
J'essaie de remplir mes intentions cibles pour le Intent.createChooser
savoir seulement ceux-ci travailleraient à attacher/télécharger ma vidéo
EDIT: Je n'accepterai pas ma propre réponse comme la bonne. Je suis plus optimiste, il y a un meilleur là
obtenir le même problème en htc étonner, si vous trouvez une solution alors s'il vous plaît mettez le code correct. – Harshid
@Harshid J'ai mis à jour avec une réponse bien que je suis certain que ce n'est pas la bonne réponse absolue. J'espère toujours que j'obtiendrai une bonne réponse bientôt de la communauté ici. Améliorer ou afficher une réponse sera très apprécié. –