小编Art*_*nce的帖子

未安装Google +时,应用程序强制关闭

我的要求是在社交网站上分享.所以,我已经完成了Facebook和Twitter.但我被困在了Google+.我有以下代码要分享Google+,但forcecloses我开始活动时的应用程序.仅当Google+ app尚未在设备上安装时才会发生这种情况.我知道此共享意图要求已安装Google+才能启动此活动.

现在我需要做的是至少告知用户google+共享需要已经google+ app通过对话框或吐司安装而不是强制关闭(如果可能的话,点击对话框上的确定应该重定向到Google Play上的google +).如果谷歌+应用程序已安装,它会像往常一样.

Intent shareIntent = ShareCompat.IntentBuilder.from(this)
             .setText("Hello there! This is a pic of the lazy cat")
             .setType("image/jpeg")
             .setStream(Uri.parse(path))
             .getIntent()
             .setPackage("com.google.android.apps.plus");
 startActivity(shareIntent);
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.提前致谢.

android android-intent google-plus

7
推荐指数
1
解决办法
1937
查看次数

标签 统计

android ×1

android-intent ×1

google-plus ×1