Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

passing variable from app to window

$
0
0

hello i m trying to pass a variable that exists inside app.js ev.deviceToken to another window window.js i have tryed to do this with setString - getString , but it doesnt works:

Ti.App.Properties.setString('devicetoken', ev.deviceToken); in app.js
Ti.App.Properties.getString('devicetoken'); in my window.js
the result is null!

Now i am trying to pass it with a fireEvent - addEventListener

Ti.App.fireEvent('MyEventString',{devicetoken:ev.deviceToken}); in app.js
Ti.App.addEventListener('MyEventString',function(e){
     dtok = e.devicetoken;
 
});
in my window.js
 
now i want to take this dtok and use it in another addEventListener on this window.js
 
Ti.App.addEventListener("app:got.location", function(d) {
 
webViewHome.setUrl( ................. +dtok
The problem is that dtok exists only inside the first addEventListener and i cant take it out of it :/

Viewing all articles
Browse latest Browse all 7655

Trending Articles



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