2014-01-10 61 views
0

该代码只能在开发者的Android应用程序上运行,并且由开发者的fb账户记录。
我不知道它发生了什么?
还有什么我需要设置?Facebook FQL只能在开发者的账户上运行

SELECT post_id,updated_time,message FROM stream WHERE source_id="+ userID +" and actor_id="+userID+" and type IN (46,66,80,128,247,257,285) LIMIT 120 

但可以运行..

"SELECT name,username, birthday_date,pic_square FROM user WHERE uid IN " 
+ "(SELECT uid2 FROM friend WHERE uid1 = me())" 

这是GetData方法

public void GetDate(){ 


    String fqlQuery = "SELECT post_id,updated_time,message FROM stream WHERE source_id="+ userID +" and actor_id="+userID+" and type IN (46,66,80,128,247,257,285) LIMIT 120";  

    Bundle params = new Bundle(); 
    params.putString("q", fqlQuery); 
    Session session = Session.getActiveSession(); 

    Request request = new Request(session, "/fql", params,HttpMethod.GET, new Request.Callback() { 
     public void onCompleted(Response response) { 
      try { 
       GraphObject graphObject = response.getGraphObject(); 
       FacebookRequestError error = response.getError(); 
       if (graphObject != null) { 
        // Check if there is extra data 
        if (graphObject.getProperty("data") != null) {       

         JSONArray dataArray = new JSONArray(graphObject.getProperty("data").toString()); 

         Log.e("JSONARRAY",graphObject.getProperty("data").toString()); 


         for (int i = 0; i < dataArray.length(); i++) { 
          JSONObject dataObject = (JSONObject) dataArray.get(i);       
          String postID = dataObject.getString("post_id"); 
          String postTime = dataObject.getString("updated_time"); 
          String postMessage = dataObject.getString("message"); 
          Log.e("postID",postID); 
          Log.e("postTime",postTimev); 
          Log.e("postMessage",postMessage); 
         }      
        } else if (error != null) { 
        } 
       }else{ 
       } 
       //Log.e("Result: ", response.toString()); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 

     } 
    }); 
    Request.executeBatchAsync(request); 
    finish(); 

} 

我使用Facebook开发人员工具进行测试,它可以工作.. .. 链接:https://developers.facebook.com/tools/explorer/


权限:(我做了)

  1. 所有的Facebook开发者的Android页-Getting步骤开始
  2. 获得访问令牌由https://developers.facebook.com/tools/explorer/沙盒模式

回答

0

检查是否打开或关闭。使沙盒模式关闭。只有开发人员才能看到您的应用上的沙箱。在Facebook应用页面中进行更改

+0

感谢您的回复,但该应用程序的状态已生效并可供所有用户使用...... – user3181880

0

问题可能在于您如何执行查询。在运行FQL之前向我们显示您使用的代码以及如何进行身份验证。你是否也确定你已经获得了你需要的权限?

+0

我已发布我的代码,是否足够? (谢谢) – user3181880

相关问题