android - Mobile backend starter continuous query never returns -


i've written android client mobile backend starter app according this tutorial. works section implementing continuous queries.

i've written query , i'm calling correct place in code (onpostcreate()), query never returns data.

i don't believe authentication problem because i'm able make other calls successfully.

here code never returns result:

cloudcallbackhandler<list<cloudentity>> handler = new cloudcallbackhandler<list<cloudentity>>() {         @override         public void oncomplete(list<cloudentity> results) {             (cloudentity entity : results) {                 userlocation loc = new userlocation(entity);                 muserlocations.remove(loc);                 muserlocations.add(loc);                 drawmarkers();             }         }          @override         public void onerror(ioexception e) {             toast.maketext(getapplicationcontext(), e.getmessage(),                     toast.length_long).show();         }     };      cloudquery query = new cloudquery("userlocation");     query.setlimit(50);     query.setsort(cloudentity.prop_updated_at, order.desc);     query.setscope(scope.future_and_past);     getcloudbackend().list(query, handler); 

with debugger i've verified getcloudbackend().list() line executes, oncomplete() method never hit, , neither onerror().

here example of call works perfectly:

userlocation self = new userlocation(super.getaccountname(),                 gh.encode(mcurrentlocation));         getcloudbackend().update(self.asentity(), updatehandler); 

essentially, getcloudbackend().update() works, while getcloudbackend().list() not.

i should add i've downloaded full source github repo linked in tutorial, , same problem exists code. i've tried re-deploying backend server multiple times.

ok have fixed problem! issue both in manifest , in class gcmintentservice.java

in manifest gcm registered service , belongs package. default service part of default package com.google.cloud.backend.android. when create new package , have client code in there, need move gcmintentservice.java class new package , in manifest modify service , broadcast receiver

<service android:name="yourpackagename.gcmintentservice" /> <receiver         android:name="com.google.android.gcm.gcmbroadcastreceiver"         android:permission="com.google.android.c2dm.permission.send" >         <intent-filter>             <action android:name="com.google.android.c2dm.intent.receive" />             <action android:name="com.google.android.c2dm.intent.registration" />              <category android:name="yourpackagename" />         </intent-filter>     </receiver> 

any other permission comes default package name should updated main package name. doesn't need modified if you're going use 1 default package comes mobile backend starter.

regarding googleauthioexception received initially. redid steps enable gcm , authentication. things keep in mind though still followed tutorial , went web application -> generic when registering gcm server key , web client id. key thing keep in mind when registering android client id sha1 fingerprint needs package name. again package name has main client package if you're using more 1 package project. can project number goes in consts.java (and it's required register gcm) old google api console , project id new cloud console. web client id goes in consts.java file , in same file have enable auth changing

public static final boolean is_auth_enabled = false; 

to

public static final boolean is_auth_enabled = true; 

hope helps.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -