Other FCM - Subscribe to many topics

Harris

Expert
Licensed User
This is the example provided to subscribe to one topic...

B4X:
Public Sub SubscribeToTopics
   fm.SubscribeToTopic( "general") 'you can subscribe to more topics
 
   Log(" subscribe Device Token: "&fm.Token)
  
End Sub

Would this be proper (example) to subscribe to many?

B4X:
Public Sub SubscribeToManyTopics
    
    Dim lst As List
    lst.Initialize
    lst.AddAll(Array As String("topic1","topic2","topic3","sometopic"))
    For i = 0 To lst.Size-1
       fm.SubscribeToTopic( lst.Get(i)) 
       Sleep(500)  ' attempt to not over-helm the FCM server by blasting it with subscribe requests
    Next

' typically, I would get topic names from a table - but the intent is the same...
  
End Sub

Thanks
 

DonManfred

Expert
Licensed User
i would not use sleep or sleep(0) but it should work.
 
Upvote 0

Harris

Expert
Licensed User
i would not use sleep or sleep(0) but it should work.
Just wondering why you suggest not giving the FCM server a half second break to to register new subscriptions?
Just not needed (it can handle it)?

Any other tips when dealing with FCM?

Thanks
 
Upvote 0

DonManfred

Expert
Licensed User
to register new subscriptions?
i´m using 1 to 5 Topics in my apps. No need for more.
I jst call them all at once...
B4X:
fm.SubscribeToTopic(topic1)
fm.SubscribeToTopic(topic2)
fm.SubscribeToTopic(topic3)
fm.SubscribeToTopic(topic4)
fm.SubscribeToTopic(topic5)

How MANY Topic do you want to rregister? You can not register unlimited amount of topics.
 
Upvote 0

Harris

Expert
Licensed User
From 1 to 30 perhaps... It all depends on the size of the jurisdiction that a certain police establishment is in charge of...

For example, 1 detachment is responsible for policing the area below (or perhaps 2 - 3 like this).
It will receive messages from people living within any one of these areas.

In certain provinces in Canada, the whole block is called a Rural Municipality (RM of Leask - for example). Each number within is called a Division of the RM.

divs.jpg
 
Upvote 0

DonManfred

Expert
Licensed User
I fear i did not understand anything from the above :(

so you have 10 Divisions in a RM (or whatever many).
Point is that an appuser (Android/iOS) only can be in one of them or am i wrong?

- So only the user in Division 1 are subscribing to a Topic for Division 1.
I just do not get the need for request hundrets of Topics (or how many you need to subscribe to)?

Based on the info i found online the amount of Topics subscriptions are not Limited. But you are limited in not sending to much subscriptions in a short time.

BTW: The Server Api (or even the Server REST Api) can manage (un)subscribing up to 1000 Token to/from a Topic with one Subscriptioncall.
 
Upvote 0

Harris

Expert
Licensed User
an appuser (Android/iOS) only can be in one of them
Correct... He/she lives within one...
need for request hundreds of Topics
The cops do, the user doesn't. Cops manage the RM, users report from within a division.

the info i found online
Yes, I know all the limitations...

I fear i did not understand anything from the above
Gezz Don, I thought it was "Picture Perfect"???
 
Upvote 0

DonManfred

Expert
Licensed User
The cops do, the user doesn't
Ok, understand. A Cop does need to subscribe to how much Topics?
I thought it was "Picture Perfect"???
i think i understand the principle.
It is just the lack of english language (*1) which i am facing. I think my english is "OK", @Peter Simpson says it is really good. But i usually lower my own thinking about it :D

*1: German is my native language. I do not have much experience in SPEAKING english, so it is mostly reading and writing (usually here in the forum) only.
 
Upvote 0

Harris

Expert
Licensed User
Ok, I thought (from all your MANY other posts) you spoke and understood english perfectly...
My bad... I must be more considerate of others who are MUCH smarter than I.

I only understand "broken" english... You fellows know many other languages... If only I was so smart.
 
Upvote 0

DonManfred

Expert
Licensed User
you spoke and understood english perfectly...
that´s what i said :D I am thinking my english is "OK" or maybe good. But i for myself would not declare it as Perfectly. Peter is always saying it IS (I´m doing a Hangout with him some times)
 
Upvote 0
Top