<div dir="ltr">1) You should be creating the PushRegistrar object in a static block in your activity OR in the onCreate method of your Application (also make sure you have subclassed application and set that class to the name property of your application in your AndroidManifest.)<div><br></div><div>2) You need to also make sure that register() is called before unregister().  If Android kills your application you will need to call register to call unregister.  It is a bit counter intuitive but it keeps your registration state in sync with GCM so that you are properly unregistered.</div><div><br></div><div>3) Do you have a github we can take a look at with the project in it?  </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 12:56 PM, alan10fm <span dir="ltr">&lt;<a href="mailto:alan10fm@gmail.com" target="_blank">alan10fm@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everybody.<br>
<br>
I am making an android app using unified push server and Openshift.<br>
I am using the code in the next link to register my devices<br>
<a href="https://aerogear.org/docs/guides/aerogear-android/push/" rel="noreferrer" target="_blank">https://aerogear.org/docs/guides/aerogear-android/push/</a><br>
the register works good and i can receive push notification.<br>
My problem is when i want to unregister the device, when i register the<br>
device and i never close the app and i unregister the device it works but my<br>
issue is when i register my device and close the app, after relaunch the app<br>
when i try to unregister the device the app brokes because of a null pointer<br>
exception in this line<br>
registrar.unregister(getApplicationContext(), new Callback&lt;Void&gt;()<br>
because the registar object is null<br>
<br>
I have made a lot of combinations to recover the registar object but<br>
anything works the server returns me a 404 code error.<br>
In this link is my code:<br>
<a href="https://stackoverflow.com/questions/31363464/unregister-devices-aerogear" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/31363464/unregister-devices-aerogear</a><br>
<br>
I will appreciate any help with this.<br>
--<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://aerogear-users.1116366.n5.nabble.com/Issues-unregistering-from-server-tp140.html" rel="noreferrer" target="_blank">http://aerogear-users.1116366.n5.nabble.com/Issues-unregistering-from-server-tp140.html</a><br>
Sent from the aerogear-users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
</blockquote></div><br></div>