Hi, After I successfully registered on safari, I need the device token, but the callbacks return a null response. Where should I obtain the device token?

Here is my code: I got this code from here: http://docs.pushwoosh.com/docs/web-sdk-20

Pushwoosh.push(function(api) { function onSuccessRegister(response){ console.log(response); // This response is null , the device token should be here? } function onError(response){ console.log(response); } api.registerDevice() .then(onSuccessRegister, onError); }); I'm assuming that the device token comes from the callback on registerDevice().

Thanks!

asked 26 Jul '16, 22:26
Juanfra's gravatar image

Juanfra
112

Hi,

You can try to add the following code:

Pushwoosh.push(function(api) { $.post('/url/for/save/token', { pushToken: api.pushToken }); });

Please note, however, that for targeting purposes you'll need some way to associate particular user with particular token as well.

permanent link
answered 29 Jul '16, 12:12
idedov's gravatar image

idedov
2363

Perfect! Thanks so much.

Juanfra,

permanent link
answered 29 Jul '16, 16:41
Juanfra's gravatar image

Juanfra
112

Juanfra,

I am glad my colleague helped you with the resolution of the issue.

Please don't hesitate to contact us at help@pushwoosh.com in the future, we are always here to help!

permanent link
answered 01 Aug '16, 10:07
Nikolai's gravatar image

Nikolai
3585

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×76
×49
×16

question asked: 26 Jul '16, 22:26

question was seen: 862 times

last updated: 01 Aug '16, 10:07