Back to project page rcdroid.
The source code is released under:
Copyright (c) 2013, Jamie Furness (jamie@jamierf.co.uk) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following...
If you think the Android project rcdroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jamierf.rcdroid.logic.packets; // w w w .ja va 2s . c om import android.content.Context; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import com.jamierf.rcdroid.http.Packet; import com.jamierf.rcdroid.http.listener.PacketListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PlayAlarmRequestHandler implements PacketListener { private static final Logger LOG = LoggerFactory.getLogger(PlayAlarmRequestHandler.class); private final Ringtone ringtone; public PlayAlarmRequestHandler(Context context) { final Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); ringtone = RingtoneManager.getRingtone(context.getApplicationContext(), notification); } @Override public void onPacket(Packet packet) { if (ringtone.isPlaying()) return; LOG.trace("Playing alarm: {}", ringtone); ringtone.play(); } }