When I get a push notification while my application is not active or closed, my device plays a notification sound. When my application is active or open, it does not play a sound on receiving a notification / message.
I want the notification sound to play even when the application is active / open. Please can someone help me achieve it?
-(void)HandleNotification:(NSDictionary *)userInfo{
NSMutableDictionary * test = [userInfo objectForKey:@"aps"];
NSMutableDictionary *alert_msg = [test objectForKey:@"alert"];
NoteType = [alert_msg objectForKey:@"type"];
Note_Student_id = [alert_msg objectForKey:@"sid"];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"School Link"
message:[alert_msg objectForKey:@"title"]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
My notification looks like this:
{
aps = {
alert = {
sid = 114;
title = fddsf;
type = 2;
};
sound = default;
};
}