【问题标题】:Publishing checkins using facebook graph api使用 facebook graph api 发布签到
【发布时间】:2012-12-18 15:13:32
【问题描述】:

https://graph.facebook.com/profile-id/checkins?access_token=access_token&message=“办公室”

我正在使用上面的图形 api,在我的提要上发布一个签到,我在浏览器上试过这个, 我得到空数组作为响应,我还使用了允许(发布签入)的图形 api 资源管理器中的 access_token。

我收到如下回复

     {
   "data": [

   ]
}

【问题讨论】:

  • 要发布签到,您必须提供一个place_id 来签到。在此处检查签入创建部分:developers.facebook.com/docs/reference/api/user
  • 我只想做一些假签到(-在办公室),如果我只想做假签到,如何获取地点 ID 以及使用坐标参数有什么用处
  • 检查我发布的答案。这就是我使用 FB SDK V 2x 的方式。尚未迁移到 V 3.x。您将不得不调整我的代码以与新的 SDK 一起使用(也许)。

标签: android facebook-graph-api


【解决方案1】:
final JSONObject jsonobj;

try {

    jsonobj = new JSONObject();
    jsonobj.put("latitude", fetLatitude);
    jsonobj.put("longitude", fetLongitude);

    final String message;
    final String name = fetPlaceName;
    final String placeID = fetPlaceID;

    if (edittxtMessageBox != null){
        message = edittxtMessageBox.getText().toString();
    } else {
        message = "I am at: " + fetPlaceName  + " using MyAppName";
    }

    new AlertDialog.Builder(this).setTitle(R.string.check_in_title)
        .setMessage(String.format(this.getString(R.string.check_in_at), name))
        .setPositiveButton(R.string.checkin, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                Bundle params = new Bundle();
                params.putString("place", placeID);
                params.putString("message", message);
                params.putString("coordinates", jsonobj.toString());
                Utility.mAsyncRunner.request("me/checkins", params, "POST",
                        new placesCheckInListener(), null);
            }
        }).setNegativeButton(R.string.cancel, null).show();
} catch (Exception e) {
    e.printStackTrace();
}

【讨论】:

  • @user1891910:在我的应用程序中,当用户选择Checkin 选项时,他会看到一个可供选择的位置列表。选中后,place_idco-ordinates 通过Intent 发送到我使用上面发布的代码的活动。您将需要在这些方面做一些事情。如果你想做假签到,你可以使用静态place_idco-oridinates
  • 我必须使用我自己的名字进行签到,例如“办公室”、“健身房”、.... 像这样。那么这个 placeid 是什么以及如何创建这些,以及为什么使用坐标参数
  • 您只能签到在 Facebook 上可用的地方。如果它们尚不可用,您将需要创建自己的位置。为什么要使用co-ordinates?因为 FB API 需要它们来进行签到。
  • 那么,如何使用graph api创建自己的签到地点
  • 我有六个假签到图像,当我单击它们时,它应该移动到另一个我签到的地方。对于这六个图标,我如何创建 place_ids 以及我需要使用什么坐标。这些坐标有什么不同吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多