Gaming Console with Lollipop? Ouya Gets an Android TV Port

Android is a very flexible platform, and it can be used on a large variety of … more

Android App Review: Manage Your Connections Automagically – XDA TV

Material Design is all the buzz in the Android world right now. … more

Official TWRP Recovery Lands on Micromax Canvas Magnus

With the recent release of Android One, Micromax and MediaTek released fully buildable … more

Update Overload: SuperSU Heavily Updated

There are apps and apps out there. Very few can reach the level of popularity required to stay at … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Registering devices with GCM error

OP mur762

28th June 2014, 09:18 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
4 posts
Join Date:Joined: Apr 2008
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
28th June 2014, 09:54 PM   |  #2  
Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Feb 2011
I was just following the same instructions today and I am experiencing the same problem unfortunately.
28th June 2014, 09:59 PM   |  #3  
OP Junior Member
Thanks Meter: 0
 
4 posts
Join Date:Joined: Apr 2008
Quote:
Originally Posted by thvranken

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...
28th June 2014, 11:35 PM   |  #4  
Jonny's Avatar
Forum Moderator
Flag Cheshire
Thanks Meter: 8,193
 
8,097 posts
Join Date:Joined: Jul 2011
Donate to Me
More
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)
29th June 2014, 03:12 AM   |  #5  
OP Junior Member
Thanks Meter: 0
 
4 posts
Join Date:Joined: Apr 2008
Quote:
Originally Posted by Jonny

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
2nd July 2014, 08:23 PM   |  #6  
Jonny's Avatar
Forum Moderator
Flag Cheshire
Thanks Meter: 8,193
 
8,097 posts
Join Date:Joined: Jul 2011
Donate to Me
More
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
4th July 2014, 12:37 PM   |  #7  
OP Junior Member
Thanks Meter: 0
 
4 posts
Join Date:Joined: Apr 2008
Quote:
Originally Posted by Jonny

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
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes