iOS10 NotificationService Extension - ios10

The method:
didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler:(UNNotificationContent) -> Void)
of iOS 10's NotificationService TARGET is not triggered automatically by iOS, even if the payload of my remote notification contains the attribute: "mutable-content" : 1.
Here you are the payload example:
{
"aps": {
"alert": {
"body": "body",
"subtitle": "subtitle",
"title": "title"
},
"mutable-content": 1
}
}
Is there any missing configuration or code do I have to implement in order to make it works ?

You should run the application with the extension as a target, and choose the app you would like the extension to work with. Typically you will run the extension on the application in the containing project.
After running the Extension target, your app will load, and when you will send notifications with "mutable-content : 1", you will be able to step in debug mode.

Related

List Report custom action in extension not displayed

I have created a Custom Action to a List Report FE through an extension. The whole purpose is to export the data to a spreadsheet. While testing it from VS Code, all the added extensions do work. But after the app is deployed, none work.
FES is running SAPUI5 version 1.52.18 (S/4HANA 1709), in case you wonder.
Can't figure out if this is an error with the installation or in the extension I created.
Please find the code below:
Manifest:
"extensions": {
"sap.ui.viewExtensions": {
"sap.suite.ui.generic.template.ListReport.view.ListReport": {}
},
"sap.ui.controllerExtensions": {
"sap.suite.ui.generic.template.ListReport.view.ListReport": {
"controllerName": "com.sap.inventoryvariance.ext.controller.ListReportExt",
"sap.ui.generic.app": {
"ZGM_INV_VAR": {
"EntitySet": "ZGM_INV_VAR",
"Actions": {
"onExport": {
"id": "ExportBtn",
"text": "Export",
"press": "onExport",
"requiresSelection": false
}
Extension:
sap.ui.controller("com.sap.inventoryvariance.ext.controller.ListReportExt", {
onExport : function(oEvent) {
alert('ExportToExcel');
}
});
I even tried using the setting "useExportToExcel": true. While testing from VS Code, both work (but VS Code lowest SAPUI5 version is 1.65):
But from the deployed app, nothing happens:

action.devices.traits.TransportControl question

Trying to implement the action.devices.commands.mediaClosedCaptioningOn command for the TransportControl trait.. I have included 'CAPTION_CONTROL' in the transportControlSupportedCommands array I send on the SYNC intent for the device, but when I actually ask Assistant to turn on subtitles on the device it replies "That device cannot play video" and my code never actually gets an EXECUTE Intent from Assistant.
I've also successfully implemented the mediaShuffle command but noticed that when I issue it, Assistant responds with "Music will shuffle after the current item" when my device actually plays videos.
Anyone have any clue how I tell Assistant that my device plays video? I can't seem to find it in the documentation for TransportControl -- is it under a different trait maybe?
Edit 10/13/2020:
As requested, the complete SYNC response I'm currently sending for this device:
{
"requestId": "11724082196092058876",
"payload": {
"agentUserId": "xxxxxx",
"devices": [
{
"id": "10.0.6.252",
"type": "action.devices.types.STREAMING_STICK",
"traits": [
"action.devices.traits.TransportControl",
"action.devices.traits.Volume",
"action.devices.traits.MediaState"
],
"name": {
"name": "Bedroom Stick"
},
"willReportState": true,
"roomHint": "bedroom",
"attributes": {
"transportControlSupportedCommands": [
"NEXT",
"PREVIOUS",
"PAUSE",
"STOP",
"RESUME",
"CAPTION_CONTROL",
"SEEK_TO_POSITION",
"SEEK_RELATIVE",
"SET_REPEAT",
"SHUFFLE"
],
"volumeMaxLevel": 100,
"volumeCanMuteAndUnmute": true,
"levelStepSize": 10,
"commandOnlyVolume": false,
"volumeDefaultPercentage": 100,
"supportActivityState": false,
"supportPlaybackState": true
}
}
]
}
}
Exact assistant queries that produce this issue include "OK Google, turn on subtitles on Bedroom Stick" (Response: "That device can't play videos.") and "OK Google, shuffle on Bedroom Stick." (Response: "Alright, music will start shuffling after this track.")
There are certain changes you need to make to your sync response that you have posted which might make your device function properly .
In the sync response I do see that you are making use of a STREAMING_STICK as your device type. If you go through the documentation you will see that this device has the following required traits :
action.devices.traits.AppSelector
action.devices.traits.MediaState
action.devices.traits.TransportControl
action.devices.traits.Volume
Your sync response is missing the AppSelector trait.
It would be good to add the deviceInfo attribute at the end of the sync response.
More information about how to work around with Streaming stick can be found here :
https://developers.google.com/assistant/smarthome/guides/streamingstick#response

Asking for Confirmation overriding previous responses in Google Actions

The Problem
I have a Google Actions SDK project and I am using the nodejs client library for building fulfillment. I am facing some problem trying to use the Confirmation Helper intent. It is overriding previous responses given before it. Let me give you a simplified example of the problem:
First, Action says, "Hi, hope you are having a great day"
Then, Action asks for a Confirmation, "Do you want today's weather report?"
But in the simulator, all I hear is the second question. I am targeting a Voice Only situation, so I really need all the responses. Interestingly, I can see all the responses in the AUDIO tab of simulator. How can I hear both of these phrases?
I am copy/pasting the response JSON as shown in the RESPONSE tab.
{
"expectUserResponse": true,
"expectedInputs": [
{
"possibleIntents": [
{
"intent": "actions.intent.CONFIRMATION",
"inputValueData": {
"#type": "type.googleapis.com/google.actions.v2.ConfirmationValueSpec",
"dialogSpec": {
"requestConfirmationText": "Do you want today's weather report?"
}
}
}
],
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Hope you are doing well!"
}
}
]
}
}
}
],
"conversationToken": ""
}
How can I fix this situation. Thanks!
This is intentional behavior as using one of the intents like Confirmation will be the only response, and other responses will be ignored.
There are two potential ways to get around this.
Combine all of your responses to be in the Confirmation
Create your own Yes/No intent and use simple responses for everything.

Push Notifications not FULLY working unless tethered to Xcode

This has obviously been asked multiple times but I can't seem to get any of the proposed solutions working.
Push notifs work when tethered to xcode. Untethered, I get the push notification itself but none of the delegate methods are called which results in not being able to increment badge count.
I also can't get silent notifications working on untethered as well. I use silent notifications to clear a notification with a given condition.
I've tried allowing background mode in plist, changing priorities, having an empty body. I've made sure that the device background refresh is on and that notifs are fully on. I've tried a ton more things that I can't remember off the top of my head. Nothing seems to work. I added a badge increment in every one of the push notif delegate methods and it seems none of them get called.
Here is the .js code snippet for regular notif
message1 = {
notification: {
title: "stackOverFlowTitle",
body: "stackOverFlowBody"
},
apns: {
payload: {
aps : {
"content-available": 1,
"sound": "default",
"priority" : 10
},
data: {
// collection: 'TestCollection',
// document: change.after.ref.id,
timePushed: timePushed,
alertOn: alertOn,
readNotification: readNotification,
eventKey: eventKey
}
},
headers: {
"apns-expiration": "4"
}
},
topic: topic
};
Here is the .js code snippet for silent notif
var message2 = {
notification: {
body: ""
},
apns: {
payload: {
aps: {
"content-available": 1,
"priority" : 10
},
data: {
alertOn: alertOn,
eventKey: eventKey
}
},
headers: {
"apns-expiration": "4"
}
},
topic: topic
};
Anyone have any potential solutions I haven't mentioned?
I changed silent notif priority to 5 and that helped (for this post) :D
According to the docs, when non-zero the apns-expiration represents a unix timestamp. By setting it to 4, you're telling APNs to expire the notification at 1970-01-01 00:00:04.

Google Dialogflow Response Construction

I am trying to send a payload from my service with a Basic Card and the payload I am sending looks like such with the following fulfillmentMessages:
{
"fulfillmentMessages": [
{
"simpleResponses": {
"simpleResponses": [
{
"displayText": "A 13-inch laptop with advanced color, sound and streaming for an immersive viewing experience. Featuring Dell Cinema and next-generation InfinityEdge.",
"ssml": "<speak>Here's the first item I found. XPS 13 on sale for $849.99. To navigate you can say Next, Previous, or First. You can also say 'More Details' or 'Text me the product link'.</speak>"
}
]
}
},
{
"basicCard": {
"buttons": [
{
"openUriAction": {
"uri": "https://www.dell.com/en-us/shop/productdetails/xps-13-9370-laptop/dycwi622h"
},
"title": "See on Dell.com"
}
],
"formattedText": "A 13-inch laptop with advanced color, sound and streaming for an immersive viewing experience. Featuring Dell Cinema and next-generation InfinityEdge.",
"image": {
"accessibilityText": "product image",
"imageUri": "https://i.dell.com/is/image/DellContent//content/dam/global-site-design/product_images/dell_client_products/notebooks/xps_notebooks/13_9370/global_spi/rose_gold/notebook-xps-13-9370-best-of-500-rosegold-ng.psd?fmt=png-alpha"
},
"subtitle": "$849.99",
"title": "XPS 13"
}
}
]
}
I am running into issues with Actions On Google throwing errors with my payload defined this way:
MalformedResponse
Failed to parse Dialogflow response into AppResponse because of empty speech response.
I am unsure what the issue is here, or why Actions on Google throws this exception when the Dialogflow tester shows our card as expected.
How do I correctly format my payload so that both Actions on Google and Dialogflow display as expected?
Figured it out.
Needed to assign the platform value to each message object as "ACTIONS_ON_GOOGLE".