jogshardik
jogshardik

Reputation: 1456

Multiple notification in same device GCM

I have integrate the GCM in ios application, Now i am facing the issue that i am getting the multiple push notification in same device but the server sending only one notification but the device receiving it duplicates.

I have subscribed for topics in GCM and when i am logging out i am removing subscription for that topic.

I have some reasons for that in my mind:

One thing i have register for subscription in GCM ,but without unsubscribing i am deleting the application.

Second thing i have register for subscription in GCM ,and somehow i am not able to unsubscribe when try to logout from the application.

Any helpful answer can be appreciated.

Upvotes: 2

Views: 631

Answers (3)

Mohamed Atef
Mohamed Atef

Reputation: 167

if you send notifications to all users and may be some one get 2 notifications while he should only get one do that

Create file on your server with any number say 0 then when you want to send notification send this numebr with it then add one to this number++ to be new number in the next notification same with every new one

In your application add variable and let this variable = the comming variable from the server after add the notification but you need to ask if(number_in_your_service!=server_number) //add notification

any number of notifications you send just one will appear

Upvotes: 0

bjiang
bjiang

Reputation: 6078

This issue is fixed in GCM iOS SDK version 1.1.0.

Upvotes: 1

DrAL3X
DrAL3X

Reputation: 799

Same problem here. I would like to understand why this is happening.

To fix it, I run this code

[self.gcmService teardown];
[self.gglInstance stopAllRequests];
[self.gglInstance deleteIDWithHandler:^(NSError *error) {
    NSLog(@"%@", error);
}];

But the origin of the problem is unknown, like how to detect this situation in code.

Upvotes: 0

Related Questions