Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 9
Registered: ‎01-24-2012
My Device: 9700
My Carrier: MTN

Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

[ Edited ]

Im trying to register a device for push notifications but I get timeout when running the URL.

In the following function the Variable "response" prints an empty string.

 

I've checked my Base URL, CPID  and App Id and they are correct.

 

If I run the URL in the browser I get a timeout,(dont know if it should have a response with http://cpXXXX.pushapi.eval.blackberry.com or http://pushapi.eval.blackberry.com in a browser) neither work.

 

My test device has got BIS and it still won't register.

The device is running os 6,  and is a 9780.

 

I've added the formRegisterRequest function too.

 

Any help will be appreciated.

 

 

    private void registerBpas() {
        
        final String registerUrl = formRegisterRequest(BPAS_URL, APP_ID, null) + CONNECTION_SUFFIX;
        new Thread() {
            public void run() {
                try {
                    System.out.println("registerUrl = " + registerUrl);
                    HttpConnection httpConnection = (HttpConnection) Connector.open(registerUrl);
                    InputStream is = httpConnection.openInputStream();
                    String response = new String(IOUtilities.streamToBytes(is));
                    close(httpConnection, is, null);
                    String nextUrl = formRegisterRequest(BPAS_URL, APP_ID, response) + CONNECTION_SUFFIX;
                    System.out.println("Next URL = " + nextUrl);
                    HttpConnection nextHttpConnection = (HttpConnection) Connector.open(nextUrl);
                    InputStream nextInputStream = nextHttpConnection.openInputStream();
                    response = new String(IOUtilities.streamToBytes(nextInputStream));
                    System.out.println("response = " + response);
                    close(nextHttpConnection, is, null);
                    if (REGISTER_SUCCESSFUL.equals(response) || USER_ALREADY_SUBSCRIBED.equals(response)) {
                        System.out.println("Registered successfully for BIS push");
                    } else {;
                        System.out.println("BPAS rejected registration");
                    }
                } catch (IOException e) {
                    System.out.println("IOException on register() " + e + " " + e.getMessage());
                }
            }
        }.start();
    }

 

 

    private String formRegisterRequest(String bpasUrl, String appId, String token) {
        StringBuffer sb = new StringBuffer(bpasUrl);
        sb.append("/mss/PD_subReg?");
        sb.append("serviceid=").append(appId);
        sb.append("&osversion=").append(DeviceInfo.getSoftwareVersion());
        sb.append("&model=").append(DeviceInfo.getDeviceName());
        if (token != null && token.length() > 0) {
            sb.append("&").append(token);
        }
        return sb.toString();
    }

 

 

New Contributor
Posts: 9
Registered: ‎01-24-2012
My Device: 9700
My Carrier: MTN

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Does anyone, have any direction I can go in to fix this problem??
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi,

 

Have you checked this?

 

http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Simplified-BIS-Push-client-sample...

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
New Contributor
Posts: 9
Registered: ‎01-24-2012
My Device: 9700
My Carrier: MTN

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi Kanak Sony.

 

Thanks for the help.


I have had a look at the link sent and that was what I based my code on,

I've havent found much to help me fix the problem,

I have checked the evaluation credentials sent by RIM and they are correct.

I've implemented the PushAgent class about two weeks ago and when I ran it I 

had a successfull Push Registration, so I left it and added some other functionality to the app

but 4 days ago I tested push and the registration failed.

 

In the  registerBpas  function the resonse string is now always empty, what does this mean.

I'm not getting any response codes from the RIM registration server, so I dont know where to begin.

 

I don't understand how it worked two weeks ago and now it returns nothing.

 

I don't know what else to do to try diagnose the problem.

Any suggestions will be appreciated.

 

Thank you

Brett

 

 

 

 

 

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi Brett,

 

Could you check that no other copies of the application exist on the device when registration is attempted?

Which line is failing? I am assuming the connection line, but want to be certain.

Also, it would be good to go right back to the original sample application, run it and see if it works as expected which may help pinpoint the issue.

 

When did you receive your EVAL credentials? They are only valid for 4 months.

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
Posts: 9
Registered: ‎01-24-2012
My Device: 9700
My Carrier: MTN

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi Garett

 

Thanks for you reply.

 

I have made sure there are no other apps on the device and it still does the same thing.

It's not really failing but in the check --

 

 

if (REGISTER_SUCCESSFUL.equals(response) || USER_ALREADY_SUBSCRIBED.equals(response)) {

 

the response string is empty so it goes to the else and says BPAS rejected registration.

 

My Eval credentials were received about 3 weeks ago so should be fine.

 

I've tried the Sample app in the SDK but it needs the Content provider URL and we are using the BB Push infrastructure, so im not sure what to use for the Content Provider URL to test.

 

Thanks

Brett

 

 

 

 

 

 

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi Brett,

 

The Content Provider URL is used for registering the device with your server-side application. You can remove this logic for testing, the only thing you need is the PPG registration with BIS.

Garett
@garettBeuk
--
Goodbye everybody!
Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Also, I just wanted to confirm that from the device-side you should be using this URL:
http://pushapi.eval.blackberry.com/

It is not meant to work from the browser.
Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
Posts: 9
Registered: ‎01-24-2012
My Device: 9700
My Carrier: MTN

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi Garret

 

Sorry for the delayed reply, been working on the Sample app and my app.

 

Yes I am using http://pushapi.eval.blackberry.com/ on the device side.

 

What I have found is:

If I use the  HttpConnection getResponseCode(); function in both the sample app and my app

they return 503.

the Page:

http://www.blackberry.com/developers/docs/4.0api/javax/microedition/io/HttpConnection.html

 

says "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server." for response code 503

 

Has there perhaps been a change for registration and I'm still doing it an old way?

 

Thanks again for you time.

Brett

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Push, BPAS rejected registration, timeout on http://cpXXXX.pushapi.eval.blackberry.com

Hi Brett,

 

Nope, nothing has changed with the way you should be registering. I have engaged the Push Services team to investigate the EVAL server and see if there may be something there causing the issue. I am in transit today but will try to respond if I hear back on the issue, if not I will follow up Monday at the latest.

 

Cheers,

Garett
@garettBeuk
--
Goodbye everybody!