You can write the code into onMessage()
of GCMIntentService
like
@Override
protected void onMessage(Context context, Intent intent) {
Log.i(TAG, "Received message");
String message = getString(R.string.gcm_message);
displayMessage(context, message);
// notifies user
generateNotification(context, message);
//Write here for sound notification
//for example
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone ringer = RingtoneManager.getRingtone(getApplicationContext(), notification);
ringer.play();
}
start a simple sound or alarm when the APP receive a certain message
from GCM Service
You can put condition in above method and play soound. like
if ("XYZ".equals(message)) {
//Then Play a sound
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone ringer = RingtoneManager.getRingtone(getApplicationContext(), notification);
ringer.play();
}