Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke android phone profile mode at specific time

how to change the android phone profile mode automatically at specific time.

I want to develope an application which changes set up a schedule and at that specific schedules time, profile mode automatically change to desired mode.

how can i do it ?

like image 515
Rahil Avatar asked Oct 23 '12 09:10

Rahil


1 Answers

Use the setRingerMode() method. Following code set the ringtone to silent mode:

AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);

Following are the acceptable values for this function:

RINGER_MODE_NORMAL, RINGER_MODE_SILENT, or RINGER_MODE_VIBRATE. Also add the following permission in the manifest file:

android.permission.MODIFY_AUDIO_SETTINGS

Alarm Manager can be used for execute code at specific time..

like image 139
Swagat Mali Avatar answered Sep 29 '22 23:09

Swagat Mali