বিষয়বস্তুতে যান

Cordova প্লাগইন API রেফারেন্স

example
var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
// Should be called before pushwoosh.onDeviceReady
document.addEventListener('push-notification', function(event) {
var notification = event.notification;
// handle push open here
});
// Initialize Pushwoosh. This will trigger all pending push notifications on start.
pushwoosh.onDeviceReady({
appid: "XXXXX-XXXXX",
projectid: "XXXXXXXXXXXXXXX",
serviceName: "XXXX"
});
pushwoosh.registerDevice(
function(status) {
var pushToken = status.pushToken;
// handle successful registration here
},
function(status) {
// handle registration error here
}
);

onDeviceReady

Anchor link to
PushNotification.prototype.onDeviceReady = function( config )

[android, ios, wp8, windows]
Pushwoosh প্লাগইন ইনিশিয়ালাইজ করে এবং একটি স্টার্ট পুশ মেসেজ ট্রিগার করে। প্রতিটি অ্যাপ লঞ্চের সময় এটি কল করা উচিত।

config.appid – Pushwoosh অ্যাপ্লিকেশন কোড।

config.projectid – Android প্ল্যাটফর্মের জন্য GCM প্রজেক্ট নম্বর।

config.serviceName – wp8 প্ল্যাটফর্মের জন্য MPNS সার্ভিসের নাম।

example
// initialize Pushwoosh with projectid: "GOOGLE_PROJECT_NUMBER", appid : "PUSHWOOSH_APP_ID", serviceName : "WINDOWS_PHONE_SERVICE". This will trigger all pending push notifications on start.
pushwoosh.onDeviceReady({
appid : "XXXXX-XXXXX",
projectid: "XXXXXXXXXXXXXXX",
serviceName: "XXXX"
});

registerDevice

Anchor link to
PushNotification.prototype.registerDevice = function( success, fail )

[android, ios, wp8, windows]
পুশ নোটিফিকেশনের জন্য ডিভাইস রেজিস্টার করে এবং একটি পুশ টোকেন পুনরুদ্ধার করে।

success – সফল কলব্যাক। পুশ টোকেন এই কলব্যাকে “status.pushToken” প্যারামিটার হিসাবে পাস করা হয়।

fail – ত্রুটি কলব্যাক।

example
pushwoosh.registerDevice(
function(status) {
alert("Registered with push token: " + status.pushToken);
},
function(error) {
alert("Failed to register: " + error);
}
);

unregisterDevice

Anchor link to
PushNotification.prototype.unregisterDevice = function( success, fail )

[android, ios, wp8, windows]
পুশ নোটিফিকেশন গ্রহণ করা থেকে ডিভাইসকে আনরেজিস্টার করে।

success – সফল কলব্যাক।

fail – ত্রুটি কলব্যাক।

PushNotification.prototype.setTags = function( config, success, fail )

[android, ios, wp8, windows]
ডিভাইসের জন্য ট্যাগ সেট করে।

প্যারামিটার

config – কাস্টম ডিভাইস ট্যাগ সহ অবজেক্ট।

success – সফল কলব্যাক। পুশ টোকেন এই কলব্যাকে “status.pushToken” প্যারামিটার হিসাবে পাস করা হয়।

fail – ত্রুটি কলব্যাক।

example
// sets tags: “deviceName” with value “hello” and “deviceId” with value 10
pushwoosh.setTags({deviceName:"hello", deviceId:10},
function() {
console.warn('setTags success');
},
function(error) {
console.warn('setTags failed');
}
);
// sets list tags "MyTag" with values (array) "hello", "world"
pushwoosh.setTags({"MyTag":["hello", "world"]});
PushNotification.prototype.getTags = function( success, fail )

[android, ios, wp8, windows]
ডিফল্ট ট্যাগ সহ ডিভাইসের জন্য ট্যাগগুলি রিটার্ন করে।

success – সফল কলব্যাক। প্যারামিটার হিসাবে ট্যাগ গ্রহণ করে।

fail – ত্রুটি কলব্যাক।

pushwoosh.getTags(
function(tags) {
console.warn('tags for the device: ' + JSON.stringify(tags));
},
function(error) {
console.warn('get tags error: ' + JSON.stringify(error));
}
);

getPushToken

Anchor link to
PushNotification.prototype.getPushToken = function( success )

[android, ios, wp8, windows]
পুশ টোকেন উপলব্ধ থাকলে তা রিটার্ন করে। মনে রাখবেন যে টোকেনটি registerDevice ফাংশন কলব্যাকেও আসে।

success – সফল কলব্যাক।

pushwoosh.getPushToken(
function(token) {
console.warn('push token: ' + token);
}
);

getPushwooshHWID

Anchor link to
PushNotification.prototype.getPushwooshHWID = function( success )

[android, ios, wp8, windows]
Pushwoosh API-এর সাথে যোগাযোগের জন্য ব্যবহৃত Pushwoosh HWID রিটার্ন করে।

success – getPushwooshHWID কলব্যাক।

pushwoosh.getPushwooshHWID(
function(token) {
console.warn('Pushwoosh HWID: ' + token);
}
);

getRemoteNotificationStatus

Anchor link to
PushNotification.prototype.getRemoteNotificationStatus = function( callback, error )

[android, ios]
পুশ নোটিফিকেশন পারমিশনের বিস্তারিত স্ট্যাটাস রিটার্ন করে।

callback – সফল কলব্যাক। নিম্নলিখিত প্রপার্টি সহ অবজেক্ট গ্রহণ করে:

{
"enabled" : notificaions enabled flag.
"pushBadge" : badges permission granted. (iOS only)
"pushAlert" : alert permission granted. (iOS only)
"pushSound" : sound permission granted. (iOS only)
}

error — ত্রুটি কলব্যাক।

setApplicationIconBadgeNumber

Anchor link to
PushNotification.prototype.setApplicationIconBadgeNumber = function( badgeNumber )

[android, ios]
অ্যাপ্লিকেশন আইকন ব্যাজ নম্বর সেট করুন।

badgeNumber – আইকন ব্যাজ নম্বর।

getApplicationIconBadgeNumber

Anchor link to
PushNotification.prototype.getApplicationIconBadgeNumber = function( callback )

[android, ios]
অ্যাপ্লিকেশন আইকন ব্যাজ নম্বর রিটার্ন করে।

callback – সফল কলব্যাক।

pushwoosh.getApplicationIconBadgeNumber(function(badge){ alert(badge);} );

addToApplicationIconBadgeNumber

Anchor link to
PushNotification.prototype.addToApplicationIconBadgeNumber = function( badgeNumber )

[android, ios]
অ্যাপ্লিকেশন আইকন ব্যাজে মান যোগ করে।

badgeNumber — বর্ধনশীল আইকন ব্যাজ নম্বর।

getLaunchNotification

Anchor link to
PushNotification.prototype.getLaunchNotification = function( callback )

[android, ios]
অ্যাপটি যদি পুশ নোটিফিকেশনের প্রতিক্রিয়ায় শুরু করা হয়, তাহলে পুশ নোটিফিকেশন পেলোড রিটার্ন করে, অথবা null রিটার্ন করে।

callback – সফল কলব্যাক।

clearLaunchNotification

Anchor link to
PushNotification.prototype.clearLaunchNotification = function( callback )

[android, ios]
লঞ্চ নোটিফিকেশন ক্লিয়ার করে, এই কলের পরে getLaunchNotification() null রিটার্ন করবে।

PushNotification.prototype.setUserId = function( userId )

[android, ios]
ইউজার আইডেন্টিফায়ার সেট করে– একটি Facebook ID, ইউজারনেম, ইমেল, বা অন্য কোনো ইউজার আইডি। এটি একাধিক ইউজার ডিভাইসে ডেটা এবং ইভেন্টগুলিকে মেলাতে সাহায্য করে।

userId – ইউজার স্ট্রিং আইডেন্টিফায়ার।

PushNotification.prototype.postEvent = function( event, attributes )

[android, ios]
ইন-অ্যাপ মেসেজের জন্য ইভেন্ট পোস্ট করে। এটি Pushwoosh কন্ট্রোল প্যানেলে নির্দিষ্ট করা অনুযায়ী ইন-অ্যাপ মেসেজ প্রদর্শন ট্রিগার করতে পারে।

event – ট্রিগার করার জন্য ইভেন্ট।

attributes – অতিরিক্ত ইভেন্ট অ্যাট্রিবিউট সহ অবজেক্ট।

pushwoosh.setUserId("XXXXXX");
pushwoosh.postEvent("buttonPressed", { "buttonNumber" : 4, "buttonLabel" : "banner" });

createLocalNotification

Anchor link to
PushNotification.prototype.createLocalNotification = function( config, success, fail )

[android, ios]
লোকাল নোটিফিকেশন শিডিউল করে।

config.msg – নোটিফিকেশন মেসেজ।

config.seconds – সেকেন্ডে নোটিফিকেশন ডিলে।

config.userData – নোটিফিকেশনে পাস করার জন্য অতিরিক্ত ডেটা।

success – সফল কলব্যাক।

fail – ত্রুটি কলব্যাক।

pushwoosh.createLocalNotification({msg:"Your pumpkins are ready!", seconds:30, userData:{}})

clearLocalNotification

Anchor link to
PushNotification.prototype.clearLocalNotification = function()

[android]
createLocalNotification দ্বারা তৈরি সমস্ত পেন্ডিং লোকাল নোটিফিকেশন ক্লিয়ার করে।

clearNotificationCenter

Anchor link to
PushNotification.prototype.clearNotificationCenter = function()

[android]
Android নোটিফিকেশন সেন্টারে প্রদর্শিত সমস্ত নোটিফিকেশন ক্লিয়ার করে।

setMultiNotificationMode

Anchor link to
PushNotification.prototype.setMultiNotificationMode = function( success, fail )

[android]
Android নোটিফিকেশন সেন্টারে একাধিক নোটিফিকেশন প্রদর্শনের অনুমতি দেয়।

setSingleNotificationMode

Anchor link to
PushNotification.prototype.setSingleNotificationMode = function( success,
fail )

[android]
Android নোটিফিকেশন সেন্টারে শুধুমাত্র শেষ নোটিফিকেশনটি প্রদর্শনের অনুমতি দেয়।

setSoundType

Anchor link to
PushNotification.prototype.setSoundType = function( type, success, fail )

[android]
আগত পুশগুলির জন্য ডিফল্ট সাউন্ড সেট করে।

type – সাউন্ডের ধরন (0 – ডিফল্ট, 1 – কোনো সাউন্ড নেই, 2 – সর্বদা)।

setVibrateType

Anchor link to
PushNotification.prototype.setVibrateType = function(type, success, fail )

[android]
আগত পুশগুলির জন্য ডিফল্ট ভাইব্রেশন মোড সেট করে।

type – ভাইব্রেশনের ধরন (0 – ডিফল্ট, 1 – কোনো ভাইব্রেশন নেই, 2 – সর্বদা)।

setLightScreenOnNotification

Anchor link to
PushNotification.prototype.setLightScreenOnNotification = function( on, success, fail )

[android]
নোটিফিকেশন এলে স্ক্রিন অন করে।

on – স্ক্রিন আনলক সক্রিয়/নিষ্ক্রিয় করুন (ডিফল্টরূপে নিষ্ক্রিয়)।

setEnableLED

Anchor link to
PushNotification.prototype.setEnableLED = function( on, success, fail )

[android]
নোটিফিকেশন এলে এবং ডিসপ্লে বন্ধ থাকলে LED ব্লিঙ্কিং সক্রিয় করে।

on – LED ব্লিঙ্ক সক্রিয়/নিষ্ক্রিয় করুন (ডিফল্টরূপে নিষ্ক্রিয়)।

setColorLED

Anchor link to
PushNotification.prototype.setColorLED = function( color, success, fail )

[android]
LED-এর রঙ সেট করে। setEnableLED-এর সাথে ব্যবহার করুন।

color – ARGB ইন্টিজার ফরম্যাটে LED-এর রঙ।

getPushHistory

Anchor link to
PushNotification.prototype.getPushHistory = function( success )

[android]
প্রাপ্ত পুশ নোটিফিকেশনগুলির একটি অ্যারে রিটার্ন করে।

success – সফল কলব্যাক।

pushwoosh.getPushHistory(function(pushHistory) {
if(pushHistory.length == 0)
alert("no push history");
else
alert(JSON.stringify(pushHistory));
});
pushwoosh.clearPushHistory();

clearPushHistory

Anchor link to
PushNotification.prototype.clearPushHistory = function()

[android]
পুশ হিস্ট্রি ক্লিয়ার করে।

cancelAllLocalNotifications

Anchor link to
PushNotification.prototype.cancelAllLocalNotifications = function( callback )

[ios]
নোটিফিকেশন সেন্টার থেকে সমস্ত লোকাল নোটিফিকেশন ক্লিয়ার করে।

presentInboxUI

Anchor link to

[android, ios]
ইনবক্স স্ক্রিন খোলে।

PushNotification.prototype.presentInboxUI = function()

setCommunicationEnabled

Anchor link to

একটি বাইনারি মেথড যা Pushwoosh-এর সাথে সমস্ত যোগাযোগ সক্রিয়/নিষ্ক্রিয় করে। বুলিয়ান মান false হলে ডিভাইসটি পুশ নোটিফিকেশন গ্রহণ থেকে আনসাবস্ক্রাইব হয় এবং ইন-অ্যাপ মেসেজ ডাউনলোড বন্ধ করে দেয়। মান true হলে এর বিপরীত প্রভাব হয়।

PushNotification.prototype.setCommunicationEnabled = function(enable, success, fail)

removeAllDeviceData

Anchor link to

ডিভাইস সম্পর্কে সমস্ত ডেটা মুছে ফেলে।

PushNotification.prototype.removeAllDeviceData = function()

push-receive

Anchor link to

[android, ios]
পুশ নোটিফিকেশন প্রাপ্তির ইভেন্ট। অ্যাপ্লিকেশন যখন ফোরগ্রাউন্ড বা ব্যাকগ্রাউন্ডে পুশ নোটিফিকেশন পায় তখন এটি ফায়ার হয়। বন্ধ অ্যাপ্লিকেশনগুলি এই ইভেন্টটি পায় না।

ইভেন্টের প্রপার্টি

message – (string) পুশ নোটিফিকেশন মেসেজ।

userdata – (object/array) পুশ নোটিফিকেশন কাস্টম ডেটা।

onStart – (boolean) এটি কি লঞ্চ নোটিফিকেশন?

foreground – (boolean) নোটিফিকেশন কি ফোরগ্রাউন্ডে প্রাপ্ত হয়েছে?

android – (object) Android নির্দিষ্ট নোটিফিকেশন পেলোড।

ios – (object) iOS নির্দিষ্ট নোটিফিকেশন পেলোড।

windows – (object) Windows নির্দিষ্ট নোটিফিকেশন পেলোড।

document.addEventListener('push-receive',
function(event) {
var userData = event.notification.userdata;
if (typeof(userData) != "undefined") {
// handle custom notification data
console.warn('user data: ' + JSON.stringify(userData));
}
}
);

ফোরগ্রাউন্ড নোটিফিকেশন

Anchor link to

ডিফল্টরূপে Pushwoosh প্লাগইন ফোরগ্রাউন্ডে নোটিফিকেশন প্রদর্শন করে না এবং স্বয়ংক্রিয়ভাবে push-receive ইভেন্ট ট্রিগার করে। এই আচরণ নিয়ন্ত্রণ করার জন্য প্লাগইন কাস্টমাইজেশন গাইড দেখুন।

push-notification

Anchor link to

[android, ios, wp8, windows]
পুশ নোটিফিকেশন গ্রহণ ইভেন্ট। ব্যবহারকারী যখন পুশ নোটিফিকেশনে ট্যাপ করে তখন এটি ফায়ার হয়।

document.addEventListener('push-notification',
function(event) {
var message = event.notification.message;
var userData = event.notification.userdata;
if (typeof(userData) != "undefined") {
console.warn('user data: ' + JSON.stringify(userData));
}
}
);

ইভেন্টের প্রপার্টি

push-receive-এর মতোই

additionalAuthorizationOptions

Anchor link to

[ios only]
অতিরিক্ত নোটিফিকেশন অথোরাইজেশন অপশন প্রদান করে। registerDevice কল করার আগে এটি কল করা উচিত।

pushwoosh.additionalAuthorizationOptions({
"UNAuthorizationOptionCriticalAlert" : 1,
"UNAuthorizationOptionProvisional": 0 // set 0 or don't specify the option if you don't want to add it to your app.
});