Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19046

Android: error with requestWithGraphPath and facebook sdk 4.0.3

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Titanium CLI
      CLI Version = 4.0.0-beta8

      Titanium SDK
      SDK Version = 4.0.0.RC5

      Facebook modules ver. 4.0.0

    • Sprint:
      2015 Sprint 21 SDK

      Description

      I have just started working with Appcelerator Studio. But when I try to use the new facebook sdk 4.0.3 I no longer use the follow request:

      facebook.requestWithGraphPath('xeniagympalestra/albums? fields=id,name,cover_photo,count&format=json', {}, 'GET', function(e) {
      	if (e.success) {
      		var result = JSON.parse(e.result);
      

      I have made the following changes, found in the documentation of the module Facebook in Appcelerator documentation:
      http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook

      1) Add

      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
      <activity android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="Xenia Gym"/>
      

      in tiapp.xml file

      2) Add

      <?xml version="1.0" encoding="utf-8"?>
       
      <resources>
      <string name="app_id">1615395XXXXXXXXXX</string>
      </resources>
      

      in platform/android/res/values/strings.xml file
      3) Add

      var facebook = Alloy.Globals.Facebook;
       
      $.index.fbProxy = facebook.createActivityWorker({
      	lifecycleContainer : $.index
      });
      

      in index.js file
      4) Add

      var facebook = Alloy.Globals.Facebook;
      facebook.permissions = ['read_stream'];
      

      But the result are these errors:

      Bad request, contact the developer and log a bug
      

      for android platform

      FBSDKLog: Error for request to endpoint 'xeniagympalestra/albums?fields=id,name,cover_photo,count&format=json': An open FBSession must be specified for calls to this endpoint.
      

      for iOS platform

      The same request was working with the facebook module ver 3.x.x

        Issue Links

          Activity

          Hide
          evil_dr_fish Robin Williams added a comment -

          Your syntax is incorrect. From the module's documentation:

          fb.requestWithGraphPath('me', {}, 'GET', function(e) {
          if (e.success)

          { alert(e.result); }

          else if (e.error)

          { alert(e.error); }

          else

          { alert('Unknown response'); }

          });

          So I think your request ought to be formatted something like:

          facebook.requestWithGraphPath('xeniagympalestra/albums',

          {fields: 'id,name,cover_photo,count'}

          , 'GET', function(e) {
          if (e.success) {

          Show
          evil_dr_fish Robin Williams added a comment - Your syntax is incorrect. From the module's documentation: fb.requestWithGraphPath('me', {}, 'GET', function(e) { if (e.success) { alert(e.result); } else if (e.error) { alert(e.error); } else { alert('Unknown response'); } }); So I think your request ought to be formatted something like: facebook.requestWithGraphPath('xeniagympalestra/albums', {fields: 'id,name,cover_photo,count'} , 'GET', function(e) { if (e.success) {
          Hide
          pravipravi Praveen Kodakkad added a comment - - edited

          I am also experiencing the Same issue with Facebook Login App. The application is not Frozen state as without resolving this issue I cannot log in to the App and hence Whole app development in hang state.

          I tried in iOs 8+ devices.
          Titanium SDK Version 4.0
          Appcelerator Studio

          I am able to login for the first time. Then I exit app, to background and then coming to foreground, it checks

           if(fb.loggedin) 

          Then decides to call

          fb.requestWithGraph('me',{},function(e){
          //Code to write
          }

          This is failing with an error

          FBSDKLog: Error for request to end point 'me': An open FBSession must be specified for calls to this endpoint.

          Can I know when and in which version this issue will be fixed?

          Show
          pravipravi Praveen Kodakkad added a comment - - edited I am also experiencing the Same issue with Facebook Login App. The application is not Frozen state as without resolving this issue I cannot log in to the App and hence Whole app development in hang state. I tried in iOs 8+ devices. Titanium SDK Version 4.0 Appcelerator Studio I am able to login for the first time. Then I exit app, to background and then coming to foreground, it checks if (fb.loggedin) Then decides to call fb.requestWithGraph( 'me' ,{},function(e){ //Code to write } This is failing with an error FBSDKLog: Error for request to end point 'me': An open FBSession must be specified for calls to this endpoint. Can I know when and in which version this issue will be fixed?
          Hide
          evil_dr_fish Robin Williams added a comment -

          I've been getting that error too! iOS for certain... Haven't checked android yet

          Show
          evil_dr_fish Robin Williams added a comment - I've been getting that error too! iOS for certain... Haven't checked android yet
          Hide
          jfalcone Joe Falcone added a comment - - edited

          We're running identical code iOS and Android to view a photo gallery. Using 4.0.0.GA SDK

          On iOS it works perfectly.

          On Android 5.1 we're getting "Bad request, contact the developer and log a bug" also.

          We login successfully but the requestWithGraphPath fails!

          Console Log

          [INFO] : login from uid: 10206542681741842, name: Kon Lovett
          [ERROR] : TiFacebookModule: (KrollRuntimeThread) [90,49768] requestWithGraphPath callback error
          [ERROR] : TiFacebookModule: (KrollRuntimeThread) [0,49768] error userActionMessageId: 0
          [ERROR] : TiFacebookModule: (KrollRuntimeThread) [0,49768] should notify user: false
          [ERROR] : TiFacebookModule: (KrollRuntimeThread) [0,49768] error message: An access token is required to request this resource.
          [ERROR] : Facebook gallery: Bad request, contact the developer and log a bug

          Show
          jfalcone Joe Falcone added a comment - - edited We're running identical code iOS and Android to view a photo gallery. Using 4.0.0.GA SDK On iOS it works perfectly. On Android 5.1 we're getting "Bad request, contact the developer and log a bug" also. We login successfully but the requestWithGraphPath fails! Console Log [INFO] : login from uid: 10206542681741842, name: Kon Lovett [ERROR] : TiFacebookModule: (KrollRuntimeThread) [90,49768] requestWithGraphPath callback error [ERROR] : TiFacebookModule: (KrollRuntimeThread) [0,49768] error userActionMessageId: 0 [ERROR] : TiFacebookModule: (KrollRuntimeThread) [0,49768] should notify user: false [ERROR] : TiFacebookModule: (KrollRuntimeThread) [0,49768] error message: An access token is required to request this resource. [ERROR] : Facebook gallery: Bad request, contact the developer and log a bug
          Hide
          jfalcone Joe Falcone added a comment -

          So here's the problem

          On iOS say you use /34753323422/photos?limit=50 as a graph endpoint and that works fine.

          But on Android you have to move limit=50 and any other parameters into the params dictionary - the second parameter to requestWithGraphPath.

          Once we did that, it worked on Android fine.

          Show
          jfalcone Joe Falcone added a comment - So here's the problem On iOS say you use /34753323422/photos?limit=50 as a graph endpoint and that works fine. But on Android you have to move limit=50 and any other parameters into the params dictionary - the second parameter to requestWithGraphPath. Once we did that, it worked on Android fine.
          Hide
          alexgalvagno Alessandro Galvagno added a comment - - edited

          Hi Robin Williams,
          I have also tried:

          facebook.requestWithGraphPath('xeniagympalestra/albums',

          { fields: 'id,name,cover_photo,count' }

          , 'GET', function(e) {
          if (e.success)

          { ..... }

          but the result is the same, an error.

          error message: com.facebook.FacebookException: Session provided to a Request in un-opened state.
          

          Show
          alexgalvagno Alessandro Galvagno added a comment - - edited Hi Robin Williams, I have also tried: facebook.requestWithGraphPath('xeniagympalestra/albums', { fields: 'id,name,cover_photo,count' } , 'GET', function(e) { if (e.success) { ..... } but the result is the same, an error. error message: com.facebook.FacebookException: Session provided to a Request in un-opened state.
          Hide
          msamah Ashraf Abu (Inactive) added a comment -

          Please follow https://jira.appcelerator.org/browse/TIMOB-19577 for more updates. Will be upgrading the module to use Facebook's android sdk 4.7.0 and updating the module's API as well.

          Show
          msamah Ashraf Abu (Inactive) added a comment - Please follow https://jira.appcelerator.org/browse/TIMOB-19577 for more updates. Will be upgrading the module to use Facebook's android sdk 4.7.0 and updating the module's API as well.
          Hide
          msamah Ashraf Abu (Inactive) added a comment - - edited

          Resolving issue as won't fix as https://jira.appcelerator.org/browse/TIMOB-19577 is upgrading the facebook sdk and module for Android.

          Show
          msamah Ashraf Abu (Inactive) added a comment - - edited Resolving issue as won't fix as https://jira.appcelerator.org/browse/TIMOB-19577 is upgrading the facebook sdk and module for Android.
          Hide
          lchoudhary Lokesh Choudhary added a comment -

          Closing in accordance to resolution of the ticket.

          Show
          lchoudhary Lokesh Choudhary added a comment - Closing in accordance to resolution of the ticket.

            People

            • Assignee:
              msamah Ashraf Abu (Inactive)
              Reporter:
              alexgalvagno Alessandro Galvagno
            • Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development

                  Agile

                    Poker Sessions

                    This issue is currently not assigned to any Poker Session.

                      Git Source Code