电话号码提示启用电话号码共享

问题描述 投票:0回答:2

电话号码提示 API 允许选择电话号码。 根据docs,用户可以禁用电话号码共享。如何重新启用它? 在哪里可以找到自动填充屏幕?

enter image description here

这是我用来调用“选择电话号码”对话框的代码。当用户禁用“电话号码共享”后,它就不再起作用。

private val phoneNumberHintIntentResultLauncher: ActivityResultLauncher<IntentSenderRequest> =
    registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result ->
        try {
            val phoneNumber = Identity.getSignInClient(requireActivity()).getPhoneNumberFromIntent(result.data)
            binding?.frgSetupAccountEtPhone?.setText(phoneNumber)
        } catch (e: Exception) {
            log(e)
        }
    }

private fun requestHint() {
    val request: GetPhoneNumberHintIntentRequest = GetPhoneNumberHintIntentRequest.builder().build()
    Identity.getSignInClient(requireActivity())
        .getPhoneNumberHintIntent(request)
        .addOnSuccessListener { result ->
            val phoneRequest = IntentSenderRequest.Builder(result.intentSender).build()
            phoneNumberHintIntentResultLauncher.launch(phoneRequest)
        }
        .addOnFailureListener {
            log(it)
        }
}
android google-api google-play-services
2个回答
1
投票

我尝试过

startActivityForResult(
    Intent("com.google.android.gms.auth.api.credentials.PHONE_NUMBER_HINT_SETTINGS"),
rcPhoneNumberHint)

但是,它给了我

java.lang.SecurityException: Permission Denial: starting Intent { act=com.google.android.gms.auth.api.credentials.PHONE_NUMBER_HINT_SETTINGS cmp=com.google.android.gms/.auth.api.credentials.assistedsignin.ui.PhoneNumberHintSettingsActivity } from ProcessRecord{1343fc7 30196:com.example.app/u0a2478} (pid=30196, uid=12478) not exported from uid 10031

我猜他们已经通过设置阻止了此活动从外部启动

android:exported="false"

如果是这样的话,那我们就倒霉了。

如果有人帮助启动“PHONE_NUMBER_HINT_SETTINGS”,它将很有用。


0
投票

点击Google--所有服务--自动填充--电话号码共享 Click on Google

Click on Autofill

Click on Phone Number Sharing

© www.soinside.com 2019 - 2024. All rights reserved.