How do I customise the push notification's sound?
By default when a push notification is received the BroadcastReceiver specified in AndroidManifest.xml with intentfilter specified <action android:name="com.parse.push.intent.RECEIVE" /> is called.
Parse.com provides a BroadCastReceiver com.parse.ParsePushBroadcastReceiver which just sounds the default notification sound of the device. It does not have code for a specific notification sound, if you want to change the notification sound for push by parse you would have to implement a new BroadCastReceiver with the intentfilter specified above and have the below code for a custom sound(its only a partial code for demonstration):
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
builder.setSound(alarmSound);
How do I send a push notification from the device itself, without
using the parse console?
Push notification can be sent from a device to another device or from console to devices. Every Parse application installed on a device registered for push notifications has an associated Installation object. The Installation object is where you store all the data needed to target push notifications. Now there would be many app users and you would want to target a specific user, for eg an app collects username at the first installation of the app and sets it in Installation object shown as below:
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("userName", "ranjith"); //mobile 1
installation.saveInBackground();
Now to send notification to the username "ranjith" you would need to create a ParseQuery object with the condition -username=ranjith shown as below, this would send a push notification to username "ranjith".
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
ParseQuery pushQuery = ParseInstallation.getQuery();//mobile2
pushQuery.whereEqualTo("userName", "ranjith");
ParsePush push = new ParsePush();
push.setQuery(pushQuery); // Set our Installation query
push.setMessage("My first notification");
What is the unique Id that I must save in order to perform the above?
These are the 2 unique ids present within parse installation object and these are generated by parse and you would not need to worry about it, to target a specific user you can add a unique id/username field in Installation object as specified above,
installationId: Unique Id for the device used by Parse (readonly).
appIdentifier: A unique identifier for this installation's client
application. This parameter is not supported in Android.(readonly)