question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Push not being recieved by devices anymore

See original GitHub issue

Hi there,

We are using this plugin on Google App Engine with a Cloud Endpoints project.

Several months back when we were testing the integration the push messages were sending.

We have not made any major modifications to our push code and now the messages are not sending.

The App Engine logs show:

GatewayConnection APNS connection establishing...
GatewayConnection APNS connection established
GatewayConnection APNS connection closed

and does not report any 500 errors or SSL/key errors. But the message is not received by the phone.

We are also getting “Deadline Exceeded Errors” at least one of the times we tried.

Our keys are signed correctly using this process:

in keychain access, select both cert and key then export to Certificates.p12 file.

to generate cert.pem openssl pkcs12 -in Certificates.p12 -out cert.pem -nodes -nokeys

to generate key.pem openssl pkcs12 -in Certificates.p12 -out key.pem -nodes -nocerts

Our push code is copied directly from the instructions:


def send_single_push(u, payload):

    apns = get_apns_handler(False)

    # Send multiple notifications in a single transmission
    frame = Frame()
    identifier = 1
    expiry = time.time()+3600
    priority = 10

    pa = PushAlias.query(PushAlias.user == u.key).fetch(1)

    if pa:
        pa = pa[0]

    bc = PushBadgeCount.query(PushBadgeCount.alias == pa.key).fetch(1)

    if bc:
        bc = bc[0]

    # Increase the badge count
    bc.badge_count += 1
    bc.put()

    # Set the payload data and badge count
    apns_payload = Payload(
        alert=payload['alert'],
        sound=payload['sound'] if payload.has_key('sound') and payload['sound'] else "default",
        badge=bc.badge_count
    )

    # Add a push to the frame for each device in the alias
    for device in pa.devices:
        frame.add_item(device, apns_payload, identifier, expiry, priority)

    if get_environment() != 'sandbox':
        try:
            apns.gateway_server.send_notification_multiple(frame)
        except:
            # Force re-connect
            apns.gateway_server._connect()

        return False, None

We are mimicking Urban Airship like functionality.

And the keys are set as such:


def get_apns_handler(enhanced=False):

    sandbox = True
    cert = APNS_CERT_SANDBOX
    pem = APNS_PEM_SANDBOX

    # if get_environment() == 'prod':
    #     sandbox = False
    #     cert = APNS_CERT_PRODUCTION
    #     pem = APNS_PEM_PRODUCTION

    return APNs(use_sandbox=sandbox, cert_file=cert, key_file=pem, enhanced=enhanced)

We are using Googles own SSL library via the app.yaml:


libraries:
    - name: ssl
      version: latest

Any help would be greatly appreciated. Let me know if you need more information.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
gregorskiicommented, Feb 28, 2015

Resolved by using enhanced=True

0reactions
gregorskiicommented, Feb 26, 2015

I changed enhanced mode to True and the pushes started sending. Can anyone explain why enhanced False and enhanced True would cause this to happen?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Can I Do If Someone Is Not Receiving Push Notifications?
If push notifications are not being received on a smartphone or tablet, try the following troubleshooting steps. Important: Microsoft.
Read more >
Push notifications stopped being d… | Apple Developer Forums
Push notifications stopped being delivered to some devices · 1) Checked logs. - payloads are pushed without errors · 2) Developer portal ->...
Read more >
Why is my device not receiving push notifications on Android?
If you are not receiving any of the notifications sent from Batch, here are some suggestions to find the issue. Keep in mind...
Read more >
Android Notifications Not Showing Up? 10 Fixes You Can Try
Not seeing notifications show up on your Android phone? Try these fixes to get Android notifications working again.
Read more >
Troubleshooting Web Push Notifications: Why I'm I not Getting ...
You have an extension such as an ad blocker which blocks receiving push notifications; You have reset the settings of the browser, that's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found