0
votes

I am developing application for audio calling using sinch framework. I don't know what i miss while setup. when app is in foreground everything works fine. i can do audio call and can talk.

But when app is in background. I am expecting a voip push notification but its not coming.

I had uploaed voip certificate over sinch website. I can receive push notification using knuff

Code

-(void)initSinchClientWithUserId:(NSString *)userId{
sinchClient = [Sinch clientWithApplicationKey:@"3a130480-*****e370f0"
                            applicationSecret:@"XP0E******3Oh2PxCWw=="
                              environmentHost:@"sandbox.sinch.com"
                                       userId:userId];
[sinchClient setSupportCalling:YES];
[sinchClient enableManagedPushNotifications];
sinchClient.delegate =self;
sinchClient.callClient.delegate =self;
[sinchClient start];
[sinchClient startListeningOnActiveConnection];
if (pushTokenData) {
    [sinchClient registerPushNotificationData:pushTokenData];
}

}

Push notification set up

    self.push = [Sinch managedPushWithAPSEnvironment:SINAPSEnvironmentAutomatic];
self.push.delegate = self;
[self.push setDesiredPushTypeAutomatically];
[self.push registerUserNotificationSettings];

Saving token

- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)pushCredentials forType:(PKPushType)type{

    if (sinchClient) {
        [sinchClient registerPushNotificationData:pushCredentials.token];
    }

}

Handle Notification but its never called

 - (void)managedPush:(id<SINManagedPush>)unused
didReceiveIncomingPushWithPayload:(NSDictionary *)payload
            forType:(NSString *)pushType {

     [self handleRemoteNotification:payload];
}
1

1 Answers

0
votes

if (pushTokenData) { [sinchClient registerPushNotificationData:pushTokenData]; }

[sinchClient registerPushNotificationData:pushTokenData]; should really be called when you get the push token, not in init or app launching.