Google cloud messaging Limit - android

I know that exists similar questions on site, but I confused because http and xmpp have difference limit:
this page say differences between http and xmpp.
first limit is [xmpp & http]: up to 4KB of data
second limit is:
http: You can send out a message to 1000 users at a time. (ref)
xmpp: For each sender ID, GCM allows 1000 connections in parallel. (ref)
You can send out a message to 1000 users at a time. so if you have more users you'll have to send the message multiple times from your server but to different users each time (ref)
third limit is:
http: I couldn't found this limit in android developer:
There is a limit on how many messages can be stored without collapsing. That limit is currently 100. If the limit is reached, all stored messages are discarded. Then when the device is back online, it receives a special message indicating that the limit was reached. The application can then handle the situation properly, typically by requesting a full sync. (ref)
xmpp:
Every message sent to CCS receives either an ACK or a NACK response. Messages that haven't received one of these responses are considered pending. If the pending message count reaches 100, the app server should stop sending new messages and wait for CCS to acknowledge some of the existing pending messages (ref)
my questions:
1.in second limit, if we use http method and have 2000 users, should we send message twice, every time to 1000 users?, can we do it?
2.xmpp can not support multicast messaging, can we use topic for multicast in xmpp?
any limit on broadcast messaging by topics? (except ref)
4.in third limit, if i send a message to 300 users, and One hundred top users be offline, do they recieve message or any notification when come back and online? (note: use broadcast for http and loop for xmpp)
do this limit effect in topic way ?
do exists any difference in third limit between http and xmpp?
7.exists other limit in http or xmpp?

Yes you can do that. While using HTTP you may have a batch size of 1000(recipients).
Yes. Topic messages is PubSub method and if your clients registered to a given topic, you can sent a push notification to all of them with just one request.
No limitation. Once there was a 1 million subscriber limit per app on Topic Messaging, which doesn't exist anymore.
You confused the third limit:
The first one (HTTP) is about a single client, not all of them. So if you send more than 100 messages to a single client while he is offline, when he gets back online again, none of them will be deliver.
The second one (XMPP) is about all of the queue and it happens in the server side. It means you have to send no messages to GCM if there exists more than 100 unACKed messages there.
So you have no problem considering offline users, GCM will handle to deliver message to all of them, when they come back online.
No.
I explained it in 4.
I don't remember any more.

Related

Google cloud messaging: 100 multiple senders limitation

My android application needs to enable GCM push notifications from multiple senders. I've read that it is possible here: Receiving messages from multi-senders. However, it is mentioned that there is a limit of 100 multiple senders. In my use-case I might have more than 100 senders (servers with different sender ids and api keys), but each application installed on a device will register to a small number of senders (less than 100).
This is how I need it to work:
1. When the user logs in, the client app will send a rest directly to the app server to get the sender ids which are relevant to that user. The number of possible sender ids is larger than 100, but for a specific user the subset of sender ids which are relevant to that user is probably 1.
2. The client app would execute the following code for each senderId in the set of returned sender ids:
String token = instanceID.getToken(senderId),
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
I want to make sure that the limit of 100 multiple senders doesn't apply to my use-case. I tried searching more about the limitation, but came up empty.
Thanks in advance!
The limit of 100 multiple senders mentioned in [0] refers to senders used by a single instance of your app. Thus your specific use case is supported.
[0] https://developers.google.com/cloud-messaging/concept-options#receiving-messages-from-multi-senders

how to send different push notifications from python server to multiple android devices?

We have a python script which do specific job and we want when it see the trigger occurred , it sends a push notification to android devices
but we don't want to send a default message to all of our users.
we want to send customize message based on the trigger to our users
for example :
"user1" the "trigger" hits.
"user2" the "trigger" hits.
.
.
can you help me how to send different messages to different unique android IDs?
I suggest that you're familiar with GCM (official documentation for start you could find here Set up a GCM Client App on Android
Now regarding your question:
you have to have storage on your server where you save registration id, device token + any info which will help you to differ one user/device from another. For example, I did same thing for different apps and stored package_name in addition.
To send custom message you'll need:
1) choose to which devices/users you'll send a message (on exit you'll have a list of device tokens)
2) get list of registration ids from device tokens (on exit list of registration ids)
I separated 1 and 2 for simplicity.
3) I suggest that you know that GCM supports for up to 1,000 recipients for a single message. So you should form here a string of registration ids separated by comma. If you need to send message to 2500 devices, you need to do 3 requests.
4) send request to GCM server and see custom message on specific devices.
Regards.

GCM has limit of 1000 users. What if we need more?

If I understand it correctly, Google Cloud Messaging can only send one message to 1000 different phones. But what if we need to increase this number to 1 million, is that possible ?
I tried to go through the documentation but I did not find anything.
If you need to send the same message to more than 1000 Registration IDs, you simply split the sending process into groups of 1000 Registration IDs. Each group would be sent in a separate request to GCM server.
FCM has replaced GCM, But still if someone is looking for this answer,
You can check this code from google.
multicast messages
Idea is to create a queue
Queue queue = QueueFactory.getQueue("MulticastMessagesQueue");
and add 1000 device ids to this queue and post a send message.
complete server side code implementation
server side implementation of google io 2016 app

Device to Device push notification using android gcm without third party server

We are planning to wirte a messaging/chat kind applicaiton on Android.We are planning to use GCM to exchange messages.The traditional way is to have a Application Server to store all the gcmid of the users and if user1 wants to send message to user2,
1.The user1 send the message to Application server with payload which contains message and receipent id i.e user2
2.The application server retrieves the gcmid of user2 and call sender.send(regid2 , message)
3.User2 receives the message.
I see it is just a REST API Call to https://android.googleapis.com/gcm/send.
So if somhow user1 has the gcmid of user2 why can't we directly call the gcm API from user1 device to reduce the load on server and cost of operations on server.Pls advise me on this.
Note:We are not planning to use Upstreaming
i did the same using Device_To_Device_Messaging_Using_Google_Cloud_Messaging_GCM_-_Android_Example tutorial. this tut is having complate sever as well as client code using gcm. go through it,will help you to achieve what you want.
So if somehow user1 has the gcmid of user2 ...
I think this is precisely where the difficulty lies. If you call directly the GCM API from the device, you need to transfer the gcmid from one device to the others, and by far the simplest and scalable solution I can think of is to use a server, reachable from every devices.

Check html for updates every 15 minutes

How do I check a html file on the internet if it has changed ? But it may not check the first 3 lines for the updates because it displays the time. The website does not use mysql or sqlite database. And is has not got a RSS feed system
Normally, you add this header line in the request:
If-Modified-Since: Sun Nov 6 08:49:37 1994
and then the server determines if the web page has changed since then, and return a 304 response if not. If the web page is generated by a CGI script, then it will be up to that script to decide if the page has changed.
Since you say the first three lines of the web page display the time, I assume the web page is generated by a CGI script of some sort. You haven't said what language that script is written in, but in any event, you'll need to grab the If-Modified-Since header from the request, parse the date, and decide if the content of the page has been modified since that date.
Does it have to be every 15 minutes? If what you're really looking for is notification every time an HTML page changes, you should look at Google Cloud Messaging (GCM). This system generates a notification that's sent to your app by a server.
GCM has advantages that may not be obvious. The biggest one is battery life; constant polling drains the device battery. In comparison, GCM messages are received instantly while the device is connected to the network but not actively sending. In addition, GCM messages are queued and combined, so when the device is offline and then comes back online only one message is sent.
GCM also ensures that your app only uses the network when it has to get data. This allows other apps to use the network more readily.

Categories

Resources