gpt4 book ai didi

android - 去电接收器(去电)在某些手机上不起作用(三星、HTC ...)

转载 作者:行者123 更新时间:2023-11-30 02:01:57 24 4
gpt4 key购买 nike

我有一个应用程序可以使用 OutgoingCallReceiver 类检测拨出电话。这适用于所有大部分电话。

但在某些手机上,它并没有到达 OutgoingCallReceiver 类的函数 onReceive()。所以我的应用无法检测到拨出电话。我必须重置为出厂配置才能使其正常工作。

这是我的 AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.*******.android.********"
android:installLocation="preferExternal"
android:versionCode="28"
android:versionName="4.2" >

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_LOGS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/>
<uses-feature
android:name="android.hardware.telephony"
android:required="true" />
<uses-feature
android:name="android.hardware.wifi"
android:required="true" />
<uses-feature
android:name="android.hardware.microphone"
android:required="true" />
<uses-feature android:name="android.hardware.camera" />


<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<activity
android:name=".********"
android:screenOrientation="portrait" >
<intent-filter android:label="@string/app_name" >
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name="com.********.android.********.********"
android:excludeFromRecents="true"
android:launchMode="singleTop"
android:screenOrientation="portrait" > <!-- android:theme="@android:style/Theme.Dialog"> -->

<intent-filter>
<action android:name="android.intent.action.SEND" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:excludeFromRecents="true"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:configChanges="orientation|keyboardHidden|screenSize"
android:excludeFromRecents="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/AcceptCallInvisible" >
</activity>

<activity
android:name=".********"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

<activity
android:name=".********"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
</activity>

<activity
android:name="com.********.********.********.********.********"
android:launchMode="singleTask"
android:screenOrientation="portrait" > <!-- android:launchMode="singleTop" -->
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>


<service android:name=".********" />


<receiver android:name=".OutgoingCallReceiver" android:exported="true" android:enabled="true">
<intent-filter android:priority="0" >
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<meta-data />
</intent-filter>
</receiver>
<receiver android:name=".SmsReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<receiver
android:name=".PhoneStateReceiver"
android:exported="true" android:enabled="true">
<intent-filter android:priority="0">
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>

</application>
</manifest>

最佳答案

可能有其他应用程序正在使用此事件。尝试将接收器的优先级设置为最大整数值。

 <receiver android:name=".OutgoingCallReceiver" android:exported="true" android:enabled="true">
<intent-filter android:priority="100000" >
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<meta-data />
</intent-filter>
</receiver>

有关正确实现它的更多信息,请参阅 http://android-developers.blogspot.com/2013/05/handling-phone-call-requests-right-way.html

您也可以尝试更改 list 条目。在某些 OEM 上,它可能会出现解析错误。

像这样:

<uses-permission />
...
<receiver>
<intent-filter> . . . </intent-filter>
<meta-data />
</receiver>

关于android - 去电接收器(去电)在某些手机上不起作用(三星、HTC ...),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31322386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com