I solved my problem for default alarm application:
public static final String ALARM_ALERT_ACTION =
"com.android.deskclock.ALARM_ALERT";
public static final String ALARM_SNOOZE_ACTION =
"com.android.deskclock.ALARM_SNOOZE";
public static final String ALARM_DISMISS_ACTION =
"com.android.deskclock.ALARM_DISMISS";
public static final String ALARM_DONE_ACTION =
"com.android.deskclock.ALARM_DONE";
private BroadcastReceiver mReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
if (action.equals(StaticFields.ALARM_ALERT_ACTION) ||
action.equals(StaticFields.ALARM_DISMISS_ACTION) ||
action.equals(StaticFields.ALARM_SNOOZE_ACTION) ||
action.equals(StaticFields.ALARM_DONE_ACTION))
{
// for play/pause mediaplayer
playPause();
}
}
};
@Override
public void onCreate(Bundle savedInstanceState)
{
IntentFilter filter = new IntentFilter(StaticFields.ALARM_ALERT_ACTION);
filter.addAction(StaticFields.ALARM_DISMISS_ACTION);
filter.addAction(StaticFields.ALARM_SNOOZE_ACTION);
filter.addAction(StaticFields.ALARM_DONE_ACTION);
registerReceiver(mReceiver, filter);
}
On Tuesday, August 7, 2012 1:39:02 PM UTC+3, Necati TUFAN wrote:
>
> I am developing a music app. I want to detect other apps using
> speaker or alarm ringing for play/pause my apps' music.
>
> For phone call i use PhoneStateListener. I tryed
> OnAudioFocusChangeListener for to detect other audios. But didn't work.
>
> I wondering how to solve this problem.
>
--
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