Android: Some Share Intents (WeChat, Url2Pdf) not shown right after Customizing -


so i'm trying customize apps displayed through intent.action_send , worked out great except wechat , urltopdf. instead of "wechat" displayed "android-system". if click that, opens intent, wechat-app shown right alone without other applications. have done wrong?

here code:

shareintent = new intent(intent.action_send);  shareintent.addflags(intent.flag_activity_new_document); shareintent.settype("text/plain"); shareintent.putextra(intent.extra_text, forecaststr+" #sunshineapp");  final packagemanager pm = getactivity().getpackagemanager(); final list<resolveinfo> resinfo = pm.queryintentactivities(shareintent, 0);  arraylist <string> packageallowed = new arraylist(); packageallowed.add("com.twitter.android"); packageallowed.add("com.facebook.katana"); packageallowed.add("com.google.android.gm"); packageallowed.add("com.whatsapp"); packageallowed.add("com.evernote"); packageallowed.add("ch.threema.app"); packageallowed.add("com.skype.raider"); packageallowed.add("com.tencent.mm"); packageallowed.add("com.tencent.mm.ui.tools.sharetotimelineui");  arraylist <string> packagesum = new arraylist();  if (!resinfo.isempty()) {     list<intent> targetedshareintents = new arraylist<intent>();     (resolveinfo resolveinfo : resinfo) {         string packagename = resolveinfo.activityinfo.packagename;          if(packageallowed.contains(packagename)){             intent intent=new intent();             intent.setaction(intent.action_send);             intent.settype("text/plain");             intent.putextra(intent.extra_text, "text");             intent.putextra(intent.extra_subject, "subject");              intent.setpackage(packagename);             targetedshareintents.add(intent);         }     }      int size = targetedshareintents.size();     intent chooserintent = intent.createchooser(targetedshareintents.remove(targetedshareintents.size()-1), "share");     chooserintent.putextra(intent.extra_initial_intents, targetedshareintents.toarray(new parcelable[]{}));     startactivity(chooserintent); } 

try set component name additionally:

if(packageallowed.contains(packagename)){     intent intent=new intent();     intent.setaction(intent.action_send);     intent.settype("text/plain");     intent.putextra(intent.extra_text, "text");     intent.putextra(intent.extra_subject, "subject");      // new!!!     intent.setcomponent(new componentname(packagename, resolveinfo.activityinfo.name));       intent.setpackage(packagename);     targetedshareintents.add(intent); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -