Lucky-dog wrote:
> hi all
> I want to listen to outgoing call. Below is our manifest.xml and
> Listen.java. But when a outgoing call is doing, I got the following
> waring, and the receiver got no response. Would you like to help me
> out. Thank you very much.
>
> 03-23 16:05:09.227: WARN/ActivityManager(79): Permission Denial:
> broadcasting Intent { action=android.intent.action.NEW_OUTGOING_CALL
> (has extras) } from com.android.phone (pid=193, uid=1001) requires
> null due to receiver com.android.lianyun/com.android.lianyun.Listen
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.android.lianyun"
> android:versionCode="1"
> android:versionName="1.0.0">
> <uses-permission
> android:name="android.permission.PROCESS_OUTGOING_CALLS" />
>
> <application android:icon="@drawable/icon" android:label="@string/
> app_name">
> <activity android:name=".hangup"
> android:label="@string/app_name">
> <intent-filter>
> <action android:name="android.intent.action.MAIN" />
> <category
> android:name="android.intent.category.LAUNCHER" />
> </intent-filter>
>
> </activity>
>
> <receiver android:name=".Listen" android:exported="false">
> <intent-filter android:priority="0">
> <action
> android:name="android.intent.action.NEW_OUTGOING_CALL" />
> <category
> android:name="android.intent.category.DEFAULT" />
> </intent-filter>
> </receiver>
>
> </application>
> </manifest>
>
>
> package com.android.lianyun;
>
> import android.content.BroadcastReceiver;
> import android.content.Context;
> import android.content.Intent;
> import android.util.Log;
>
> public class Listen extends BroadcastReceiver {
>
> @Override
> public void onReceive(Context context, Intent intent) {
> // TODO Auto-generated method stub
> String string =
> intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
> Log.i("Call is out-going", string);
> }
>
> }
I figured this out, the trick lies with the android:exported
attribute, it needs to be set to "true" to allow it to receive
messages from other applications....
http://developer.android.com/guide/topics/manifest/receiver-element.html#exported
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---