Page 1 of 1

pushnotification signature into variable

Posted: Thu Apr 24, 2014 1:18 am
by bohmgyorgy1990
Hy!

I would like to send my device's id to my own page. The pushnotification is working correctly. The problem is when i put this id into a variable (deviceID), i cant use it in a different command.

my code is the following:

local sBrowserId
global deviceID

on pushNotificationRegistered tSignature
put tSignature into deviceID -- put the id into a variable
end pushNotificationRegistered

on startBrowser
mobileControlCreate "browser"
put the result into sBrowserId
mobileControlSet sBrowserId, "visible", "true"
checkConn
mobileControlSet sBrowserId, "url", "http://192.168.0.139/Devices/Auth/" & deviceID -- concat the url and the variable in this case --- device id is null :/ why?
end startBrowser

on preOpenCard
if the environment is not "mobile" then
exit preOpenCard
end if
startBrowser
resizeStack
end preOpenCard

can anyone explain me what i doing wrong.

Kind Regards

George

Re: pushnotification signature into variable

Posted: Thu Apr 24, 2014 11:01 am
by Klaus
Hi George,

are these three handlers in the same script (of the card of stack)?
And -> deciceID is definitively not empty?
And are you sure that "pushNotificationRegistered" is successfully
received/executed BEFORE "preopencard"?


Best

Klaus

Re: pushnotification signature into variable

Posted: Thu Apr 24, 2014 11:01 pm
by jiml
Don't know if this will work but you might try putting the pushNotificationRegistered handler in the stack script.
And check that you have enabled push notifications in standalone settings > IOS

Re: pushnotification signature into variable

Posted: Fri Apr 25, 2014 2:10 am
by bohmgyorgy1990
all these scripts are on the same card.
deciceID is definitively not empty! ( put empty into it ? )
i am not sure that the pushNotificationRegistered executed before the browser was created in this code, for example when i put the pushNotificationRegistered into preOpenStack and i put the signature into a global variable also i cant get it in the card.

the standalone setting are okey, i can push notification just i cant post the deviceID in the url like in this sciprt