Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android:Java - Setting Push Notifications

$
0
0

Hello.

I'm new to ACS and I'm trying to set push notifications. I'm developing application on Java-Android and following acs docs example I still cannot set Push Notifications.

first of all, I'm making login to user. After I get login-ok callback, Im trying to set Push:

1) getting token from Android GCM (very long key about 183 characters) GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String googleToken = gcm.register(GOOGLE_NOTIFICATION_KEY);

2) once I got Google Push Token I getting ACS Token:

CCPushService.getInstance().getDeviceTokenAsnyc(this, appKey, new DeviceTokenCallback() { @Override public void receivedDeviceToken(String token) { try { CCPushService.getInstance().startService(getApplicationContext()); } catch (PushServiceException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } sendTokenToAcsServer(token); }

        @Override
        public void failedReceiveDeviceToken(Throwable throwable) {
            //To change body of implemented methods use File | Settings | File Templates.
        }
    }); 

this is my foo ... private void sendTokenToAcsServer(String token) { if (token != null) { Cocoafish cocoafish = MyCocoaFish.getSharedInstance(); cocoafish.getAccessToken(); cocoafish.getAccessToken(); cocoafish.getAppKey(); cocoafish.getCurrentUser();

        Map<String, Object> data = new HashMap<String, Object>();
        data.put("type", "android");
        data.put("channel", "friend_request");
        data.put("device_token", token);
        String methodName = "push_notification/subscribe.json";
        NodeAcsTask nodeAcsTask = new NodeAcsTask(methodName, data, mHandler, CCRequestMethod.POST);
        nodeAcsTask.execute();
    }
}

BUT !!! IN RESPONSE LINE I'M GETTING: --->>> Failed to authenticate user","status":"fail","code":404}

can please anyone help me ?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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