Android share app VIA etc

故事扮演 提交于 2019-12-05 08:11:01

问题


I saw in many apps this.. When you click on a menu, than an other menu show up, and you can share your app VIA e-mail, twitter, bluetooth, facebook, etc.

How can i do this?


回答1:


You can use the SEND intent action to share a market uri pointing to your app.

The chooser will list any installed app that has declared it can share data.

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");

intent.putExtra(Intent.EXTRA_SUBJECT, "App Name");
intent.putExtra(Intent.EXTRA_TEXT, "Check out this cool app http://market.android.com/details?id=com.example.yourpackagename");

Intent chooser = Intent.createChooser(intent, "Tell a friend about App Name");
startActivity(chooser);


来源:https://stackoverflow.com/questions/5558977/android-share-app-via-etc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!