java - 如何分享到BBM?
问题描述
我需要分享一段文字到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);
问题解答
回答1:你的activityName是什么?需要包含包名,比如下边这个才是正确的
intent.setClassName('com.bbm', 'com.bbm.ui.share.SingleEntryShareActivity');回答2:
<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>
相关文章: