|
|
|
Android ขอสอบถามเรื่อง PhoneGap กับการ Push Notification หน่อยครับ |
|
|
|
|
|
|
|
ใช้ Plugin ช่วยครับ
Code (JavaScript)
var pushNotification;
document.addEventListener("deviceready", function(){
pushNotification = window.plugins.pushNotification;
...
});
Code (JavaScript)
$("#app-status-ul").append('<li>registering ' + device.platform + '</li>');
if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){
pushNotification.register(
successHandler,
errorHandler,
{
"senderID":"replace_with_sender_id",
"ecb":"onNotification"
});
} else if ( device.platform == 'blackberry10'){
pushNotification.register(
successHandler,
errorHandler,
{
invokeTargetId : "replace_with_invoke_target_id",
appId: "replace_with_app_id",
ppgUrl:"replace_with_ppg_url", //remove for BES pushes
ecb: "pushNotificationHandler",
simChangeCallback: replace_with_simChange_callback,
pushTransportReadyCallback: replace_with_pushTransportReady_callback,
launchApplicationOnPush: true
});
} else {
pushNotification.register(
tokenHandler,
errorHandler,
{
"badge":"true",
"sound":"true",
"alert":"true",
"ecb":"onNotificationAPN"
});
}
PhoneGap Plugin
https://github.com/phonegap-build/PushPlugin
|
|
|
|
|
Date :
2015-09-24 09:44:21 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|