<div dir="ltr"><div><font size="4">Hi Summers,<br>following your notes, I found some tutorials about hot to modify a plugin Java source code (and, againg, I&#39;d like to thank you for this). Comparing them, I thought the best approach was to remove the plugin and after add it again (specifying this time in the “cordova plugin add” command a folder in my filesystem containing the plugin) after having modified the source code related to the bug fix. <br><br>Using aerogear cordova plugin forces me to do something similar trying to generate apk/ipa using Intel XDK environment because the build process does not like a reference to src/android/dependencies.gradle in plugin.xml file (so I have the remove the plugin, download it locally, hide the reference, then add the plugin again by specifying a local folder in Intel XDK interface).<br><br>The first question is: can I use my &quot;new/modified&quot; plugin “easily” or should I worry about some license violations?  If you have suggested me to try myself to modify plugin behavior in order to fix the null pointer exception problem, can I presume I can use the plugin even after making it different from your baseline version?<br><br>Second point. I’m gonna describe the changes I’ve applied to the Java code, which are quite similar to what you told me with those links. It seems now the plugin works correctly but we&#39;ll continue to test it to be sure. May you confirm however this could be the right solution?<br><br>In <i>PushHandlerActivity.java</i> I modified the following source line:<br><br><i>Store&lt;Message&gt; store = DataManager.getStore(&quot;messageStore&quot;);</i><br><br>with these:<br><br><i>SQLStore&lt;Message&gt; store = (SQLStore&lt;Message&gt;)DataManager.getStore(&quot;messageStore&quot;);<br>if (store == null) {<br>    store = (SQLStore&lt;Message&gt;) DataManager.config(&quot;messageStore&quot;,       SQLStoreConfiguration.class).withContext(this.getApplicationContext()).store(Message.class);<br>    store.openSync();<br>}    <br></i><br>As you can see, I changed the store type from Store&lt;Message&gt; to SQLStore&lt;Message&gt; to alline it with the source code in NotificationMessageHandler.java. Moreover, because I needed a context object, I resolved the context by invoking <i>this.getApplicationContext()</i> (such it was an activity class). Just for completeness, I introduced the needed imports in the right section for SQLStore and SQLStoreConfiguration.<br>To avoid some other null pointer exception troubles, I added another not null check before cycling the message collection. Now the cycle starts if and only if collection is not null. <br><br><i>if(collection!=null){    for (Message message : collection){ ... .... }   }    </i><br><br>Do you think there’s something wrong or something I’ve not evaluated applying these changes? As usually, and before closing this mail, I’d like to thank you again: your help has been important to facilitate us some precious steps. Thanks so for all your support.<br><br></font></div><font size="4">Just a last thing. Let&#39;s image all these changes are correct; in some of your last messages you told me to send eventually a pull request. How can I do it? This should be really all.<br></font><div><font size="4"><br>Federico<br></font><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-21 8:37 GMT+02:00 Federico Cerminara <span dir="ltr">&lt;<a href="mailto:fedecentrico@gmail.com" target="_blank">fedecentrico@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Summers,<br></div>I&#39;d like to thank you for all your important support.<br></div>I&#39;m gonna have a look at Cordova developer docs.<br></div>Eventually I&#39;ll try to write you again if there are some specific question about the bug fix.<br></div>Have a nice day and thanks again for everything.<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Federico</font></span><div><div class="h5"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-04-20 17:43 GMT+02:00 Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Thu, Apr 20, 2017 at 10:42 AM, Federico Cerminara <span dir="ltr">&lt;<a href="mailto:fedecentrico@gmail.com" target="_blank">fedecentrico@gmail.com</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font size="4">Hi Summers, <br><span>even if I am not the bravest developer I know, the main trouble is the lack of time available to spend on this job. Before deciding internally how to face the problem, I&#39;d like to ask you if you&#39;ve already scheduled a fixing activity for this bug in a future release (and eventually which could be a date to have an official fix).<br>Instead, if you think the better approach is to trust on my bravery, I&#39;m here to ask you how I could recompile the plugin after applyng all the modifies it requires. What can you suggest me to do? Wait anyway for a future release or start testing a solution and after sending a pull request? <br><br></span></font></div></blockquote><div><br></div><div>Well it isn&#39;t my project so I can&#39;t make any timeline commitments.  However if you send a pull request it makes it easier to bundle a release.  </div><div><br></div><div>I suggest you read the Cordova developer docs to learn how to write a plugin, they teach you how to compile it for the various platforms as well.</div><div><div class="m_6948051893401159454h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font size="4">Thanks anyway, Federico.</font><div><div class="m_6948051893401159454m_-3200079237911935357h5"><br><br><br><div class="gmail_extra"><br><div class="gmail_quote">2017-04-20 15:24 GMT+02:00 Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-">On Thu, Apr 20, 2017 at 6:08 AM, Federico Cerminara <span dir="ltr">&lt;<a href="mailto:fedecentrico@gmail.com" target="_blank">fedecentrico@gmail.com</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hi Summers,<br></div><span class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-">first of all, i&#39;d like to thank you for your precious suggestion.<br></span></div><span class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-"><div>I managed to launch my app using Android Emulator and together with the logcat tool.<br></div><div>Thanks to this new approach, i was able to take some lines from the logcat stacktrace and now i can share them in the following.<br><br><i>04-20 11:35:44.861 31658 31658 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.jboss.aeroge<wbr>ar.android.cookbook.aerodoc/or<wbr>g.jboss.aerogear.cordova.push.<wbr>PushHandlerActivity}: java.lang.NullPointerException<wbr>: Attempt to invoke interface method &#39;java.util.Collection org.jboss.aerogear.android.sto<wbr>re.Store.readAll()&#39; on a null object reference<br><br>... ... ... <br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime: Caused by: java.lang.NullPointerException<wbr>: Attempt to invoke interface method &#39;java.util.Collection org.jboss.aerogear.android.sto<wbr>re.Store.readAll()&#39; on a null object reference<br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime:     at org.jboss.aerogear.cordova.pus<wbr>h.PushHandlerActivity.processP<wbr>ushBundle(PushHandlerActivity.<wbr>java:60)<br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime:     at org.jboss.aerogear.cordova.pus<wbr>h.PushHandlerActivity.onCreate<wbr>(PushHandlerActivity.java:45)<br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime:     at android.app.Activity.performCr<wbr>eate(Activity.java:6876)<br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime:     at <a href="http://android.app.Instrumentation.ca" target="_blank">android.app.Instrumentation.ca</a><wbr>llActivityOnCreate(Instrumenta<wbr>tion.java:1135)<br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime:     at android.app.ActivityThread.per<wbr>formLaunchActivity(ActivityThr<wbr>ead.java:3207)<br><br>04-20 11:35:44.861 31658 31658 E AndroidRuntime:     ... 9 more<br></i><br></div><div><span lang="EN-US"> As i wrote in the first mail, this is the app crash scenario. If I
have my app closed or already open, clicking on push notification seems to
behave correctly, bringing user to application first page. Instead, if I try to
close all my applications after receiving one or more push notification (image
notification frequency is quite low) and then I try to click on my waiting
push, application crashes showing a message that sound quite like this “The
program &lt;app_name&gt; has been interrupted”<br><br></span></div><div><span lang="EN-US">Reading the log stacktrace, it seems like there&#39;s a NPE in </span><i>PushHandlerActivity.java:60</i>, and more precisely when it tries to read the store content.<br></div><div>Now, I don&#39;t know if it&#39;s the right place to face the problem, of if I should open a ticket somewhere else, or if it&#39;s an already known and solved bug, or if eventually it&#39;s some kind of problem related to a wrong configuration in my app. Before losing me in all this wondering, can you suggest me what to do? Could i try directly to change the java code in the class PushHandlerActivity? Should it have effect, also eventually to make a test locally? <br><br></div></span></div></blockquote><div><br></div><div>So 1) I think we have this bug known already (<a href="https://issues.jboss.org/browse/AGCORDOVA-167" target="_blank">https://issues.jboss.org/brow<wbr>se/AGCORDOVA-167</a>), sorry about that.  </div><div><br></div><div>2) If you are feeling brave you can add the null/initialization check from here : </div><div><br></div><div>   <a href="https://github.com/aerogear/aerogear-cordova-push/blob/b313fcfb20708089f2e0bcb871e396f67ee2b1a5/src/android/org/jboss/aerogear/cordova/push/NotificationMessageHandler.java#L43" target="_blank">https://github.com/aerogear/a<wbr>erogear-cordova-push/blob/b313<wbr>fcfb20708089f2e0bcb871e396f67e<wbr>e2b1a5/src/android/org/jboss/a<wbr>erogear/cordova/push/Notificat<wbr>ionMessageHandler.java#L43</a><br></div><div><br></div><div>to here : </div><div><br></div><div>  <a href="https://github.com/aerogear/aerogear-cordova-push/blob/b313fcfb20708089f2e0bcb871e396f67ee2b1a5/src/android/org/jboss/aerogear/cordova/push/PushHandlerActivity.java#L60" target="_blank">https://github.com/aerogear/<wbr>aerogear-cordova-push/blob/b31<wbr>3fcfb20708089f2e0bcb871e396f67<wbr>ee2b1a5/src/android/org/jboss/<wbr>aerogear/cordova/push/PushHand<wbr>lerActivity.java#L60</a></div><div><br></div><div>rebuild the cordova library, test it, and send a pull request if it fixes your problem.</div><div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Here some information about my test conditions which could be useful.<br><br></div><div>OS: Android 6.0.1<br></div><div>Device: Samsung S6<br></div><div>Aerogear Plugin Version: 3.1.0<br><br></div><div>We&#39;re talking about a cross platform application developed with Ionic 1 and Angular 1.<br></div><div>I did not try to verify if the problem is happening also on a iOS device, but i&#39;m gonna do it immediately after writing this reply.<br></div><div>Do you think some other info could be useful?<br><br></div><span lang="EN-US">Thanks anyway, Federico.</span><div><br></div><br><div><br></div></div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-HOEnZb"><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-04-19 13:37 GMT+02:00 Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The easiest tool to use is logcat with the Android emulator.  Logcat is part of the Android SDK which you installed while you were setting up your development environment (it may have been installed by another tool but it is there).<div><br></div><div>All you need to do is, from the command line, run logcat.  Then run your application and wait for it to crash, and you will find the stack trace (and a bunch of other stuff), in the log.  It is possible to filter the logcat output based on the package name of the application generating logs, but one thing at a time.</div><span class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537HOEnZb"><font color="#888888"><div><br></div><div>Summers</div></font></span></div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537HOEnZb"><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 19, 2017 at 4:11 AM, Federico Cerminara <span dir="ltr">&lt;<a href="mailto:fedecentrico@gmail.com" target="_blank">fedecentrico@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><font size="4">Still not able to introduce a tool to produce a stacktrace. I know it would be helpful (if you have suggestions about which tool/plugin/approach to use...) but now i am still not able to do it. </font><span lang="EN-US"><font size="4">I’m a beginner in cross platform app development, as i said before :(</font><br></span></div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537m_8436308783065595146HOEnZb"><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537m_8436308783065595146h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-04-18 17:23 GMT+02:00 Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Apr 18, 2017 at 10:55 AM, Federico Cerminara <span dir="ltr">&lt;<a href="mailto:fedecentrico@gmail.com" target="_blank">fedecentrico@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hi Summers, <br></div>thanks for your immediate reply. The OS on the device i am testing now is Android 6.0.1, but I don&#39;t know if it&#39;s an useful information cause I&#39;m using Ionic 1 and Angular 1 to develop a Cross Platform App. <br><br></div><div>The code is not publicly available but I can share some code pieces if you suggest me which pieces of code could help us for this analysis.<br><br></div><div>It&#39;s not ax example app, I just took inspiration from the snippet of code included in Android aerogear variant and used them to complete my app.js code.  <br><br></div><div>How could you help me?<br></div></div></blockquote><div><br></div></span><div>Would you be able to include your stack trace from logcat when the application crashes?</div><div><br></div><div>I&#39;m not as familiar with Cordova as I should be, but I should be able to make heads or tails of it.</div><div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537m_8436308783065595146m_-8515675144550618316h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Thanks anyway, Federico.<br><br></div></div><div class="gmail_extra"><div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537m_8436308783065595146m_-8515675144550618316m_-1928189413010546042h5"><br><div class="gmail_quote">2017-04-18 16:33 GMT+02:00 Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Frederico,<div><br></div><div>Hi, sorry you are having trouble with UPS.  If you could help us out by answering a couple of questions that would be great.</div><div><br></div><div>1) Which OS is your applicatoin having trouble on and are you using Cordova or native libraries?</div><div><br></div><div>2) Is your code publicly available somewhere for us to look at?</div><div><br></div><div>3) Are you using the example app or is this your own implementation?</div><div><br></div><div>I know from experience that with Android one of the common problems is that if the application has been killed by the OS then the Push libraries have to be reinitialized before you can send metrics to the server.  If you are initializing your push libraries in an Activity class instead of the Application class this may be something to double check.  Of course if this is iOS or Cordova then everything I just said is nonsense :)</div><div><br></div><div>Summers</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537m_8436308783065595146m_-8515675144550618316m_-1928189413010546042m_-2482881479116987358h5">On Tue, Apr 18, 2017 at 10:18 AM, Federico Cerminara <span dir="ltr">&lt;<a href="mailto:fedecentrico@gmail.com" target="_blank">fedecentrico@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="m_6948051893401159454m_-3200079237911935357m_-1612760731062593784gmail-m_7737774774482278293gmail-m_-7201539192057589537m_8436308783065595146m_-8515675144550618316m_-1928189413010546042m_-2482881479116987358h5"><div dir="ltr">

<p class="MsoNormal"><span lang="EN-US">Hi, <br>
my name is Federico Cerminara, 35 years old, engineer and web developer in
Rome.<br>
I’m a beginner in cross platform app development and I’ve started using
aerogear cordova push plugin to enable reception of push notification. <br>
<br>
I’ve developed my first app. I’m able to receive correctly push notification,
both sending them directly by aerogear admin panel after choosing a variant and
and sending them from the application backend following a custom logic. If I
have my app closed or already open, clicking on push notification seems to
behave correctly, bringing user to application first page. Instead, if I try to
close all my applications after receiving one or more push notification (image
notification frequency is quite low) and then I try to click on my waiting
push, application crashes showing a message that sound quite like this “The
program &lt;app_name&gt; has been interrupted”</span></p>

<p class="MsoNormal"><span lang="EN-US">Can you
tell me a way to solve this problem?<br>
Thanks anyway, Federico.</span></p>

</div>
<br></div></div>______________________________<wbr>_________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org" target="_blank">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/mailma<wbr>n/listinfo/aerogear-users</a><br>
<br></blockquote></div><br></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div><br></div></div></div></div><br></blockquote></div></div></div></div></div></blockquote></div></div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Puoi trovarmi qui, se vuoi:<br><a href="http://www.facebook.com/fedecentrico" target="_blank">facebook</a>, <a href="http://www.flickr.com/photos/fedecentrico" target="_blank">flickr</a>, <a href="http://it.linkedin.com/in/fedecentrico" target="_blank">linkedin</a>, <a href="http://twitter.com/fedecentrico" target="_blank">twitter</a>, <a href="http://www.anobii.com/fedecentrico/books" target="_blank">anobii</a><br>Link consigliati: <a href="http://www.piccolimaestri.org" target="_blank">Piccoli Maestri</a>, <a href="http://www.facebook.com/#%21/IlClimaDiCipro" target="_blank">Il clima di Cipro</a><br></div></div></div>
</div>