Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49076

How send gcm message with $http

$
0
0

@mapeveri wrote:

Hi everyone, i have that send message gcm from my application, but this code not work. Any idea?.

 var msg = {
          'message': 'here is a message. message',
          'title': 'This is a title. title',
          'subtitle': 'This is a subtitle. subtitle',
          'tickerText': 'Ticker text here...Ticker text here...Ticker text here',
          'vibrate': 1,
          'sound': 1,
          'largeIcon': 'large_icon',
          'smallIcon': 'small_icon'
      };

      var data = {
          'registration_ids': ['id1', 'id2'],
          'data': msg
      };

      $http({
        url: "https://android.googleapis.com/gcm/send",
        dataType: "jsonp",
        method: "POST",
        headers: {
          "Authorization": 'key=mykey',
          "Content-Type": "application/javascript",
        },
        data: angular.toJson(data)
      })
      .then(function(response) {
          console.log(response);
      });

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>