Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
cordova-plugin-push-baidu
Advanced tools
-- 2017.02.17 Updated Android SDK 5.6.0.30 -- 2016.06.06 Updated iOS SDK 1.4.5, Android 5.0.0 -- 2015.06.17 IOS SDK -- 2015.06.15 Android SDK【L2-4.4.1】
$ ionic plugin add cordova-plugin-push-baidu
var api_key = 'SJI7BJ4hg8k5BUJ6LWVXit35' // your api key
document.addEventListener("deviceready", function () {
window.baiduPush.onMessage(function (result) {
console.log('onMessage success', result);
}, function () {
console.error('onMessage fail', error);
})
window.baiduPush.onNotificationClicked(function (result) {
console.log('onNotificationClicked success', result);
}, function (error) {
console.error('onNotificationClicked fail', error);
})
window.baiduPush.onNotificationArrived(function (result) {
console.log('onNotificationArrived success', resultj);
}, function (error) {
console.error('onNotificationArrived fail', error);
})
window.baiduPush.startWork(api_key, function (result) {
console.log('startWork success', resultj);
}, function (error) {
console.error('startWork fail', error);
})
}, false);
baiduPush.startWork
baiduPush.startWork(api_key, cb_success);
# api_key: Baidu cloud push api_key
# cb_success: callback method call succeeds, will not consider callback call fails, the return value is structured as follows:
#json: {
type: 'onbind', // method of the corresponding Android Service
data: {
appId: 'xxxxxxxx',
userId: 'yyyyy',
channelId: 'zzzzzz'
}
}
baiduPush.stopWork
baiduPush.startWork(cb_success);
# cb_success: callback method call succeeds, will not consider callback call fails, the return value is structured as follows:
#json: {
type: 'onunbind', // method of the corresponding Android Service
errorCode: 'xxxxxx', // error code corresponding to Baidu's request
data: {
requestId: 'yyyyyy', // request ID corresponding to Baidu
}
}
baiduPush.resumeWork
baiduPush.resumeWork(cb_success);
# cb_success: callback method can call succeeds, the return value is structured as follows: Method with baiduPush.startWork
baiduPush.setTags
baiduPush.setTags(tags, cb_success);
# tags[]: tag name you want to set
# cb_success: callback method call succeeds, will not consider callback call fails, the return value is structured as follows:
#json: {
type: 'onsettags',
errorCode: 'xxxxxxxx',
data: {
requestId: 'yyyyy',
channelId: 'zzzzzz'
sucessTags: ['aaa', 'bbb', 'ccc'], // set success tag list
failTags: ['ddd', 'eee', 'fff'] // tag list settings failed
}
}
baiduPush.delTags
baiduPush.delTags(tags, cb_success);
# tags[]: tag name you want to remove
# cb_success: callback method call succeeds, will not consider callback call fails, the return value is structured as follows:
#json: {
type: 'ondeltags',
errorCode: 'xxxxxxxx',
data: {
requestId: 'yyyyy',
channelId: 'zzzzzz'
sucessTags: ['aaa', 'bbb', 'ccc'], // set success tag list
failTags: ['ddd', 'eee', 'fff'] // tag list settings failed
}
}
baiduPush.onMessage(cb_success, failureCallback)
baiduPush.onNotificationClicked(successCallback, failureCallback)
# successCallback: callback method call succeeds, will not consider callback call fails, the return value is structured as follows:
#json: {
"data": {
"title": "foo",
"description": "bar",
"customContentString": "{\"Additional Field Key\":\"Additional Field Value\"}"
},
"type": "onNotificationClicked"
}
baiduPush.onNotificationArrived(successCallback, failureCallback)
# successCallback: callback method call succeeds, will not consider callback call fails, the return value is structured as follows:
#json: {
"data": {
"title": "foo",
"description": "bar",
"customContentString": "{\"Additional Field Key\":\"Additional Field Value\"}"
},
"type": "onNotificationArrived"
}
Json Parameters on the type of callback method can return the following values that correspond Android's Service of Baidu cloud push callback method onbind, onunbind, onsettags, ondeltags, onlisttags, onmessage, onnotificationclicked, onnotificationarrived
Since Baidu applications different android and ios, APP client can use the following method to determined it:
ionic.Platform.isIOS()
ionic.Platform.isAndroid()
FAQs
Baidu push notification plugin for cordova
We found that cordova-plugin-push-baidu 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.