要通过Intent分享到LinkedIn的类名
我目前正在为Android应用中的一些流行平台创建直接意图以共享一些文本。 我目前正试图与LinkedIn合作。
我目前有直接的意图为Twitter工作,如下所示:
shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setClassName("com.twitter.android", "com.twitter.android.PostActivity"); shareIntent.setType("text/*"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, text); startActivityForResult(shareIntent, 9);
我现在需要的是LinkedIn的相同内容。 到目前为止,我知道在互联网上搜索后LinkedIn的基本包。 这是“com.linkedin.android”(如果这是错误请纠正我)。 但是,我缺少的关键部分是处理LinkedIn应用程序中共享的类的名称。 即com.linkedin.android。?.
我设法通过从APK中提取LinkedIn Manifest文件来找到意图。
类名是: com.linkedin.android.home.UpdateStatusActivity
我感兴趣的人的代码是:
if(Utils.doesPackageExist(getSherlockActivity(), "com.linkedin.android")) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setClassName("com.linkedin.android", "com.linkedin.android.home.UpdateStatusActivity"); shareIntent.setType("text/*"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareText); startActivity(shareIntent); } else { Toast.makeText(getSherlockActivity(), "Please install the LinkedIn app to share your result", Toast.LENGTH_LONG).show(); }
感谢RyszardWiśniewski在http://code.google.com/p/android-apktool/上所做的工作
在我写作时,新的类名是:
com.linkedin.android.infra.deeplink.DeepLinkHelperActivity
所以一起:
Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setClassName("com.linkedin.android", "com.linkedin.android.infra.deeplink.DeepLinkHelperActivity"); shareIntent.setType("text/*"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareText); startActivity(shareIntent);
它是com.linkedin.android.publishing.sharing.ShareActivity,您可以下载此应用并查看手机上运行的当前活动名称是什么https://play.google.com/store/apps/details?id= com.willme.topactivity …但是com.linkedin.android.publishing.sharing.ShareActivity似乎是一个私有类,当你访问Twitter时你无法访问