2016-01-20 43 views
0

我正在嘗試使用Smartface App Studio實施Pust通知。 我跟着鏈接:http://www.smartface.io/developer/guides/advanced/push-notifications/ 但是,我堅持以下。 1.我在哪裏可以找到通過Notifications.remote.registerForPushNotifications()方法向其設備令牌註冊的設備。 2.如何獲取access_token從smartface api推送通知。Smartface App Studio中的推送通知

任何人都可以幫我弄清楚這些嗎?提前致謝。

回答

0

對於IOS下面的代碼適用於我。我認爲Android已更改爲4.5

var registerParsePush = new SMF.Net.WebClient({ 
     httpMethod : "POST", 
     URL : "https://api.parse.com/1/installations", 
     contentType : "application/json", 
     requestHeaders : ["X-Parse-Application-Id:  f5Y4tmDdKOYm5YdKDdDV8W6LDfviqFaCfhMgmxx", "X-Parse-REST-API-Key:  PqbhEDYJcXP3xWmWRB6PBuzfIz4OIq0tK4V3dpxx", "Content-Type: application/json"], 
     onSyndicationSuccess : function (e) {}, 
     onServerError : function (e) {} 
    }); 


Notifications.remote.registerForPushNotifications({ 
    OnSuccess : function() { 
     var pushToken = Notifications.remote.token; 
     var req = { 
      "deviceType" : "ios", 
      "deviceToken" : pushToken, 
      "channels" : [ 
       "" 
      ] 
     }; 
     registerParsePush.requestString = JSON.stringify(req); 
     registerParsePush.run(true); 
    }, 
    OnFailure : function() {} 
}); 
+0

我正在嘗試smartface api推送通知不與解析。爲此,我們需要從smartface api獲取access_token,並將其放置在可以看到所有註冊設備(而不是解析)的地方。 –

+0

您可以將webclient url更改爲您的服務器以記錄令牌 –

+0

感謝Alex。但是,我在哪裏可以獲取smartface api access_tocken來推送通知? –