i am trying to create a top message in my app ( iOS, Android ). This message will be showed when a push notification arrive, but i can't make it. This is the code i am using.
var MessageWindow = require('js/messageWindow'),
messageWin = new MessageWindow();
messageWin.setLabel( "Probando mensajes en la parte superior" );
messageWin.open();
setTimeout(function(){ messageWin.close({opacity:0,duration:500}); },3000);
And the messageWindow is:
function MessageWindow() {
var win = Titanium.UI.createWindow({
top: 0,
height: '30%',
width: '98%',
borderRadius:10,
touchEnabled:false,
});
var messageView = Titanium.UI.createView({
id:'messageview',
height:'25%',
width: '95%',
borderRadius:10,
backgroundColor:'#000',
opacity:0.7,
touchEnabled:false
});
var messageLabel = Titanium.UI.createLabel({
id:'messagelabel',
text:'',
color:'#fff',
width: '85%',
height:'auto',
font:{
fontFamily:'Helvetica Neue',
fontSize:13
},
textAlign:'center'
});
messageView.add(messageLabel);
win.add(messageView);
this.setLabel = function(_text) {
messageLabel.text = _text;
};
this.open = function(_args) {
win.open(_args);
};
this.close = function(_args) {
win.close(_args);
}; }module.exports = MessageWindow;
Here you have a screenshot of what i want
I've trying multiple configurations in the Window with no success.. Thanks in advance
You can use this widget Ti.Notifications