If you think the Android project PhoneProfiles_Eclipse listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package sk.henrichg.phoneprofiles;
/*www.java2s.com*/import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
publicclass ExecuteVolumeProfilePrefsService extends IntentService //WakefulIntentService
{
public ExecuteVolumeProfilePrefsService() {
super("ExecuteRadioProfilePrefsService");
}
//@Override
//protected void doWakefulWork(Intent intent) {
protectedvoid onHandleIntent(Intent intent) {
Context context = getBaseContext();
GlobalData.loadPreferences(context);
DataWrapper dataWrapper = new DataWrapper(context, false, false, 0);
ActivateProfileHelper aph = dataWrapper.getActivateProfileHelper();
aph.initialize(null, context);
long profile_id = intent.getLongExtra(GlobalData.EXTRA_PROFILE_ID, 0);
Profile profile = dataWrapper.getProfileById(profile_id);
profile = GlobalData.getMappedProfile(profile, context);
if (profile != null)
{
AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
// nahodenie ringer modu - aby sa mohli nastavit hlasitosti
aph.setRingerMode(profile, audioManager);
aph.setVolumes(profile, audioManager);
aph.setVolumes(profile, audioManager);
//if (!aph.setVolumes(profile, audioManager))
//{
// nahodenie ringer modu - hlasitosti zmenia silent/vibrate
aph.setRingerMode(profile, audioManager);
//}
/* if (intent.getBooleanExtra(GlobalData.EXTRA_SECOND_SET_VOLUMES, false))
{
// run service for execute volumes - second set
Intent volumeServiceIntent = new Intent(context, ExecuteVolumeProfilePrefsService.class);
volumeServiceIntent.putExtra(GlobalData.EXTRA_PROFILE_ID, profile._id);
volumeServiceIntent.putExtra(GlobalData.EXTRA_SECOND_SET_VOLUMES, false);
//WakefulIntentService.sendWakefulWork(context, radioServiceIntent);
context.startService(volumeServiceIntent);
} */
}
dataWrapper.invalidateDataWrapper();
aph = null;
dataWrapper = null;
}
}