Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:07:23+00:00 2026-06-13T12:07:23+00:00

A few days ago the push notification for Android devices was working fine because

  • 0

A few days ago the push notification for Android devices was working fine because I had around 1000 device tokens so far in my database, but today it’s not working because it’s reached to around 1500 device tokens. I’m getting java.io.IOException on the server side.

java.io.IOException: Server returned HTTP response code: 400 for URL: https://android.googleapis.com/gcm/send
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1491)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1485)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1139)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
    at com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:363)
    at com.google.android.gcm.server.Sender.send(Sender.java:261)
    at com.orange.server.ws.androidpns.androidPNHandler.run(androidPNHandler.java:58)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://android.googleapis.com/gcm/send
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
    at com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:362)
    ... 2 more

I checked for one device token it worked fine but when there are to many device tokens (>800) in my database table I’m getting this above exception. Here is my server code for GCM.

Sender sender = new Sender("SENDER-ID");
AndroidPNSEntityHandler androidPNSEntityHandler = new AndroidPNSEntityHandler();
ArrayList<String> androidDeviceIds = androidPNSEntityHandler.getList();

/* I checked by adding only one device token to this arraylist like
this **androidDeviceIds.add("Android-Device-Token");**
It worked fine...
*/

if(androidDeviceIds.size() != 0)
{
    String title;
    if(!isOrangeCall)
        title = "title";
    else
        title = "oTitle";

    Message message = new Message.Builder()
                .collapseKey(pnsCollapseKey)
                .timeToLive(86400)
                .addData(title,msgTitle)
                .addData("content",msgContent)
                .build();
    try
    {
        MulticastResult result = sender.send(message, androidDeviceIds, 5);
        if (result.getResults() != null) 
        {
            int failureMsgs = result.getFailure();
            int canonicalRegId = result.getCanonicalIds();
            List<Result> multicastResults = result.getResults();
            Boolean flag =true;
            int total;
            if(failureMsgs != 0 || canonicalRegId != 0)
            {

                for(total = 0;flag;total++)
                {
                    if(canonicalRegId != 0)
                    {
                        String tempCanId = multicastResults.get(total).getCanonicalRegistrationId(); 
                        if( tempCanId != null)
                        {
                            if(androidPNSEntityHandler.deleteDuplicate(androidDeviceIds.get(total), tempCanId))
                                canonicalRegId--;
                        }
                    }
                    if(failureMsgs != 0)
                    {
                        if(multicastResults.get(total).getErrorCodeName().equals(Constants.ERROR_NOT_REGISTERED))
                        {
                            if(androidPNSEntityHandler.deleteUid(androidDeviceIds.get(total)));
                            failureMsgs--;
                        }
                    }
                    if(canonicalRegId == 0 && failureMsgs == 0)
                        flag = false;
                }

            }

        }

    }catch (java.lang.IllegalArgumentException e)
    {
        e.printStackTrace();
    }catch (InvalidRequestException e)
    {
        e.printStackTrace();
    }catch (java.io.IOException e)
    {
        e.printStackTrace();
    }catch (Exception e) 
    {
        e.printStackTrace();
    }
}

Please guide me in resolving this issue…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:07:24+00:00Added an answer on June 13, 2026 at 12:07 pm

    The docs make it quite clear that 1000 is the limit:

    registration_ids

    A string array with the list of devices (registration IDs) receiving
    the message. It must contain at least 1 and at most 1000
    registration IDs. To send a multicast message, you must use JSON. For
    sending a single message to a single device, you could use a JSON
    object with just 1 registration id, or plain text (see below).
    Required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A few days ago, I had an issue with ASP.Net threading. I wanted to
A few days ago a friend and I were playing around with the Javascript
few days ago, when I was debugging an Android project under eclipse I've found
Few days ago I had to reinstall all my Linux system, and I also
I lost my temper few days ago because of this simple problem. Can you
I have started a new app a few days ago and began working with
A few days ago, I had a problem with a script dealing with a
A few days ago, I started working with cocos2d. I really like the framework.
A few days ago I've discovered that singleton can become anti-pattern in Android. My
A few days ago my friend told me about the situation, they had in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.