Device token not getting saved

We are using the below query to register a device for channels.
NSString *tokenStr = [backendless.messagingService deviceTokenAsString:deviceToken];[backendless.messagingService registerDeviceToken:tokenStr];
[backendless.messagingService registerDevice:@[@“A”]];
When we use the above query for channel ‘A’, then device token gets added successfully. But when we run the same query to register a same device token for another channel ‘B’, then device token gets added successfully for channel ‘B’, however at the same time device token gets removed for channel ‘A’. This shouldn’t be happened. Could you tell us what is the way to save the device token properly?

I believe a device can register for push notifications only with one channel (I will double check on that).

However for publish/subscribe messages you can register for multiple channels.

Mark

Hi Mark,

Just for the information, If I register a device for multiple channel in one query, then it register successfully. for e.g
[backendless.messagingService registerDevice:@[@“A”, @“B”, @“C”]];

Hi Aman,

Yes, if you would like to register the device for several channels you should use ONE registerDevice: invocation with all required channels - because the previous registration will be canceled.

Regards,
Slava

I tell you what I am looking for… I am creating an app in which user can subscribe to one or multiple retailers. To subscribe for multiple retailers are depending on users, whether they subscriber one by one or they subscribe to all retailers in one go. I am creating a channel name with same as retailer name. So that when retailers want to send a message to their users, they can use channel to send push messages. And message will go to all the users who register for particular channel.

How could I create this functionality with backendless messaging service?

It can be, for example, a such scenario: an user object of your app should have a NSMutableArray property with needed push notification channels - and when the retailers list is changed then this property is synchronously been changing, and registerDevice: method is invoked with this array.

Thanks Slava! So this must be handle with a trick…