title: Android - Azure Push Notifications Google FCM
body: <p>I've followed <a href="https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-android-push-notification-google-fcm-get-started/" rel="nofollow noreferrer">Sending push notifications to Android with Azure Notification Hubs tutorial</a> to implement Push notifications into my Android app using the Azure Notification Hub.</p>
  
  <p>Previously, I used another tutorial to do this using the Google Cloud Messaging service with Azure Notification Hub, however I was only able to get Push notifications when I sent my app to my device from Android Studio.  When I built a signed APK and installed that on my device, no push notifications came through.  </p>
  
  <p>After trying all day yesterday to get it to work (disabling ProGuard, trying different API keys etc) I decided to start fresh this morning.  That is when I realized that Google now directs users to the Firebase Cloud Messaging when they click on GCM from the Cloud Console.  So...I've implemented the Push Notifications into my app using the above tutorial and Google FCM.</p>
  
  <p>It works great....but again, when I create a signed APK and install that on my device rather than sending the app to my device from Android Studio, I get no push notifications.  Azure shows that the push was sent successfully, but nothing comes through.</p>
  
  <p>In my push handler, I have a log to the console as seen below in the onReceive method.  This gets called fine when I run the app from Android Studio, and the push comes through as it should.  But when I create signed apk and run from that, the onReceive method does not get called and no push comes through.</p>
  
  <pre><code>@Override
      public void onReceive(Context context, Bundle bundle) {
  
          Log.d("TAG","TRIGGERED");
  
          ctx = context;
          String nhMessage = bundle.getString("message");
          String nhTitle = bundle.containsKey("title") ? bundle.getString("title") : "Title";
          String nhBadge = bundle.containsKey("badge") ? bundle.getString("badge") : null ;
          sendNotification(nhMessage,nhTitle,nhBadge);
          if (Main.isVisible) { Main.mainActivity.ToastNotify(nhMessage); }
      }
  </code></pre>
  
  <p>Someone please help me.  What am I missing?????
  Is it because I'm installing the APK directly?  Does it HAVE to be downloaded from Google Play?  Other than that, I don't see what it could be.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>As per Nikita G's suggestion, I've followed the <a href="https://developers.google.com/web/fundamentals/getting-started/push-notifications/step-07?hl=en" rel="nofollow noreferrer">instructions to send a test push from the command line using cURL</a>.<br>
   The response I get back is the following (which looks like a success message) however I get no Push on my device. </p>
  
  <pre><code>{"multicast_id":6722521883082447284,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1473693614087201%06fb35f0f9fd7ecd"}]}
  </code></pre>
  
  <p>My cURL request looks like this, just like the tutorial shows.</p>
  
  <pre><code>curl --header "Authorization: key=XXXXXXXXXXXX" --header "Content-Type: application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"fs...Tw:APA...SzXha\"]}"
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I just noticed that it is not just when I use a SIGNED APK.  In Android Studio, if I generate a APK using the Build APK option</p>
  
  <p><a href="https://i.stack.imgur.com/sGRQw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sGRQw.png" alt="enter image description here"></a></p>
  
  <p>and then install using the app-debug.apk file located at myappfolder/app/build/output/apk/, the Push Notifications still do not work.  they ONLY work if I send to my device from Android Studio using the Run option.</p>