是否可以使用Android原生共享意图在Twitter上分享视频?
到目前为止,我的代码中有些内容不允许我分享视频。
Intent intent = new Intent(Intent.ACTION_SEND);
StringBuilder sb = new StringBuilder();
intent.setType("*/*");
final PackageManager pm = getPackageManager();
final List<ResolveInfo> activityList = pm.queryIntentActivities(intent, 0);
int len = activityList.size();
for (int i = 0; i < len; i++) {
final ResolveInfo app = (ResolveInfo) activityList.get(i);
if (app.activityInfo.packageName.toLowerCase().contains(appName) ||
app.activityInfo.name.toLowerCase().contains(appName)) {
final ActivityInfo activity=app.activityInfo;
final ComponentName name=new ComponentName(activity.applicationInfo.packageName,
activity.name);
intent=new Intent(Intent.ACTION_SEND);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.setComponent(name);
intent.putExtra(Intent.EXTRA_TEXT, "sample message");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
break;
}
}