2015-11-29 129 views
0

我正在开发Instagram集成应用程序。我想取消关注一个用户,但我从Instagram取得不相关的答案,包括html doctype说“抱歉,此页面不可用”。我在访问令牌网址中提到了关系权限。它需要审查过程吗?这里是我的代码:Android,Instagram取消关注用户无法完成?

new Thread(new Runnable() { 
      @Override 
      public void run() { 
       try{       
        String urlFollowUnFollow = "https://api.instagram.com/v1/users/" 
        + username 
        + "/relationship?access_token=" 
        + GetStats.ACCESS_TOKEN; 
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); 
        nameValuePairs.add(new BasicNameValuePair("action", "unfollow")); 


       try { 
        DefaultHttpClient httpClient = new DefaultHttpClient(); 
        HttpPost httpPost = new HttpPost(urlFollowUnFollow); 
        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 
        HttpResponse httpResponse = httpClient.execute(httpPost); 
        HttpEntity httpEntity = httpResponse.getEntity(); 
        is = httpEntity.getContent(); 

       } catch (UnsupportedEncodingException e) { 
        e.printStackTrace(); 
       } catch (ClientProtocolException e) { 
        e.printStackTrace(); 
       } catch (IOException e) { 
        e.printStackTrace(); 
       } 

       try { 
        BufferedReader reader = new BufferedReader(new InputStreamReader(
          is, "iso-8859-1"), 8); 
        StringBuilder sb = new StringBuilder(); 
        String line = null; 
        while ((line = reader.readLine()) != null) { 
         sb.append(line + "\n"); 
        } 
        is.close(); 
        response = sb.toString(); 
       } catch (Exception e) { 
        Log.e("Buffer Error", "Error converting result " + e.toString()); 
       } 

         System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!" + response + " !!!!!!!!!!!!!!!!!!!!!!!!!"); 

       } catch (Exception exception) { 
        exception.printStackTrace(); 
       } 
      }} 
     ).start(); 

顺便说一句,我见过其他的stackoverflow的职位。没有帮助。提前致谢。

回答

0

问题是我的客户端无权访问关系。要获得这些访问权限,我必须将我的应用程序提交给Instagram进行审核。