
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
cordova-plugin-cnpush
Advanced tools
cordova plugin add cordova-plugin-cnpush --variable APPID=HUAWEI_APPID --variable PACKAGENAME=ANDROID_PACKAGENAME --variable cpid=HUAWEI_CPID --variable JPUSH_APP_KEY=JPUSH_APP_KEY
在中国大陆地区使用。 如果是华为安卓手机,则使用华为推送sdk。 如果是苹果手机,则使用苹果推送sdk。 其它是其它安卓手机,则使用极光推送sdk。
var pushNotification = PushNotification;
window["onNotificationAPN"] = onNotificationAPN;
pushNotification.register(
tokenHandler,
errorHandler,
{
"badge": "true",
"sound": "true",
"alert": "true",
"ecb": "onNotificationAPN"
});
function tokenHandler(result) {
// Your iOS push server needs to know the token before it can push to this device
// here is where you might want to send it the token for later use.
alert('device token = ' + result);
}
// result contains any error description text returned from the plugin call
function errorHandler(error) {
alert('error = ' + error);
}
// iOS
function onNotificationAPN(event) {
/*接收到的数据类型 {"sound":"default","body":"body","title":"title","customkey":"test","foreground":"1"}*/
alert("onNotificationAPN");
console.log(event);
if (event.alert) {
// navigator.notification.alert(event.alert);
}
if (event.sound) {
// var snd = new Media(event.sound);
//snd.play();
}
if (event.badge) {
//pushNotification.setApplicationIconBadgeNumber(successHandler, errorHandler, event.badge);
}
}
FAQs
Cordova Push Plugin
The npm package cordova-plugin-cnpush receives a total of 2 weekly downloads. As such, cordova-plugin-cnpush popularity was classified as not popular.
We found that cordova-plugin-cnpush demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.