Saturday, January 8, 2011

[android-developers] Accessing AudioManager within a class which extends BroadcastReceiver

I am using an AlarmManager to trigger the following class so it will
change the volume from say high to low:

package com.test;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;

public class ToRing extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
}
}

It is saying that AUDIO_SERVICE cannot be resolved to a constant or
variable. How can I access the audio service from within the
broadcast receiver?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate