简体   繁体   English

我如何编写自动电话接收器?

[英]How do i write an automatic phone receiver?

i want to set a sms verification in my app.我想在我的应用程序中设置短信验证。 i looked in some websites and understood that there is a way to get the user phone num without requesting it.我查看了一些网站并了解到有一种方法可以在不请求的情况下获取用户电话号码。 i've found this code for doing it:我找到了这样做的代码:

private void requestHint() {
    HintRequest hintRequest = new HintRequest.Builder()
            .setPhoneNumberIdentifierSupported(true)
            .build();

    PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
            apiClient, hintRequest);
    startIntentSenderForResult(intent.getIntentSender(),
            RESOLVE_HINT, null, 0, 0, 0);
}

i didnt understood what should be put in the "apiClient" variable我不明白什么应该放在“apiClient”变量中

what should i enter in this variable?我应该在这个变量中输入什么?

tnx!!天啊!!

You need to get the apiclient for HintRequest like您需要为 HintRequest 获取 apiclient,例如

apiClient  = new GoogleApiClient.Builder(this)
    .addConnectionCallbacks(this)
    .enableAutoManage(this, this)
    .addApi(Auth.CREDENTIALS_API)
    .build();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM