2017-06-01 5 views
0

私はhttps://dev.fitbit.com/apps/oauthinteractivetutorial Android Appでアクセストークンを取得するためのリンクを参照しています。https://www.fitbit.com/oauth2/authorizeからコードを取得する方法

ステップ1:ここ

私は、ハードコーディングされている登録済みのアプリの詳細。このリンクから

String urls = "https://www.fitbit.com/oauth2/authorize?" + 
          "response_type=code" + 
          "&client_id=228K7X" + 
          "&expires_in=2592000" + 
          "&scope=profile%20settings%20weight" + 
          "&redirect_uri=http://www.google.com/" ; 

私はCode.Ifを取得する必要があります私はこの

http://www.google.com/のようなコードを取得していますブラウザでこの過去のコピー? コード= e800eef2374bd6c1f5cc5e8dab65d4d4bff60406#=


私はアンドロイドのコードで以下のように試してみた、しかしresult.Canいずれかが、このために私を助けて期待得ていませんか?

     URL url = new URL(urls); 
         HttpURLConnection connection = (HttpURLConnection)url.openConnection(); 
         connection.setRequestMethod("POST"); 
         connection.setDoInput(true); 
         connection.connect(); 
        InputStream inputStream = connection.getInputStream(); 
        BufferedReader rd = new BufferedReader(new InputStreamReader(inputStream)); 
+0

を使用していますか? JSONオブジェクト? –

答えて

0

これは、以下の答えをFixed.Findされ、私はあなたが正確に取り戻すことを期待している何のWebView

webView = (WebView) findViewById(R.id.webView); 
webView.getSettings().setJavaScriptEnabled(true); 

     String urls = "https://www.fitbit.com/oauth2/authorize?" + 
       "response_type=code" + 
       "&client_id=228K7X" + 
       "&expires_in=2592000" + 
       "&scope=profile%20settings%20weight" + 
       "&redirect_uri=http://www.google.com/" ; 

     Log.i(TAG," urls ? "+urls); 

     webView.loadUrl(urls); 
     webView.setWebViewClient(new WebViewClient(){ 

      @Override 
      public void onPageStarted(WebView view, String url, Bitmap favicon) { 
       super.onPageStarted(view, url, favicon); 
      } 

      @Override 
      public void onPageFinished(WebView view, String url) { 
       super.onPageFinished(view, url); 

       Log.i(TAG," onPageFinished ? "+url); 
      } 

     }); 
関連する問題