2016-04-26 19 views
0

私のアプリにログイン機能を持っています。私のアプリは公開APIに接続し、その成功したリクエストはOKです。コード== 200です。どうすればいいですか?をチェックすると、この部分にコードの一部が挿入されます。「if(response.isSuccessful())」 新しいアクティビティを開始してユーザーのビデオを取得することはできますか?このような?Auth create、次に何をする必要がありますか?

Call<SignInResults> call = videoApi.insertUser(username_value,password_value); 
    call.enqueue(new Callback<SignInResults>() { 

     @Override 
     public void onResponse(Call<SignInResults> call, Response<SignInResults> response) { 
      if(response.isSuccessful()) { 
       SignInResults results = response.body(); 
       Log.d("Response ==>> ", new GsonBuilder().setPrettyPrinting().create().toJson(results)); 
      } 
      else { 
       // handle error 
      } 
     } 

     @Override 
     public void onFailure(Call<SignInResults> call, Throwable t) { 

     } 
    }); 

答えて

0

進行のあなたの次の論理的なステップは、私は将来の使用で非常に他のすべてのAPI接触方法APIキーのいくつかの並べ替えであるか、または[SharedPreferences][1]トークンう推測結果(SignInResults)を、保存することができることとしてあなたの認証メカニズム

SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); 
SharedPreferences.Editor editor = sharedPref.edit(); 
editor.putInt("api_key", results.api_key); 
editor.commit(); 
+0

私はデータを取得できません( SignInResults results = response.body();がnullです –

関連する問題