huuanh1987 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Unable to publish stream #248

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. done offline access
2. i can retrieve friend list
3. unable to publish stream

What is the expected output? What do you see instead?
I want to publish stream on target facebook userid using offline access and
infinite session

What version of the product are you using? On what operating system?
3.0,2.1.1,2.1.0

Please provide any additional information below.
public class OffLineAccess {

    public FacebookJsonRestClient getOfflineSessionJson(String apikey,String
secretkey,String sessionkey, long userid)
    {
        FacebookJsonRestClient client = new
FacebookJsonRestClient(apikey,secretkey,sessionkey);
        return client;
    }
    public FacebookXmlRestClient getOfflineSessionXML(String apikey,String
secretkey,String sessionkey, long userid)
    {
        FacebookXmlRestClient client = new
FacebookXmlRestClient(apikey,secretkey,sessionkey);
        return client;
    }

    public static void main(String[] args) {

        System.out.println("Off Lin3e access ");

        OffLineAccess obj = new OffLineAccess();    
        FacebookJsonRestClient restClient=
obj.getOfflineSessionJson("d707ab3c7a11bebcab97488d943c0424",
"b1c82e8b932ed5b9c9290a9c7312f067", "52be298bb6daf7973b290a23-1818799362",
facebookuserid);
        System.out.println(restClient.getClient());
        FacebookXmlRestClient restClientxml =
obj.getOfflineSessionXML("d707ab3c7a11bebcab97488d943c0424",
"b1c82e8b932ed5b9c9290a9c7312f067",
"52be298bb6daf7973b290a23-facebookuserid", facebookuserid);
        //PublisherCommission  facebookuserid

        try {

            JSONArray response = (JSONArray)restClient.friends_get();
            System.out.println("response=  "+ response);

                    /*  templateData.put("ad_title", "<a target=_blank 
            href='http://www.domain.com'>just testing.</a>");
                        templateData.put("ad_description", "<a 
            target=_blank href='http://www.domain.com'>testing detail</a>");
                        FeedImage image = new 
            FeedImage("http://www.domain.com/image_06.jpg"), "http://www.domain.com");
                            ArrayList<IFeedImage> images = new 
            ArrayList<IFeedImage>();
                            images.add(image);*/
            //Boolean b= restClient.feed_publishUserAction(141044808971l);
            //restClient.feed_p
            //restClient.feed_publishUserAction(null,   "hello Everyone", null, null,
null, null);
            //restClient.feed_publishUserAction(141044808971l);
            HashMap<String, String> templateData = new HashMap<String, String>();
            templateData.put("content", "Hello Welocome in Java Test Feed");

        //  restClient.feed_getRegisteredTemplateBundleByID(131679823971l);
        //  restClient.feed_publishTemplatizedAction("Hello Java");
            ArrayList<Long> targetIds = new ArrayList<Long>();
            targetIds.add(facebookuserid);
            long bundleId = 131679823971l; 
            restClientxml.beginPermissionsMode("d707ab3c7a11bebcab97488d943c0424");
            System.out.println("Permission started ");

//           Map<Integer, String> prefs =(Map)
restClientxml.data_getUserPreferences();
//              
//              //show any preferences that are currently set for the user, all at
once
//              System.out.println("Preferences already set:");
//              for (Integer key : prefs.keySet()) {
//                  System.out.println("\tkey " + key + " = " + prefs.get(key));
//              }
//          

            if(restClientxml.users_hasAppPermission(Permission.OFFLINE_ACCESS,
facebookuserid))
            {
                System.out.println("Permission allowed  for offline access");
                //client.feed

            }

            restClientxml.users_hasAppPermission(Permission.OFFLINE_ACCESS,
facebookuserid);
            System.out.println("Permission Access ");

            restClientxml.feed_publishUserAction(bundleId, templateData, targetIds,
"Hello Welcome in java");

            //var template_data = {"verb":'',"content":html, "noun":'', "body":'',
"fullbody":'', "images":[{'src':imageUrl, 'href':hreflink}]};
        //  boolean bl=(boolean)restClient.feed_publishUserAction(131679823971l,
templateData, null, al,"Hello Every one in java Feed",500);
            System.out.println("Hello Every one");
            //System.out.println("offline access=
"+restClient.users_hasAppPermission(Permission.OFFLINE_ACCESS));

                //System.out.println("Permission allowed  for offline access");
                //client.feed

        } catch (FacebookException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}

Original issue reported on code.google.com by dinesh....@gmail.com on 1 Oct 2009 at 8:07

GoogleCodeExporter commented 8 years ago
did you get the stream.publish extended permission?

Original comment by fern...@gmail.com on 1 Nov 2009 at 12:53

GoogleCodeExporter commented 8 years ago
No , I am working on that

Original comment by dinesh....@gmail.com on 2 Nov 2009 at 4:36