Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,729,557 Members 46,782 Now Online
XDA Developers Android and Mobile Development Forum

Registering devices with GCM error

Tip us?
 
mur762
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 4
Join Date: Apr 2008
Default Registering devices with GCM error

Hello everybody,

I'm experimenting with Google Cloud Messaging and I was following the tutorial at https :// github. com/ GoogleCloudPlatform/gradle-appengine-templates/blob/master/GcmEndpoints/README.md (I beg pardon but I can't post links). Unfortunately I spent the last two days struggling with solving all the dependencies but I still miss one.

In this code (taken from the tutorial at point 2.2) I cannot resolve the class "Registration"; I've been trying looking for it but given such a vague name I got back millions results that had little to do with my problem.

I also tried to add to my project all the suggested libraries but none of them contained the class I need.

Code:
        
    public GcmRegistrationAsyncTask() {
        Registration.Builder builder = new Registration.Builder(AndroidHttp.newCompatibleTransport(), new AndroidJsonFactory(), null)
            // Need setRootUrl and setGoogleClientRequestInitializer only for local testing, otherwise they can be skipped
            .setRootUrl("h t t p : / / 10.0.2.2:8080/_ah/api/")
            .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
                @Override
                public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
                    abstractGoogleClientRequest.setDisableGZipContent(true);
                }
            });
            // end of optional local run code

        regService = builder.build();
    }
Could somebody point me in the right direction?

Thanks in advance for the help!

Bye
Mario
 
thvranken
Old
#2  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Feb 2011
I was just following the same instructions today and I am experiencing the same problem unfortunately.
 
mur762
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 4
Join Date: Apr 2008
Quote:
Originally Posted by thvranken View Post
I was just following the same instructions today and I am experiencing the same problem unfortunately.
Well, at least it means probably we are not dumb

At any rate if I should find something I'll post it here so it's available to whoever needs it and pls do the same...
 
Jonny
Old
#4  
Jonny's Avatar
Forum Moderator
Thanks Meter 7812
Posts: 7,821
Join Date: Jul 2011
Location: Cheshire

 
DONATE TO ME
Hmm.. I couldn't find a "Registration" class or import anywhere in their source code so it may be included in one of the dependencies, try checking your build.gradle files against the one given in their source code to check for the correct dependencies.

In any case, their method is (IMO) an extremely weird and complicated way of doing something very simple, if you haven't found the solution by Monday (when I should have more free time) I'll put together a package (including the html/php/MySQL server back-end files) with how I managed to do GCM messaging (which includes multicast messages)
 
mur762
Old
#5  
Junior Member - OP
Thanks Meter 0
Posts: 4
Join Date: Apr 2008
Quote:
Originally Posted by Jonny View Post
Hmm.. I couldn't find a "Registration" class or import anywhere in their source code so it may be included in one of the dependencies, try checking your build.gradle files against the one given in their source code to check for the correct dependencies.

In any case, their method is (IMO) an extremely weird and complicated way of doing something very simple, if you haven't found the solution by Monday (when I should have more free time) I'll put together a package (including the html/php/MySQL server back-end files) with how I managed to do GCM messaging (which includes multicast messages)
Hi Jonny, tnx for taking time and having a look! I checked the gradle file but it seemed everything in order...

At any rate I started studying better the code (I should have done it earlier actually) and noted that in the backend Android Studio created before a class with the methods I invoke in the app and before the declaration there is annotation:

Code:
@Api(name = "registration", version = "v1", namespace = @ApiNamespace(ownerDomain = "backend.rtalert.rt_finance.com", ownerName = "backend.rtalert.rt_finance.com", packagePath=""))
public class RegistrationEndpoint {

    private static final Logger log = Logger.getLogger(RegistrationEndpoint.class.getName());
Now, searching on the web seems like I would somehow need to compile the backend module and import it as a lib into my app (despite is all within the same project). I imported both the zip file and the discovery one and then synced gradle, but still nothing.

Tomorrow after a few hours sleep I'll try again...

Good night
Mario
 
Jonny
Old
#6  
Jonny's Avatar
Forum Moderator
Thanks Meter 7812
Posts: 7,821
Join Date: Jul 2011
Location: Cheshire

 
DONATE TO ME
Ok apologies for being a bit late, life's been busier than I was expecting over the last few days...

Anyway, the web server files are all located in the following zip file >>> http://darkforest-roms.co.uk/Misc/An...dMessaging.zip

There is also a table.txt file that contains the MySQL database base table I'm using - the setup is for an app for my school where the staff can send messages to individual year groups or to all year groups.

Assuming whatever webhosting service you are using has phpMyAdmin or similar you can just change the table columns in the table.txt file and import it. Then you need to go through register.php, update.php, possibly unregister.php and index.php to modify the website code to your specific application.

You will also need to edit the parameters in config.php for your Google API key and database name, user and password.

Thats it for the website side code, give me a couple of days to sort out the app-side java code, I need to modify some stuff in my current code before uploading it
 
mur762
Old
#7  
Junior Member - OP
Thanks Meter 0
Posts: 4
Join Date: Apr 2008
Quote:
Originally Posted by Jonny View Post
Ok apologies for being a bit late, life's been busier than I was expecting over the last few days...

Anyway, the web server files are all located in the following zip file >>> [

There is also a table.txt file that contains the MySQL database base table I'm using - the setup is for an app for my school where the staff can send messages to individual year groups or to all year groups.

Assuming whatever webhosting service you are using has phpMyAdmin or similar you can just change the table columns in the table.txt file and import it. Then you need to go through register.php, update.php, possibly unregister.php and index.php to modify the website code to your specific application.

You will also need to edit the parameters in config.php for your Google API key and database name, user and password.

Thats it for the website side code, give me a couple of days to sort out the app-side java code, I need to modify some stuff in my current code before uploading it
Hi Jonny, don't worry, I was quite busy these days myself, plus I really appeciate your help... In the weekend I'll set it up so I can test it and let you know...

Thanks again
Mario

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Make Your Own DIY Capacitive Stylus

The XDA Portal is a place where we like to talkabout things that are interesting, fun, and sometimes … more

Remove Unnecessary WhatsApp Elements with Xposed

In modern life, you can’t underestimate the power ofthe dark sidemessaging … more