Reputation: 7
I'm trying to run a program to set the phone to normal mode from silent mode but i dont know what should be inside the method getSystemService(Context.AUDIO_SERVICE)
i have this line of code:
final AudioManager mode = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
mode.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
but i think i need to declare or create a method getSystemService and i dont know what should be its content
thank you
Upvotes: 0
Views: 1122
Reputation: 1156
You dont need to implementgetSystemService()
, it is a method from the Context
class.
this
should refer to a Context
instance. In this case, the code you copied likely came from an Activity
class, which indirectly extends Context
.
Upvotes: 1