我已经为NEW_OUTGOING_CALL广播定义了一个接收器.但这并没有被调用.
在我的应用中,我还有其他广播接收器
(电话状态,程序包更改)及其所有调用.
请在下面查看我的Android清单
我还尝试过更改接收方定义的顺序(在活动等之前放置接收方).
manifest.xml
<uses-sdk androID:minSdkVersion="8" /><!-- permissions --><uses-permission androID:name="androID.permission.WRITE_EXTERNAL_STORAGE" /><uses-permission androID:name="androID.permission.READ_CONTACTS" /><uses-permission androID:name="androID.permission.WRITE_CONTACTS" /><uses-permission androID:name="androID.permission.READ_SMS" /><uses-permission androID:name="androID.permission.WRITE_SMS" /><uses-permission androID:name="androID.permission.RECEIVE_SMS" /><uses-permission androID:name="androID.permission.RECEIVE_MMS" /><uses-permission androID:name="androID.permission.SEND_SMS" /><uses-permission androID:name="androID.permission.CALL_PHONE" /><uses-permission androID:name="androID.permission.READ_PHONE_STATE" /><uses-permission androID:name="androID.permission.GET_TASKS" /><!-- <uses-permission androID:name="androID.permission.ACCESS_COARSE_LOCATION"/> --><uses-permission androID:name="androID.permission.ACCESS_FINE_LOCATION" /><!-- Features --><!-- <uses-feature androID:name="androID.harDWare.telephony" /> --><application androID:icon="@drawable/ic_launcher" androID:label="@string/app_name" > <!-- ActivitIEs --> <activity androID:name=".activitIEs.LoginActivity" androID:screenorIEntation="portrait" > </activity> <activity androID:name=".activites.helper.ShowPopUp" > </activity> <activity androID:name=".activitIEs.InnerWindowActivity" androID:noHistory="true" androID:screenorIEntation="portrait" androID:theme="@androID:style/theme.Black.NoTitlebar" > </activity> <activity androID:name=".activitIEs.VaultDetailSmsActivity" androID:screenorIEntation="portrait" androID:theme="@androID:style/theme.Black.NoTitlebar" > </activity> <activity androID:name=".activitIEs.LocationActivity" > </activity> <activity androID:name=".activitIEs.VaultSettingsActivity" > </activity> <!-- Receivers --> <receiver androID:name=".Listeners.Outgoingcallreceiver" > <intent-filter> <action androID:name="androID.intent.action.NEW_OUTGOING_CALL" > </action> </intent-filter> </receiver> <receiver androID:name=".Listeners.PackageChangeReceiver" > <intent-filter> <action androID:name="androID.intent.action.PACKAGE_ADDED" /> <action androID:name="androID.intent.action.PACKAGE_REPLACED" /> <action androID:name="androID.intent.action.PACKAGE_REMOVED" /> <data androID:scheme="package" /> </intent-filter> </receiver> <receiver androID:name=".Listeners.PhonestatebroadcastReceiver" > <intent-filter> <action androID:name="androID.intent.action.PHONE_STATE" > </action> </intent-filter> </receiver> <receiver androID:name=".Listeners.VaultSmsbroadcastReceiver" androID:exported="true" > <intent-filter androID:priority="999" > <action androID:name="androID.provIDer.Telephony.SMS_RECEIVED" /> </intent-filter> <!-- <intent-filter androID:priority="101"> <action androID:name="androID.provIDer.Telephony.WAP_PUSH_RECEIVED" /> <data androID:mimeType="application/vnd.wap.mms-message" /> </intent-filter> <intent-filter androID:priority="101"> <action androID:name="com.androID.mms.transaction.MESSAGE_SENT" /> </intent-filter> --> </receiver> <!-- Services --> <service androID:name=".services.CallLogContentObserverService" > </service> <service androID:name=".services.SentSmsContentObserverService" > </service> <service androID:name=".services.LocationService" > </service></application>
Outgoingcallreceiver.java
package com.IDg.IDvault.Listeners; import com.IDg.IDvault.activitIEs.IDVaultActivity; import androID.content.broadcastReceiver; import androID.content.Context; import androID.content.Intent; import androID.util.Log; import androID.Widget.Toast; public class Outgoingcallreceiver extends broadcastReceiver { @OverrIDe public voID onReceive(Context context, Intent intent) { final String originalNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); this.setResultData("0123456789"); final String newNumber = this.getResultData(); String msg = "Intercepted outgoing call. old number " + originalNumber + ", new number " + newNumber; Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); Log.i("OutgoingCallinterceptor", "OutgoingCallinterceptor"); if (originalNumber.equals("**434*")) { setResultData(null); Intent intent1 = new Intent(context, IDVaultActivity.class); intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent1); } } }
解决方法:
添加< uses-permission androID:name =“ androID.permission.PROCESS_OUTGOING_CALLS” />在manifest.xml中处理传出呼叫的权限
总结以上是内存溢出为你收集整理的android:没有得到新的去电广播全部内容,希望文章能够帮你解决android:没有得到新的去电广播所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)