Search code examples
javaandroidcodenameone

Push notification not working on android codenameone


I followed this tutorial https://www.codenameone.com/manual/push.html and registered my application with Display.getInstance().registerPush();

I am doing tests with a rest post

curl --location --request POST 'https://push.codenameone.com/push/push?token=34C35DCB-XXX-4A56-XXXX-XXXXXX&device=cn1-fcm-e9Xvk0mdGdc:APAXXXXX-XXXXXXXXXX-7-z3Ax7HNkeEvcvCl3_1zQdBbxurWcUSMenXFJgM2w0UTRE0ziUz_N7TIzxOOblktGSPsEmCH7q09pJQJ1v0mQZO7LNvyP4UEOlsdRds&auth=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&type=3&body=test' 

I am getting this answer:

[
    {
        "id": "XXXXXXXXXXXXXXXXXXXXXX",
        "status": "OK"
    }
]

But nothing on the phone. I have to mention that the app was installed as APK not from the play store


Solution

  • Type 3 is a mix of hidden and visible types. Try type 1 which is 100% visible push notification or if you use type 3 use a semicolon to separate the hidden payload and the visible portion in your data.

    See this under "Push Types and Message Structure".