Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

User.save returns "Request Failed with status code of 404"

$
0
0

Hi guys!

I am trying to send push notifications to an android device.

I have set everything and followed this tutorial like 10 times now, but I always get this error: Request Failed with status code of 404

This is my code

Ionic.io();
    var push = new Ionic.Push({
        "debug":false,
        "onNotification": function (notification) {
            alert('Received notification');
        },
        "pluginConfig": {
            "android": {
                "iconColor": "#0000FF"
            }
        }
    });

    var user = Ionic.User.current();
    if (!user.id) {
        user.id = Ionic.User.anonymousId();
    }
    user.set('name', 'Ruben El Bueno');
    user.set('bio', 'This is my bio');
    var success = function(response) {
      $scope.data.user_id = response;
      console.log('user was saved');
    };

    var failure = function(error) {
      $scope.data.user_id = "Not" + error;
    };

    user.save().then(success, failure);

    var callback = function () {
        push.addTokenToUser(user);
        user.save();
    }

    push.register(callback);

But I keep getting the same error.

I also tried clearing the Mobile Device cache like posted here

Please help! :smiley:

Thanks guys!


Viewing all articles
Browse latest Browse all 228595

Trending Articles



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