How do i get my push notification to play a sound as soon as it is received?

后端 未结 1 2027
北恋
北恋 2021-01-29 14:31

App A is pushing a notification to App B like so:

NSDictionary *data = @{
                           @\"alert\" : @\"Purchase Successful! 1 Remove Ads\",
                


        
相关标签:
1条回答
  • 2021-01-29 15:29

    Do it like this:

     NSDictionary *data = @{
                               @"alert" : @"you daily milk temp",
                               @"badge" : @"Increment",
                               @"sound" : @"super.caf"
                               };
        PFPush *pusher = [[PFPush alloc] init];
        [pusher setChannels:@[ @"deviceTemperatureReading" ]];
        [pusher setData:data];
        [pusher sendPushInBackground];
    

    "super.caf" is a sound file

    0 讨论(0)
提交回复
热议问题