用于访问呼叫者号码的 READ_CALL_LOG 的替代方法? [英] Alternatives to READ_CALL_LOG for accessing a caller's number?
问题描述
由于最近的政策变化,很难获得在 Google Play 上使用 READ_CALL_LOG 权限的权限.我们的应用程序在我们的应用程序中搜索来电号码,如果匹配,则显示在我们的应用程序中输入的来电显示信息.因此,我们不是默认的电话应用程序,而只需要访问来电者的号码.除了 READ_CALL_LOG 之外,还有其他方法可以获取来电者的号码吗?
Due to recent policy changes, it's very difficult to gain permission to use the READ_CALL_LOG permission on Google Play. Our app searches for the incoming caller's number in our app and if there is a match, show Caller ID information inputted in our app. Thus, we are not a default phone app, but just need access to only the incoming caller's number. Are there any alternatives to READ_CALL_LOG to get the caller's number?
推荐答案
这里是我是如何实现的 -
Here how I have achieved this -
第 1 步:创建了一个 CallActivity 并在 onCreate
中读取所有通话记录,并使用 Call 按钮显示在列表视图中.
Step 1:
Created a CallActivity and read the all call log in onCreate
and displayed in listview with a button Call.
第 2 步:当用户点击按钮调用时,此代码被触发
Step 2: When user click on button Call this code get fired
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", "1234567890", null));
context.startActivity(intent);
第 3 步:在 AndroidManifest 文件中更新此内容(仅适用于新创建的活动 - CallActivity)
Step 3: In AndroidManifest file update this (For newly created activity only - CallActivity)
<activity
android:name=".CallActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="vnd.android.cursor.item/phone" />
<data android:mimeType="vnd.android.cursor.item/person" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="voicemail" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</intent-filter>
</activity>
大功告成.
我还可以使用 CALL_READ_PERMISSION 在 Play 商店中发布我的应用,并使用 CALLER ID 应用部分填写谷歌政策表单.在我的情况下,我需要用户身份验证才能推送演示帐户凭据.
I was also able to publish my app in play store with CALL_READ_PERMISSION and filled the google policy form with CALLER ID app section. In my case user authentication required to I push the demo account credentials.
这篇关于用于访问呼叫者号码的 READ_CALL_LOG 的替代方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!