Build error with a hello world app using parse4cn1 and Parse push services

57 views
Skip to first unread message

Marco Gioia

unread,
Nov 23, 2015, 10:43:57 AM11/23/15
to CodenameOne Discussions
Hi,
as test, I'm trying to implement basic push notifications to the Hello World (manual) default cn1 app project.
I'm following this guide :
assuming what I need to implement it is just what said here

Ends up I get this build error :

This is my files tree if it can help:






















































Thank you

sidiabale

unread,
Nov 23, 2015, 7:11:57 PM11/23/15
to CodenameOne Discussions
Hi,

You need to add parse4cn1.cn1lib to your project's \lib directory not parse4cn1.jar. That's most likely the cause of the build errors.

sidiabale

unread,
Nov 23, 2015, 7:15:18 PM11/23/15
to CodenameOne Discussions
The same remark applies to CN1JSON.jar which should be CN1JSON.cn1lib

Marco Gioia

unread,
Nov 23, 2015, 8:38:26 PM11/23/15
to CodenameOne Discussions

sidiabale

unread,
Nov 24, 2015, 5:13:45 PM11/24/15
to CodenameOne Discussions
Hi,

This is rather strange. I just downloaded Eclipse and created a similar project to the one you showed, performed the parse push Android setup explained on the parse4cn1 wiki and my Android build compiled successfully. That was after a successful build using Netbeans. A few things:
  • Did you refresh libs after adding the .cn1lib files (Right-click on your project and select "CodenameOne" >> "Refresh Libs")?
  • What version of the CN1 plugin are you using?
  • What version of parse4cn1 are you using?
  • Can you send me a zip of your project so I can check further for issues if you're still encountering the same problem?

Marco Gioia

unread,
Nov 24, 2015, 8:32:04 PM11/24/15
to CodenameOne Discussions
After refreshing libs I could get it to build.
Weird, because anytime I tried to send a build to the server with outdated libs it would give me a warning and just update them automatically.

Anyway, I still can't get it to show me the test push notification I send from here, but actually I get the device registered.

If what I want is just to show push notifications when sent (regardless of app opened or not), without anything particular happening when I open them, is that parse push Android setup enough or I do have to build more code around it?

sidiabale

unread,
Nov 25, 2015, 3:57:48 AM11/25/15
to CodenameOne Discussions
Hi,

At least we've made some progress. As far as I understand, you see your device registered as a ParseInstallation in the Parse dashboard but you're not receiving pushes, right?
  • I'm assuming you've followed all the setup steps like creating the application class, setting up the push service and permissions via build hints, right? Did you double check that you're using the correct package names in the build hints?
  • What happens when you try sending a push notification from the Parse dashboard? Is the size of your 'Everyone' audience must be greater than 1?
  • What's the state of your app when you send the push messages: Foreground, background or not running? By design of the Parse Android SDK, push messages will NOT be delivered to an app that was force killed.
It's a bit difficult to remotely tell what's going wrong. If you're still stuck, can you email me your project as a zip file so I can inspect it further? That's easier for me.

Marco Gioia

unread,
Nov 25, 2015, 7:54:06 AM11/25/15
to CodenameOne Discussions
Hi,
yes



- yes
- "Everyone" has size 1, when I send from the dashboard the status goes to "Succeeded" but "Pushes Sent" remains to 0, and I still don't receive anything on the phone
- I tried with every state, it still won't show anything.

I'll e-mail you soon with a mega.co.nz link (I'll upload everything, including the lib folder)

Thanks for your support

sidiabale

unread,
Nov 25, 2015, 11:20:28 AM11/25/15
to CodenameOne Discussions
Hi,

I found the problem. The ParseInstallation is missing important fields deviceToken and pushType. After inspecting the zip you sent, I see that you made a typo in the permissions which is responsible for the problem

com.test.pushTest.name.permission.C2D_MESSAGE should be com.test.pushTest.permission.C2D_MESSAGE in your android.xpermissions build hint.

I tried using my own Parse test credentials and with that fix, the deviceToken and pushType are filled and I'm able to receive push messages. By the way, I see that your using the custom CN1ParsePushBroadcastReceiver. Bear in mind that this is an overkill for your simple use case and might result in unexpected behavior. The implemenetatio

PS: This is a useful finding and I'll add it to the troubleshooting section. I'll also make it more difficult to make such typos by changing the format of the placeholders on the wiki
Reply all
Reply to author
Forward
0 new messages