Wednesday 15 August 2012

android - facebook premission ,Session: an attempt was made to request new permissions for a session that has a pending request -


When I use the code works fine and I was able to post to user's wall.

But when I try to post the video and do this I use

when I change my code, I postStatusUpdate () Methood publishStory () / P>

  public zero postStatusUpdate () {if (user! = Null & publishedpromotion ()) {last string message; Message = (user.getFirstName (+) + "+ getString (R.string.status_update_link) + +" + + Video_ID + "+ +" GetString (R.string.google_play_link)); Request request = request. NewstatusUpdateRequest (session .getActiveSession (), message, new request. Callback () {@ override public expired on zero (response) {showPublishResult (message, response.getGraphObject (), response.getError ());}}); Request.executeAsync (); } Else {pendingAction = PendingAction.POST_STATUS_UPDATE; }}   

Replace with:

  Private Zero publishStory () {session session = session .getActiveSession (); If (session! = Zero) {// check publishing permissions list & lt; String & gt; Permission = session.getPermissions (); If (Hyssed (Permissions, Permissions)) {Session. New Presentations Required New Presentation Request = New Session. N. Display (These, Permissions); Session.requestNewPublishPermissions (newPermissionsRequest); Return; } Bundle postproms = new bundle (); PostParams.putString ("Message", getString (R.string.google_play_link)); PostParams.putString ("link", "http://www.youtube.com/watch?v="+ video_id); PostParams.putString ("source", "http://www.youtube.com/v/" + video_id); PostParams.putString ("Picture", "http://img.youtube.com/vi/" + Video_ID + "/0.jpg"); request. Callback callback = new request Callback () {public zero end (response) {JSONObject graphResponse = response .getGraphObject () .getInnerJSONObject (); String PostID = Faucet; Try {PostId = graphResponse.getString ("id"); } Hold (JasonXEpisode E) {Log. (Tag, "Jason Err" + E. Messagees); } FacebookRequest Error Error = response.getError (); If (error! = Null) {Toast.makeText (MyApp.intense, error.getErrorMessage (), Toast.LNGTH_LONG) .show (); } And {/ toast}. MakeText (MyApp.intense, // postcard "posted", toast.lnnhH_LOG). Show (); *}}}; Request request = new request (session, "me / feed", postperm, html method, callback); RequestAsyncTask function = New RequestAsyncTask (request); Task.execute (); }}   

So when I try to post, the app is refreshing and I "tried to request new permissions for the session with a pending request" / P>

I can not find in the first paragraph ...

In another form that has been posted in this form, I get an MSG error like the developer, but It seems that this error is visible when the user says it Area, I do not think the problem in this case.

I attach more code than this piece activation because I think it is necessary.

  Private zero (session session, session location, exception exception) on session location change {If (pending action! = Pending action. NF & amp; exceptions Exceptions) exceptions for example FacebookAuthorizationException {new AlertDialog. Lightweight (Hallopsheb Sampling Activity).). Statutil (R. Strong.Connale). Satmessage (R. String Permission_Net_Graged). SetupCitiviston (R. Starr, blank). Show (); PostStatusUpdateButton.setEnabled (incorrect); Pending Action = Pending Action NOAN; } And if (state == sessionStation .OPENED_TOKEN_UPDATED) {handlePendingAction (); } Updated the UI (); } Private Information LightAction {None, POST_STATUS_UPDATE} Private UiLifecycleHelper uiHelper; Private session. Stats callback callback = New session. Status callback () {@ Override public zero call (session session, session state state, exception exception) {onSessionStateChange (session, state, exception); }};    

You can just publish pending again: authorization = true;

  // So if (session! = Null) {// check the permission for publication list & lt; String & gt; Permission = session.getPermissions (); If (! Assets are (permissions, permissions)) {pendingPublishReauthorization = true; Session New Presentations Request New Presentation Request = New Session New Presentations Request (These, Permissions); Session.requestNewPublishPermissions (newPermissionsRequest); Return; }   

This is working for me.

Hope for this help

No comments:

Post a Comment