在Android上共享时,为什么hashtags与浏览器一起工作,而不是Twitter应用程序本身?

在Android上共享时,为什么hashtags与浏览器一起工作,而不是Twitter应用程序本身?,android,twitter,hashtag,Android,Twitter,Hashtag,我在Twitter上使用类似的方法进行分享,比如: 这允许没有twitter应用程序的用户打开浏览器并共享。然而,我注意到,hashtag只有在通过浏览器共享时才会传递到消息中。如果用户选择了官方应用程序,散列标签将消失。这是已知的bug吗 谢谢 试试看: shareVia("twitter", "example.com"); .... private void shareVia(String packageName, String content) { String t

我在Twitter上使用类似的方法进行分享,比如:

这允许没有twitter应用程序的用户打开浏览器并共享。然而,我注意到,hashtag只有在通过浏览器共享时才会传递到消息中。如果用户选择了官方应用程序,散列标签将消失。这是已知的bug吗

谢谢

试试看:

shareVia("twitter", "example.com"); 

....

private void shareVia(String packageName, String content) {    
    String toShare = content;

    Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, toShare);
    PackageManager pm = mActivity.getPackageManager();
    List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0);
    for (final ResolveInfo app : activityList) {
        if ((app.activityInfo.packageName).contains(packageName)) {
            final ActivityInfo activity = app.activityInfo;
            final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name);
            shareIntent.addCategory(Intent.CATEGORY_LAUNCHER);
            shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |             Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
            shareIntent.setComponent(name);
            mActivity.startActivity(shareIntent);

            break;
       }
    }
}
shareVia(“推特”、“example.com”);
....
私有void shareVia(字符串packageName,字符串内容){
字符串toShare=内容;
意向共享意向=新意向(android.content.Intent.ACTION\u SEND);
shareIntent.setType(“文本/普通”);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,toShare);
PackageManager pm=mActivity.getPackageManager();
List activityList=pm.querytentActivities(shareIntent,0);
对于(最终解决方案信息应用程序:activityList){
if((app.activityInfo.packageName).contains(packageName)){
最终活动信息活动=app.ActivityInfo;
最终组件名称=新组件名称(activity.applicationInfo.packageName,activity.name);
shareIntent.addCategory(Intent.CATEGORY_启动器);
shareIntent.setFlags(Intent.FLAG_活动_新任务| Intent.FLAG_活动_重置_任务_,如果需要);
setComponent(名称);
mActivity.startActivity(共享意向);
打破
}
}
}
试试看:

shareVia("twitter", "example.com"); 

....

private void shareVia(String packageName, String content) {    
    String toShare = content;

    Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, toShare);
    PackageManager pm = mActivity.getPackageManager();
    List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0);
    for (final ResolveInfo app : activityList) {
        if ((app.activityInfo.packageName).contains(packageName)) {
            final ActivityInfo activity = app.activityInfo;
            final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name);
            shareIntent.addCategory(Intent.CATEGORY_LAUNCHER);
            shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |             Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
            shareIntent.setComponent(name);
            mActivity.startActivity(shareIntent);

            break;
       }
    }
}
shareVia(“推特”、“example.com”);
....
私有void shareVia(字符串packageName,字符串内容){
字符串toShare=内容;
意向共享意向=新意向(android.content.Intent.ACTION\u SEND);
shareIntent.setType(“文本/普通”);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,toShare);
PackageManager pm=mActivity.getPackageManager();
List activityList=pm.querytentActivities(shareIntent,0);
对于(最终解决方案信息应用程序:activityList){
if((app.activityInfo.packageName).contains(packageName)){
最终活动信息活动=app.ActivityInfo;
最终组件名称=新组件名称(activity.applicationInfo.packageName,activity.name);
shareIntent.addCategory(Intent.CATEGORY_启动器);
shareIntent.setFlags(Intent.FLAG_活动_新任务| Intent.FLAG_活动_重置_任务_,如果需要);
setComponent(名称);
mActivity.startActivity(共享意向);
打破
}
}
}