last day (14 days later) » 

7:37 AM
0
A: Post status on facebook wall using Face Book 3.0 in Android

dd619Remove the return statement.it works for me. if (!isSubsetOf(PERMISSIONS, permissions)) { pendingPublishReauthorization = true; Session.NewPermissionsRequest newPermissionsRequest = new Session .NewPermissionsRequest(this, PERMISSIONS); session.requestNewPubli...

 
Didn't work. I get force close. :( - with null pointer exception..Any idea on what the PERMISSIONS code do?
 
permissions allow us to read and write(read and post) .when we create facebook session without any permission then by default it users the "Read permission".But to post on facebook we have to give "Write permission" explicitly.here issubset() function check the write permissions
 
Got it.. So the return part has to be enable orelse it will not work right?
 
in my code ,i have removed the return statement,and it just works fine for me! and one more very important thing "make sure that your session is in "OPENED" state before posting".
 
Yep. I have put this inside: if (session.isOpened())
{
 
7:37 AM
so,now is it working?
 
Nope. still the same. :(
 
i have added my working code ,have a look.
 
Also I have just put the whole code of publishStory and private boolean isSubsetOf. Am I missing anythign else?
Where have you added your working code?
I used your sample code. I get an error. updated on my main questions. Couldn't figure why I should get an error there?
Are you there?
 
it means that your response is null,surround code with the condition response!=null
 
7:51 AM
how come it wasn't the case for you right?
Like this: if (response!=null)
{
JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();

String postId = null;
try
{
postId = graphResponse.getString("id");
}
catch (JSONException e)
{
Log.i("JSON", "JSON error " + e.getMessage());
}
FacebookRequestError error = response.getError();
Log.e("post response",response.toString());
if (error != null)
{
Toast.makeText(Sessionvalid.this, error.getErrorMessage(), Toast.LENGTH_SHORT)
.show();
}
else
{
Toast.makeText(Sessionvalid.this, postId, Toast.LENGTH_LONG).show();
Are you there?
 
8:07 AM
yes,now i am here
I think problem is in your user login
 
what should I do?
 
answer few of my questions
is session is in OPENED state befor you post?
 
yes
 
in oncomplete() method are you getting not-null response?
 
How to check that?
 
8:14 AM
check it by, if(response==null){
Log.w("","getting null response")}
 
checking it now - give a sec
it goes into not null part
that is the else part
 
ok,it means you are getting not-null response?
 
Yep.
 
please print this response on logcat and paste the same here
 
Tried this: if (response == null)
{

Log.e("Response", "NuLL");
}
else
{
Log.e("Response", "Not NuLL");
}
 
8:23 AM
no i mean ,Log.e("response",response.toString()); In else part
 
06-05 14:09:13.175: E/Response(11136): {Response: responseCode: 403, graphObject: null, error: {HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200) The user hasn't authorized the application to perform this action}, isFromCache:false}
 
yes,thats the problem
 
This comes up the first time and then when I give the permission I comes up perfectly.. and then when I do it continuously.. I get the below error.
06-05 14:10:52.636: E/AndroidRuntime(11303): FATAL EXCEPTION: main
06-05 14:10:52.636: E/AndroidRuntime(11303): java.lang.UnsupportedOperationException: Session: an attempt was made to request new permissions for a session that has a pending request.
06-05 14:10:52.636: E/AndroidRuntime(11303): at com.facebook.Session.requestNewPermissions(Session.java:968)
06-05 14:10:52.636: E/AndroidRuntime(11303): at com.facebook.Session.requestNewPublishPermissions(Session.java:501)
06-05 14:10:52.636: E/AndroidRuntime(11303): at com.test.fbtest.Sessionvalid.publishStory(Sessionvalid.java:202)
 
can you give me your complete project or activity?
 
Sure..
I have login session in previous activity.. I have post wall in another activity
shall i post what is there post wall activity
 
8:34 AM
where can i download it?
 
uploading the class file
please check the link
 
its not opening
 
Can you copy the link and paste in another tab..
 
now its showing
 
cool
 
8:44 AM
ok now i am posting my code,It has three activities,just create xml for each activity and put it in your project
 
sure.. what is wrong with mine..
 
what is the difference between yours and mine
also.. This comes up the first time and then when I give the permission I comes up perfectly.. and then when I do it continuously.. I get the below error.
(removed)
06-05 14:10:52.636: E/AndroidRuntime(11303): FATAL EXCEPTION: main
06-05 14:10:52.636: E/AndroidRuntime(11303): java.lang.UnsupportedOperationException: Session: an attempt was made to request new permissions for a session that has a pending request.
06-05 14:10:52.636: E/AndroidRuntime(11303): at com.facebook.Session.requestNewPermissions(Session.java:968)
 
have u tried my code?
 
Checking..
 
8:55 AM
in my code,i login in one activity and posting in another
 
that is exactly what I am doing too
Checking on checkAndPostActivity
it is working
uh..
it is weird that it is not working in mine but working in yours
 
happy now?
 
very much..thanks a lot but any idea.. what went wrong?
 
i dont know
please upvote and accept my answer
 
Sure
Thanks a lot for the great help!
 
9:05 AM
we are on stack overflow to help each other
 
Yep.
oh wait
I am still having the same problem
In permission issue.. I get the force close
after that I am OK
First time on a new phone to post I need to give permission that time I get force close.
and after I give permission i don't have any issues
I am sure you will also have the same problem
just remove permission in facebook for your app and then post to wall..
while you get the permission window you will get force close
 

last day (14 days later) »