android - 让用户在 Android 上邀请他的 friend 的最佳策略?

标签 android facebook android-contacts invite

所以我正在构建一个 Android 社​​交游戏。

让用户在游戏中邀请他的 friend 的最佳策略是什么? 如何混合联系人列表中的 facebook 连接、短信、电子邮件?哪个应用程序能以最少的步骤完美地做到这一点。

最佳答案

尝试使用 ACTION_SEND Intent ,如下所示:

    Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Try (your game) for Android!");
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "I'm using (your game) for Android and I recommend it. Click here: http://www.yourdomain.com");

    Intent chooserIntent = Intent.createChooser(shareIntent, "Share with");
    chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(chooserIntent);   

此代码将显示一个菜单,其中包含可以发送消息的所有应用程序,包括 Facebook、Twitter、SMS、电子邮件等。唯一的限制是您只能与 Facebook 共享链接,因此 EXTRA_SUBJECT 必须是纯 URL,否则用户选择 Facebook 时会出现错误。换句话说,只有这适用于 Facebook:

    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "http://www.yourdomain.com");

如果您想分享其他文本(如上例所示),您必须为 Facebook 创建一个单独的分享功能。

巴里

关于android - 让用户在 Android 上邀请他的 friend 的最佳策略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6481255/

相关文章:

android - 用测试类编译 jar

android - 如何从 Google Directions Api 绘制折线

iOS 推文图片 - 我可以在上传前获取图片网址吗?

php - 使用 PHP 格式化 Facebook 日期

android 响应联系人 > 发送?

android - 如何使自定义帐户像 Google/LinkedIn/Facebook 一样显示在 native 联系人应用程序中?

android - 如何检查所选文件是图像?

android - 覆盖 Android GUI

android - 如何将值传递给 Android 上的 Facebook 对话框

android - 从联系人列表中选择联系人时得到 0