Reputation: 169
Hello im trying to send a windows phone 8 push notification that is working in ios and android environment, but in my windows phone cell doesnt recieve.
In my worklightconsole ive seen that the user is suscribe and the push is send.
this is my custom configuration for windows phone environment
application-descriptor.xml:
<windowsPhone8 version="1.0" securityTest="xxxxxxxxxx-strong-mobile-securityTest">
<uuid>xxxxxxxxxxxxxxxxxxxxxxxxxxx</uuid>
<pushSender />
</windowsPhone8>
WL adapter code:
try {
var usuario = "9136";
var usuariosNoEncontrados = 0;
// var cantUsuarios = usuarios.length
try {
var badgeDigit = 1;
var notification = WL.Server.createDefaultNotification(mensaje, badgeDigit, {custom:"data"});
notification.MPNS.raw = {
payload : {payload : "You have a meeting in 5 minutes"}
};
var userSubscription = WL.Server.getUserNotificationSubscription(
'Fiesta2015_PUSH_NOTIFICATIONS.FiestaEventSource', usuario);
if (userSubscription != null) {
WL.Server.notifyAllDevices(userSubscription, notification);
} else {
WL.Logger
.info("User not found:: "
+ usuario);
}
return {
codigo : "0",
error : "",
respuesta : "OK"
};
} catch (e) {
return {
codigo : "2",
error : e,
respuesta : ""
};
}
} catch (e) {
// TODO: handle exception
return {
codigo : "2",
error : e,
respuesta : ""
};
}
trace in my developer server
[10/2/15 15:04:52:732 GMT-03:00] 0000040a com.ibm.pushworks.server.notification.mpns.MPNSSender E FPWSE1028E: Notification through Microsoft Push Notification Service (MPNS) to subscription 'http://s.notify.live.net/u/1/bn1/H2QAAACeRdLTzN62GukR6VNR79CH16nLA287g3zW2jmMAKEM7yA2YQcWSrJJbBBd7ma0MjJqB4Za0hceofRW258O2kqxVikHilukxiiThqkCI6JNGeXldHH2RZPutOv_qL2EM94/JHtzZXJ2aWNlbmFtZX0/Y6WgLTaz-ESHoQtbNpQ2HQ/S7AyIDdrf4nCanHvc95MA4wyO90' was not delivered (reason: 's.notify.live.net')
java.net.UnknownHostException: s.notify.live.net
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
at java.net.InetAddress.getAllByName(InetAddress.java:1162)
at java.net.InetAddress.getAllByName(InetAddress.java:1098)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:259)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:159)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at com.ibm.pushworks.server.notification.mpns.MPNSSender.sendAndVerify(MPNSSender.java:241)
at com.ibm.pushworks.server.notification.mpns.MPNSMediator.sendOrWait(MPNSMediator.java:88)
at com.ibm.pushworks.server.notification.mpns.MPNSMediator.sendNotification(MPNSMediator.java:80)
at com.ibm.pushworks.server.notification.Mediator$2.run(Mediator.java:91)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Which configuration im missing.
Upvotes: 0
Views: 97
Reputation: 2681
When application is in background only toast and tile notifications are applicable on Windows Phone 8.
a) To get Toast notifications , modify the adapter code:
notification.MPNS={};
notification = WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"});
//Set Toast notification for MPNS
notification.MPNS.toast={};
notification.MPNS.toast.text1 = "Toast title";
notification.MPNS.toast.text2 = "Toast content";
b) For tile notifications, pin the application to the start screen.
Upvotes: 1