提示请求显示3 SIM卡号码

时间:2018-12-03 09:00:30

标签: android google-api

HintRequest打开时,我得到3个手机号码,而设备仅插入2个SIM卡,那我该如何解决呢?

我想要类似this

这是我使用public void requestHint(){ HintRequest hintRequest=new HintRequest.Builder() .setHintPickerConfig(new CredentialPickerConfig.Builder().setShowCancelButton(true).build()) .setPhoneNumberIdentifierSupported(true) .setEmailAddressIdentifierSupported(false) .build(); GoogleApiClient apiClient=new GoogleApiClient.Builder(this) .addApi(Auth.CREDENTIALS_API) .build(); PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent( apiClient, hintRequest); try { startIntentSenderForResult(intent.getIntentSender(), RESOLVE_HINT, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); } } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == RESOLVE_HINT){ if(resultCode == RESULT_OK){ Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); Toast.makeText(this, credential.getId(), Toast.LENGTH_SHORT).show(); } } } 获取手机号码的代码。

{{1}}

谢谢。

0 个答案:

没有答案