Created
May 9, 2021 10:27
-
-
Save walidum/67b1bd63e34a2d03400b14cb2611790c to your computer and use it in GitHub Desktop.
Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, String> map = new HashMap<>(); | |
map.put("phonenumber", phoneNumber); | |
map.put("newpassword", newpassword); | |
FirebaseUser mUser = FirebaseAuth.getInstance().getCurrentUser(); | |
mUser.getIdToken(true) | |
.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() { | |
public void onComplete(@NonNull Task<GetTokenResult> task) { | |
if (task.isSuccessful()) { | |
String idToken = task.getResult().getToken(); | |
map.put("token_ak", idToken); | |
Call<HashMap<String, String>> call3 = apiInterface.changepasswordphone(map); | |
call3.enqueue(new Callback<HashMap<String, String>>() { | |
@Override | |
public void onResponse(Call<HashMap<String, String>> call, Response<HashMap<String, String>> response) { | |
HashMap<String, String> data = response.body(); | |
Log.v("forgotPassword", "Response=" + data); | |
if (data.get(Constants.TAG_STATUS).equals("true")) { | |
Toast.makeText(LoginActivity.this, getResources().getString(R.string.pass_is_change), Toast.LENGTH_SHORT).show(); | |
} else | |
Toast.makeText(LoginActivity.this, getResources().getString(R.string.pass_is_not_change), Toast.LENGTH_SHORT).show(); | |
if (progressDialog.isShowing()) | |
progressDialog.dismiss(); | |
} | |
@Override | |
public void onFailure(Call<HashMap<String, String>> call, Throwable t) { | |
call.cancel(); | |
if (progressDialog.isShowing()) | |
progressDialog.dismiss(); | |
} | |
}); | |
} else { | |
// Handle error -> task.getException(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment