-1
我已經使用了來自github的黑莓代碼的pushcollector示例來整合推送通知,我在我的設備中接收通知,但是使用默認聲音和鈴聲圖標。我需要改變默認的鈴聲圖標和聲音與我提供的。我的設備是Dev Alpha B,版本是10.2.1.3061自定義黑莓級聯的推送通知聲音和圖標10
這是我的推送處理程序代碼,但它沒有設置聲音或圖標。任何幫助表示讚賞
void ApplicationUI::pushNotificationHandler(bb::network::PushPayload &pushPayload)
{
qDebug() << "Received push pushNotificationHandler";
PushHistoryItem pushHistoryItem(pushPayload.id());
if (m_pushNotificationService.checkForDuplicatePush(pushHistoryItem)) {
qWarning() << QString("Duplicate push was found with ID: %0.").arg(pushPayload.id());
return;
}
Push push(pushPayload);
push.setSeqNum(m_pushNotificationService.savePush(push));
Notification *notification = new Notification(NOTIFICATION_PREFIX + QString::number(push.seqNum()),this);
notification->setTitle("Yo");
PlatformInfo pkinfo;
QString osVersion=pkinfo.osVersion();
qDebug() <<"OS full:"<<osVersion;
osVersion.resize(4);
qDebug() <<"OS:"<<osVersion;
float versionValue=10.2;
if(osVersion.toFloat()>=versionValue)
{
qDebug() <<"Notification set:";
notification->setIconUrl(QUrl("file://" + QDir::currentPath() + "/app/native/assets/Images/customIcon.png"));
notification->setSoundUrl(QUrl("file://" + QDir::currentPath() + "/app/native/assets/Sounds/customSound.mp3"));
}
else
{
qDebug() <<"Notification unset OS version is:"<<osVersion.toFloat();
}
notification->setBody(QString("New %0 push received").arg(push.fileExtension()));
InvokeRequest invokeRequest;
invokeRequest.setTarget(INVOKE_TARGET_KEY_OPEN);
invokeRequest.setAction(BB_OPEN_INVOCATION_ACTION);
invokeRequest.setMimeType("text/plain");
invokeRequest.setData(QByteArray::number(push.seqNum()));
notification->setInvokeRequest(invokeRequest);
notification->notify();
m_model->insert(push.toMap());
if (pushPayload.isAckRequired()) {
m_pushNotificationService.acceptPush(pushPayload.id());
}
}