OK Mark.
I am trying to make an application that show the caller-ID when there
is an incoming call.
And where there is another call, I wanna update the caller-ID shown.
I have tried OnNewIntent but this callback wasn't called.
The service code is something like that
@Override
public void onStart(Intent intent, int startId) {
phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state,
String incomingNumber) {
super.onCallStateChanged(state,
incomingNumber);
switch (state) {
case
TelephonyManager.CALL_STATE_RINGING:
Intent intent = new Intent();
intent.setClass(getApplicationContext(),
IncomingCallActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("phoneNumber",
incomingNumber);
startActivity(intent);
break;
}
}
};
}
Is there something I'm missing?
Thank you.
On Apr 19, 8:04 pm, Mark Murphy <[email protected]> wrote:
> Mohamed Amir wrote:
> > Mark: The user isn't supposed to be doing anything. Just reading some
> > information, and it's required to see the most updated information
> > sent by the service.
>
> What if they are in the middle of writing a text message, or are using
> some other application? Why do you think you have the right to intrude
> upon their use of their device this way?
>
> If you are taking some steps to ensure that the only time you start an
> activity from your service is if one of your other activities is in the
> foreground...then that is your call. I think ensuring that behavior will
> be difficult to get right 100% of the time.
>
> Otherwise, I have not yet seen a valid use case of a service launching
> an activity. If anyone has such a use case, chime in, and let us know
> how you are not irritating your users!
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, $35/Year
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---