On 11 Lug, 10:58, Federico Paolinelli <[email protected]> wrote:
> On 11 Lug, 10:15, Federico Paolinelli <[email protected]> wrote:
>
>
>
> > So, I added the receiver (contained in application) in the manifest
>
> > <receiver android:name="mypkg.IncomingCallReceiver">
> >                 <intent-filter><action
> > android:name="android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED"/>
> >  </intent-filter>
>
> > </receiver>
>
> > I gave the readphone state permission
>
> >     <uses-permission
> > android:name="android.permission.READ_PHONE_STATE"/>
>
> > But the onReceive method of my receiver is never called, using a real
> > device (hero) or the emulator.
>
> > Am I missing something? This is driving me mad.
>
> Just to add more info, if I register the receiver in the onCreate of
> the main activity of my application, it works correctly.
> However, I need to register it in the manifest since I want it to get
> fired even if the app is not running.
>

Resolved: I was using the ACTION_PHONE_STATE_CHANGED  name of
telephonymanager class instead of its constant value
android.intent.action.PHONE_STATE in the intentfilter while
registering the receiver in the manifest. By the way, it doesn't feel
natural to use the value of the costant instead of its name, and it is
dependent on future change of the costant value.

Hope this may help somebody, sorry to have bothered you all.

-- 
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

Reply via email to