如何使用共享意图共享整个Android应用程序 [英] How to Share Entire Android App with Share Intent

查看:190
本文介绍了如何使用共享意图共享整个Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前使用了共享类型的意图,例如:

I have used Sharing-type intents before, such as:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "---" });
intent.putExtra(Intent.EXTRA_SUBJECT, "---");
startActivity(Intent.createChooser(intent, "Contact Us!"));

但是,这基本上与Email/MMS和其他文本或文档类型的应用程序共享.您如何做同样的事情,但包括社交共享,如Facebook,Twitter和Google Plus(举几个重要的名字).我想分享的是该应用程序,其中的文字是:嘿,下载此链接以签出该应用程序!" (或类似的内容).

However, this basically shares with Email/MMS and other text or document type apps. How do you do this same things but include Social sharing like Facebook, Twitter and Google Plus (to name the important ones). And WHAT I want to share is the app, where the text says, "hey download this link to check out the app!" (or something similar along those lines).

推荐答案

要添加Facebook,Twitter等共享选项,用户只需需要安装这些应用程序.由其他应用程序决定将如何处理Intents类型的数据.

To add the Facebook, Twitter etc. share options, the user just needs to have those applications installed. It's up to other applications what type of Intents they will tell the system they can handle.

然后将获取基本的ACTION_SEND意图.

Then a basic ACTION_SEND intent will get picked up.

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,
    "Hey check out my app at: https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID);
sendIntent.setType("text/plain");
startActivity(sendIntent);

来源

这篇关于如何使用共享意图共享整个Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆