Page 1 of 1

I would love to see this livecode tutorial actually work

Posted: Tue Nov 04, 2014 6:41 am
by William Jamieson
Here is the tutorial on using push messaging with Android
http://lessons.runrev.com/m/4069/l/5931 ... h-android-
***Also attached a sample stack with a valid ID and authkey***

If you download their stack, and look at the links they posted in the comments, you will see that the code in the app has been deprecated by Google for years now. I just don't see how it is suppose to work. Google says
C2DM will accept no new users
I think this is ok since in the api, they use the new GCM endpoint.

Here is the authentication documentation from Google.
https://developers.google.com/accounts/ ... talledApps

In the Livecode API, one of the parameters is called "service", it is set to "ac2dm" which the above says they are not accepting any more users. Is there not a more updated way to enable push messaging with Livecode? Is there a way to get this old deprecated service to work? If I do get it working, how long will it work for?

These are all questions we can ponder upon. Has anyone else tried getting push notifications to work with Android?

-Will

Re: I would love to see this livecode tutorial actually work

Posted: Thu Nov 06, 2014 11:47 am
by LCNeil
Hi William,

The push notification lessons should still work as expected as the lesson does make reference to GCM and not C2DM. The same can be said for the handlers in the sample stack as they will work when authenticating with Googles clientLogin system.

I was able to test this by creating a new google account, following the steps in the lesson to enable GCM and then setting up the sample stack as instructed. This resulted in a message sent and message id from within the sample stack. Please see the below screenshot.
Screen Shot 2014-11-06 at 10.44.57.png
Google seem to have upped their game in relation to security, so one additional step that I had to do with this account was enable 2 step verification and create an "App Password" from the security section of my Google account.

I hope this gives you some leads.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.runrev.com
--

Re: I would love to see this livecode tutorial actually work

Posted: Sat Nov 08, 2014 1:38 am
by William Jamieson
Wow. That is a really cool screenshot. Mine doesn't look that good.

Here is what is happening with the downloaded version of the application with no modifications.
Screenshot_2014-11-07-16-02-44.png
Here is the form data that is posted to the endpoint URL
accountType=HOSTED_OR_GOOGLE&Email=thedatingprotectionapp%40gmail.com&Passwd=Dating101&service=ac2dm&source=c2dmLibrary
***Note that there is multiple parameters being passed to google with the term "c2dm"***

Here is the response:
Error=BadAuthentication
Url=https://www.google.com/accounts/Continu ... 5a46Yq3Btg
Info=WebLoginRequired
Now you can see the credentials in the Form data. The google account was set up for testing.

I created the project like how in the tutorial it said to do, I put the API key into the respective field. I then tried to run the script on Android and Windows and received the same error. I think I am missing something that was not explained. I feel like there is more to it.

For example, there is no parameter that says which phone to send the push to. Without the phone ID, how does it know where to send the push message?
Also, you mentioned that there is an additional security key needed? What is this additional security key?

Also, what are the standalone application settings for you?
I put the project ID number into the push sender ID field
I put "sign for development" only into the signing field

I did not upload the SDK to the Google Play store and do not know if this is necessary before using push notifications.

Please let me know if you see anything off in my testing. Thank you!

Cheers,

-Will

Re: I would love to see this livecode tutorial actually work

Posted: Sat Nov 08, 2014 2:23 am
by William Jamieson
I found a good link on how to do it through PHP and it is many pages long of directions and code examples.
I feel like the process of creating the notification takes a little more effort, but maybe that is all considered for since we are using Livecode...

http://www.androidhive.info/2012/10/and ... and-mysql/
gcm-a-modr.png
Let me know what you think.

-Will

Re: I would love to see this livecode tutorial actually work

Posted: Mon Nov 10, 2014 6:35 pm
by LCNeil
Hi Will,

Each token that is created by pushNotificationRegistered will give you the ability to send messages to an individual devices. This token is entered within the push test app after you have successfully communicated with the Google servers in the sample send push notification app. As you are receiving the "communication failed" error, you are not yet reaching the stage of entering this token.

LiveCode only provides a means of receiving push notifications within your application and it is up to the end user what method is used for sending push notifications. The example you provided uses a combination of mySql and PHP to send the notification. Our example, provided in the lesson, is a very simple system that is really only intended to illustrate how a push notification can be sent from LiveCode. Although it should work on Android, its intended use was to send push notifications from the desktop platform.

The ac2dm & c2dmLibrary parameters that are being passed are required for our method of showing how push notifications can be sent. Parameters such as these will really depend on the method you use to send the push.

Please find below, a link to a step-by-step tutorial on how to use the Android Push lesson. The video goes from initial setup of a Google account all the way through security and to eventually sending the push notification.

I hope you find the video useful :)

http://techsupport.on-rev.com/sostacks/ ... al.mp4.zip

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.runrev.com
--

Re: I would love to see this livecode tutorial actually work

Posted: Mon Nov 10, 2014 11:37 pm
by William Jamieson
Wow. That was really cool. Might be one of my favorite movies of all time up next to Avatar and Rush Hour 2.

You freakin ROCK Neil!!

Thank you so much for taking the time to make that video. I appreciate the help. I don't know if I would have ever thought to create a second password. Cool stuff.

Cheers,

-Will

Re: I would love to see this livecode tutorial actually work

Posted: Tue Nov 11, 2014 12:00 am
by LCNeil
Glad I was able to help although I don't think my video is going to win any oscars :)

Its good to know where to point our user too if they run into a similar issue in the future as the second password step was previously not needed for the lesson.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.runrev.com
--