Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4231532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:58:50+00:00 2026-05-21T01:58:50+00:00

This is my attempt to publish checkins from my Android app: public String APP_ID

  • 0

This is my attempt to publish checkins from my Android app:

public String APP_ID = "[redacted]";
Facebook authenticatedFacebook = new Facebook(APP_ID);
AsyncFacebookRunner fbinvoker = new AsyncFacebookRunner(authenticatedFacebook);
Bundle params = new Bundle();
params.putByteArray("access_token", Main.access.getBytes());
params.putByteArray("message", "Hi".getBytes());
params.putByteArray("place", Main.place_id.getBytes());
JSONObject jo = new JSONObject();
JSONObject frnd_data = new JSONObject();
try {
    jo.put("latitude", lat_value);
    jo.put("longitude", long_value);
    params.putByteArray("coordinates", jo.toString().getBytes());
    frnd_data.put("USER_ID1", "100000838520166");
    params.putByteArray("tags", frnd_data.toString().getBytes());
    fbinvoker.request("https://graph.facebook.com/me/checkins", params, "POST", null, null);
} catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

and here’s the openUrl() method:

public static String openUrl(String url, String method, Bundle params)
      throws MalformedURLException, IOException {
    // random string as boundary for multi-part http post
    String strBoundary = "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f";
    String endLine = "\r\n";

    OutputStream os;

    if (method.equals("GET")) {
        url = url + "?" + encodeUrl(params);
    }
    Log.d("Facebook-Util", method + " URL: " + url);
    HttpURLConnection conn =
        (HttpURLConnection) new URL(url).openConnection();
    conn.setRequestProperty("User-Agent", System.getProperties().
            getProperty("http.agent") + " FacebookAndroidSDK");
    if (!method.equals("GET")) {
        Bundle dataparams = new Bundle();
        for (String key : params.keySet()) {
            if (params.getByteArray(key) != null) {
                    dataparams.putByteArray(key, params.getByteArray(key));
            }
        }

        // use method override
        if (!params.containsKey("method")) {
            params.putString("method", method);
        }

        if (params.containsKey("access_token")) {
            String decoded_token =
                URLDecoder.decode(params.getString("access_token"));
            params.putString("access_token", decoded_token);
        }

        conn.setRequestMethod("POST");
        conn.setRequestProperty(
                "Content-Type",
                "multipart/form-data;boundary="+strBoundary);
        conn.setDoOutput(true);
        conn.setDoInput(true);
        conn.setRequestProperty("Connection", "Keep-Alive");
        conn.connect();
        os = new BufferedOutputStream(conn.getOutputStream());

        os.write(("--" + strBoundary +endLine).getBytes());
        os.write((encodePostBody(params, strBoundary)).getBytes());
        os.write((endLine + "--" + strBoundary + endLine).getBytes());

        if (!dataparams.isEmpty()) {

            for (String key: dataparams.keySet()){
                os.write(("Content-Disposition: form-data; filename=\"" + key + "\"" + endLine).getBytes());
                os.write(("Content-Type: content/unknown" + endLine + endLine).getBytes());
                os.write(dataparams.getByteArray(key));
                os.write((endLine + "--" + strBoundary + endLine).getBytes());
            }
        }
        os.flush();
    }

    String response = "";
    try {
        response = read(conn.getInputStream());
    } catch (FileNotFoundException e) {
        // Error Stream contains JSON that we can parse to a FB error
        response = read(conn.getErrorStream());
    }
    return response;
}

This is the format I got from facebook’s SDK:

curl -F ‘access_token=…’ \
-F ‘message=The coffee is just meh.’ \
-F ‘place=PAGE_ID’ \
-F ‘coordinates={“latitude”:”…”,
“longitude”: “…”}’ \
-F ‘tags=USER_ID1, USER_ID2’ \
https://graph.facebook.com/me/checkins

Now I’m getting these errors:

03-30 19:50:23.621: WARN/Bundle(13255): Key format expected byte[] but value was a java.lang.String. The default value was returned.
03-30 19:50:23.651: WARN/Bundle(13255): Attempt to cast generated internal exception:
03-30 19:50:23.651: WARN/Bundle(13255): java.lang.ClassCastException: java.lang.String
03-30 19:50:23.651: WARN/Bundle(13255): at android.os.Bundle.getByteArray(Bundle.java:1220)
03-30 19:50:23.651: WARN/Bundle(13255): at com.facebook.android.Util.openUrl(Util.java:155)
03-30 19:50:23.651: WARN/Bundle(13255): at com.facebook.android.Facebook.request(Facebook.java:559)
03-30 19:50:23.651: WARN/Bundle(13255): at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)

[snipped for length; hundreds more lines of error output are in the revision history]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T01:58:51+00:00Added an answer on May 21, 2026 at 1:58 am

    I finally figured out the issue. Just ignore these errors. You can publish checkins as I show below:

    Bundle params = new Bundle();
    params.putString("access_token", Main.access);
    params.putString("place", "203682879660695");
    params.putString("Message","I m here in this place");
    JSONObject coordinates = new JSONObject();
    coordinates.put("latitude", Main.mylat);
    coordinates.put("longitude", Main.mylong);
    params.putString("coordinates",coordinates.toString());
    JSONArray frnd_data=new JSONArray();
    params.putString("tags", "xxxx");//where xx indicates the User Id
    String response = faceBook.request("me/checkins", params, "POST");
    Log.d("Response",response);
    

    There’s no need to use putByteArray() instead of putString().
    , where as instead of calling AsyncFacebookRunner you have to call FaceBook object . request, just call the method

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, this is my first attempt at a silverlight app and it's
This is an attempt to rephrase a question I asked earlier. I'd like to
This is a pretty straight forward attempt. I haven't been using python for too
THis is a followup to my previous question Font-dependent control positioning. It's an attempt
This is my first post here and I wanted to get some input from
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit
This is a bit complicated but here goes. I have a Rails app that
How can I use boost::filesystem::path to specify a relative path on Windows? This attempt
This is a bit of a long shot, but if anyone can figure it
This is starting to vex me. I recently decided to clear out my FTP,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.