私はFoursquare APIでAndroidアプリを構築しようとしています。ユーザーが匿名になり、認証がないようにしたい。FourSquareから会場カテゴリを取得するときのjava.io.FileNotFoundException
private static final String API_URL = "https://api.foursquare.com/v2";
private static final String VENUE_CATEGORY = "/venues/categories";
URL url = new URL(API_URL + VENUE_CATEGORY);
Log.d(TAG, "Opening URL " + url.toString());
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.connect();
String response = streamToString(urlConnection.getInputStream());
JSONObject jsonObj = (JSONObject) new JSONTokener(response).nextValue();
JSONObject resp = (JSONObject) jsonObj.get("response");
JSONArray category = resp.getJSONArray("categories");
JSONObject sample = category.getJSONObject(0);
mCategoryName = sample.getString("name");
:私は、私はこのようなカテゴリをフェッチして会場カテゴリー(「https://api.foursquare.com/v2/venues/categories」)会場プラットフォームのエンドポイントです見つけ
As covered in our platform docs, our Venues Platform endpoints can be accessed without
user authentication and our Merchant Platform endpoints require the end-user to be an
authed venue manager. All other endpoints, unless otherwise noted, require user
authentication.
:here述べたように
java.io.FileNotFoundException:https://api.foursquare.com/v2/venues/categories
となります。
ここで最初にアクセストークンを取得する必要はありますか?
thx、それは動作します!ところで、Foursquare APIを使って匿名のLBSを構築することは実現可能だと思いますか?私は認証の有無にかかわらず、匿名性を行うことができます。 – manuzhang