I want to increase app icon badge by 1 when expo push notification comes.
Here's my code:
sendNotification({
to: route.params.user.pushToken,
title: `${person.username} size mesaj gönderdi`,
body: `${messages[0].text}`,
badge: 1,
"content-available": 1,
data: { url: "myApp://ChatList", type: "chat" },
});
Can you help me how can I listen to push notification? Or can you specify how to do badge + 1 on the server side?
Related
I have code like bellow, I have 3 step form which I would like to pass variables from step 1 to step 2 and then step 3.
bot.action('BuyService',(ctx)=>{
ctx.deleteMessage()
ctx.reply('first step text', {
reply_markup: {
inline_keyboard: [
[{ text: "1month", callback_data: 'step2'},{ text: "2month", callback_data: "step2" }],
[{ text: "3month", callback_data: "step2" }]
]}})
})
and step 2 is :
bot.action('step2',(ctx)=>{
"i want text of pressed button(1month,2month...) in here and pass all data to another step"
})
how can I make this possible ?
I would like to transfer pressed button texts from step 1 to step 2 and then all data to step 3 which all handle by button callbacks
Nativescript Firebase plugin has Admob where you can use Smart Banner but we can't detect height of banner.
Who can i get banner height after it loads on different screen sizes?
firebase.admob.showBanner({
size: firebase.admob.AD_SIZE.SMART_BANNER, // see firebase.admob.AD_SIZE for all options
margins: { // optional nr of device independent pixels from the top or bottom (don't set both)
bottom: 10,
top: -1
},
androidBannerId: "ca-app-pub-9517346003011652/7749101329",
iosBannerId: "ca-app-pub-9517346003011652/3985369721",
testing: true, // when not running in production set this to true, Google doesn't like it any other way
iosTestDeviceIds: [ //Android automatically adds the connected device as test device with testing:true, iOS does not
"45d77bf513dfabc2949ba053da83c0c7b7e87715", // Eddy's iPhone 6s
"fee4cf319a242eab4701543e4c16db89c722731f" // Eddy's iPad Pro
],
keywords: ["keyword1", "keyword2"], // add keywords for ad targeting
onOpened: () => console.log("Ad opened"),
onClicked: () => console.log("Ad clicked"),
onLeftApplication: () => console.log("Ad left application")
}).then(
function () {
console.log("AdMob banner showing");
},
function (errorMessage) {
dialogs.alert({
title: "AdMob error",
message: errorMessage,
okButtonText: "Hmmkay"
});
}
);
First we are getting screen size and then doing calculations with SMART_BANNER logic
Import this platform
const platform = require("platform")
Height divided by scale
const screenHeightDp =platform.screen.mainScreen.heightPixels / platform.screen.mainScreen.scale;
Doing calculations as smart banner works
const BannerHeight = screenHeightDp > 720 ? 90 : screenHeightDp > 400 ? 50 : 32;
This is our banner height
console.log(BannerHeight);
when i use systemPic style,use system xml,it works well.
builder.setContentTitle(StringUtil.f(title));
builder.setContentText(StringUtil.f(desc));
if (poster != null) {
builder.setLargeIcon(poster);
}
Notification notification = builder.build();
but when i use custom layout, the image in notification like a negative image:
original image vs Invert image
I am using Electron Browser window to display notifications received from firebase.
My sample.js file
ipcRenderer.on(NOTIFICATION_RECEIVED, (_, serverNotificationPayload) => {
if (serverNotificationPayload.notification.body)
{
showCustomNotification(serverNotificationPayload);
}
function showCustomNotification(serverNotificationPayload){
let disp = electron.screen.getPrimaryDisplay()
console.log(disp.bounds.x)
console.log(disp.bounds.y)
win = new BrowserWindow({
x: disp.bounds.width-310,
y: disp.bounds.height-620,
width: 300,
height: 550,
icon: './icon.png',
title: serverNotificationPayload.notification.title,
closable: true,
skipTaskbar: true,
show: true,
frame:false,
alwaysOnTop: true
})
win.loadFile('index.html');
Now in my index.html file I need to render the json data thats received from firebase.I tried several solutions but none worked.If somebody can help me it would be great.Whenever I broadcast messages through firebase ,an empty window opens .I want to display the json content in that window.
I need to show a refresh button on a specific card only, the title bar to which is defined in some parent Panel. I have tried in the following way:
Parent Panel:
config:
{
layout : 'fit',
items:[
{
xtype:'titlebar',
docked:'top',
title:'Directory',
items:[
{
xtype: 'button', //First Button-visible in all cards
docked: 'left',
iconCls: 'arrow_left',
action: 'back'
},
{
xtype: 'button', //Target button-to be visible in one card only
docked: 'right',
iconCls: 'refresh',
action: 'reset',
hidden: true //hiding this button
}
]
},
{
xtype:'tabpanel',
tabBarPosition:'top',
items:[
{
title: 'Tab1',
xtype: 'Card1'
},
{
title: 'Tab2',
xtype: 'Card2'
}
]
}
]
}
I have a hidden property set to true for refresh button in above panel, which i want to set false for a card.
The target card is set active on a button click. I am changing hidden property to false in the buttonTapListener, and then setting the target card as active. But the refresh button do not get visible. Here is the controller code:
onButtonTap: function()
{
...
var getParentPanelRef = this.getParentPanel();
var parentPanelItems = getParentPanelRef.getItems();
console.log(parentPanelItems.items[0].config.items[1].hidden); //Prints true
directoryMainContainerItems.items[0].config.items[1].hidden=false;
console.log(parentPanelItems.items[0].config.items[1].hidden); //Prints false
var directorySearchMainUIRef = this.getSomeOtherParentPanel();
directorySearchMainUIRef.setActiveItem(1); //Switches to target card
}
The value of hidden gets changed, but button doesn't come up. Please suggest an alternative if so. Thanks in advance.
Instead of hiding/showing the button you could add/destroy the button.
I had a similar problem a while a ago and it seems that sencha not always detects when it should redraw components.
Maybe your parent component'width is out of you browser and your button is docked right so that you can's see it.