我需要分享一段文字到BBM,我觉得我获得的包名和分享页的Activity是正确的,但是无论如何都不能跳转,并且没有错误提示,如何才能跳转到BBM分享页面?
以下是我adb得到的BBM分享界面Activity以及跳转逻辑
sant@sag:~$ adb shell dumpsys activity | grep "mFocusedActivity"
mFocusedActivity: ActivityRecord{8b33724 u0 com.bbm/.ui.share.SingleEntryShareActivity t1485}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, txt);
intent.setType("text/*");
intent.setClassName(activityInfo.packageName, activityName);
startActivityForResult(intent, 1001);
伊谢尔伦2017-04-18 10:50:34
What is youractivityName
? You need to include the package name, for example, the following one is correct
intent.setClassName("com.bbm", "com.bbm.ui.share.SingleEntryShareActivity");
高洛峰2017-04-18 10:50:34
<activity
android:enabled="true"
android:exported="true"
android:label="@string/bbm_contacts" android:name="com.bbm.ui.share.SingleEntryShareActivity" android:screenOrientation="portrait"
android:theme="@style/BBMAppTheme">
<intent-filter>
<action android:name="com.bbm.ui.share.SingleEntryShareActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/x-vcard"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/*"/>
</intent-filter>
intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/*"/>
<data android:mimeType="audio/*"/>
<data android:mimeType="multipart/*"/>
<data android:mimeType="video/*"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
<meta-data android:name="android.service.chooser.chooser_target_service" android:value=".contacts.DirectShareChooserTargetService"/>
</activity>