Alexa podcast skill stops playing after 1 second - alexa-skills-kit

This was working until a recent firmware update. Since then the stream starts playing and then stops almost immediately.
handlerInput.responseBuilder
.speak(`starting ${stream.metadata.title}`)
.addAudioPlayerPlayDirective('REPLACE_ALL', stream.url, stream.token, 0, null, stream.metadata);
return handlerInput.responseBuilder

Related

App refused in App store because of In-app purchase products exhibited bug on iPad running iOS 14.0.1 on Wi-Fi

I have been receiving this refusal reason from the app store for the third time. My app is being rejected for the same reason that there is one or more bug with in-app purchases while being tested in iPad running IOS 14.0.1. I have tested the app with Testflight in iPhone iOS 14.0.1 and I never get what it appears for them.
Message from the App Store
Guideline 2.1 - Performance - App Completeness
We found that your in-app purchase products exhibited one or more bugs
when reviewed on iPad running iOS 14.0.1 on Wi-Fi. Specifically, we
could not complete the in-app purchase. When purchasing, it goes into
an endless loop and the payment mechanism keeps presenting.
Next Steps
When validating receipts on your server, your server needs to be able
to handle a production-signed app getting its receipts from Appleā€™s
test environment. The recommended approach is for your production
server to always validate receipts against the production App Store
first. If validation fails with the error code "Sandbox receipt used
in production," you should validate against the test environment
instead.
Additionally, I don't validate purchases in my code.
I have tested the app in numerous iPhones in test flight and it works. Also, I don't get such an error/bug in dev with any of the emulators.
Any workaround for the app store?
In terms of code, Its a copy of Integrating In-App Purchases in Mobile Apps and Purchase Non-Consumable
async Task ExecuteRemoveAdCommand()
{
if (IsBusy) return;
IsBusy = true;
try
{
var connected = await CrossInAppBilling.Current.ConnectAsync();
if (!connected)
{
await App.Current.MainPage.DisplayAlert("Not Connected", "It seems something is wrong with your connection. " +
"We could not connect to the store, please try again", "OK");
return;
}
//try to purchase item
var purchase = await CrossInAppBilling.Current.PurchaseAsync(Helper.ProductId, ItemType.InAppPurchase, "apppayload");
if (purchase == null)
{
await App.Current.MainPage.DisplayAlert("Not Purchased", "We could not perform your purchase at the moment, please try again", "OK");
return;
}
else
{
//Purchased, save this information
var id = purchase.Id;
var token = purchase.PurchaseToken;
var state = purchase.State;
if (!string.IsNullOrEmpty(id))
{
await App.Current.MainPage.DisplayAlert("Purchase Successful", "You are enjoying ad free wQuran. Thank you for your purchase", "OK");
AdVisibility = false;
}
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
await App.Current.MainPage.DisplayAlert("Not Purchased", "We could not perform your purchase at the moment, please try again", "OK");
}
finally
{
await CrossInAppBilling.Current.DisconnectAsync();
IsBusy = false;
}
}
I finally managed to have my app in the App Store by repling the App review team with asking them to consider restarting their Ipad and reconnect their device to the internet.

Does anyone know how to pause the amazon alexa audio player without leaving the playback screen?

I'm developing an alexa skill that has an audio player interface, and am unable to pause the audio without leaving the playback screen. I've seen other apps have their alexa pause intent perform the same function as when you touch the pause button on the playback screen, and that is what I would like mine to do as well, but instead it takes me to a blank card with the name of my skill.
Currently I've been testing this on the amazon echo spot, and have been using the audio player stop directive in order to pause the audio as shown below. I don't care about when it was paused or any playback details because the audio I am playing is a stream so that doesn't matter.
const PauseIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.PauseIntent';
},
handle(handlerInput) {
return handlerInput.responseBuilder
.addAudioPlayerStopDirective()
.getResponse();
}
}
All I needed to do was add "withShouldEndSession(true)" to the response.

Firestore operation is hanging

Looking for some suggestions to further debug this issue.
I'm writing a Flutter app and have successfully used Firestore for many different operations. However, bizarrely, a very simple operation refuses to complete. I never get a response from my await call:
#override
Future<void> reportSnap(FeedItem item) async {
print("Adding report to database: $item");
await Firestore.instance.collection(_REPORTS).add(
{
_ReportsKey.image: item.imageName,
_ReportsKey.reported: DateTime.now(),
_ReportsKey.reporter: _user.id,
},
);
print("-> Done"); // Never printed, nothing appears in DB
}
The code that calls this function also never completes:
if (wantsToReport) {
print("Sending report to data service");
await _dataService.reportSnap(item);
print("Showing snack message..."); // never shown
_view.showSnackMessage("Thanks, we'll take a look"); // doesn't happen
}
Other database operations continue to work correctly, which seems to rule out hitting any quotas on my free Firebase plan. (I think I'm a long way away from those quotas, just desktop testing at the moment).
I appreciate there isn't a lot to go on here, but this is stumping me. Has anyone hit any similar problems before?

Adding a vocal "Ajax Spinner" to a long-running Alexa Response

I'm working on an Alexa skill that sometimes takes a while to respond. Sometimes it is running scripts in the background, turning on a TV, connecting a bluetooth device, etc. etc. A successful response can take up to 20+ seconds once all the automation is completed.
On the web, when there is a long-running request, we are used to seeing a progress bar, or at least an animated spinner with a message telling to please wait, or that the processes is underway. I need something similar for Alexa.
I'd like Alexa to respond TWICE to a SINGLE intent, once before the HTTP request is fired, and one once the response has been received. A sample conversation would be:
[User] : Alexa, tell [app name] to switch to theater mode.
[Alexa] : (Immediately) I'm on it! Hang tight.
(...20 seconds later...)
[Alexa] : Done! Theater mode was successfully activated. Enjoy!
I've got some code running on lambda here: http://jsfiddle.net/9gmszmku/embedded/js/
Excerpt:
// ================
// [TODO] RESPONSE HERE: Alexa says: "I'm on it" or "hang on one second..." before getting the response from the http request
// ================
// this request may take many seconds!!!! Ain't nobody got time for staring at Echo for a response!!!
var req = http.request(options, (res) => {
console.log(`STATUS: ${res.statusCode}`);
console.log(`HEADERS: ${JSON.stringify(res.headers)}`);
res.setEncoding('utf8');
var rawData = '';
res.on('data', (chunk) => rawData += chunk);
res.on('end', () => {
try {
var parsedData = JSON.parse(rawData);
console.log(parsedData);
context.succeed(generateResponse(buildSpeechletResponse(parsedData.message, true), {}));
} catch (e) {
context.succeed(generateResponse(buildSpeechletResponse("Error Parsing", true), {}));
}
});
Basically, I want to have Alexa respond upfront without closing the session, and again once the function is complete.
To the best of my knowledge, you can only have one speech output and I don't think you can inject any sort of wait up one sec logic into it. You could work around it by breaking the task up into smaller pieces, chaining them together and having Alexa notify the user at each stage?
Maybe you could play some music with the audioplayer interface while your task is working and/or you can inform the user about the long running task with a speech output.

ngCordova/Ionic Push Notifications when application is in the background

I'm currently building an android application using ionic/ngcordova. I'm at the point of implementing push notifications. I've implemented push notifications as a service which is injected at app.run(function(){..}) stage. The registration part works and I receive a callback containing the regid. Also, when the application is in the active state, the event is raised and the notification is received.
The problem I'm having is that when the application goes into the background, the notifications are not received at all. I would expect that a local notification would be raised when the app isn't running or something similar, but absolutely nothing happens, which is weird.
I've trawled the web for the last couple of days looking for a solution but I've been unable to find anything which kind of indicates to me that it should just work.
The following is my notificationService.js inside my app
app.factory('notificationService', ['$cordovaPush', function($cordovaPush){
var dataFactory = {};
//
// When the device is ready and this service has been plumbed in...
document.addEventListener("deviceready", function(){
console.log("initializing push notifications...");
_register();
}, false);
//
// Registers the device for push notifications...
var _register = function(){
var config = {};
if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){
// TODO: centralise this value as it can change...
config = {
senderID: "448168747432",
ecb: "onNotificationGCM"
};
}else {
// iOS
config = {
"badge":"true",
"sound":"true",
"alert":"true"
};
// Can add the following property to the config object to raise a callback with the information if need be...
// "ecb": "onNotificationRegisterAPN"
}
$cordovaPush.register(config).then(function(result){
//
// Typically returns "ok" for android and devicetoken for iOS
console.log(result);
});
};
window.onNotificationGCM = function(result){
console.log(result);
/*
I get called when the app is in the foreground, but nothing happens when the app is in the background.
*/
};
dataFactory.register = _register;
return dataFactory;
}]);
If it helps, I'm using PushSharp via a .net application in order to deliver the notifications. Any help would be greatly appreciated.
UPDATE: I'm using the following frameworks/libs:
Ionic Framework 1.2.14-beta6
Cordova 4.2.0
PushPlugin
For anyone else who's been pulling their hair out for a couple of days like I have, the solution was really simple...I was missing two properties in my Pushsharp QueueNotification request. So using the example given on the PushSharp github repo here: https://github.com/Redth/PushSharp#sample-code
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE-REGISTRATION-ID-HERE").WithJson("{\"alert\":\"Hello World!\",\"badge\":7,\"sound\":\"sound.caf\"}"));
Needs to be updated to add the missing properties:
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("DEVICE REGISTRATION ID HERE")
.WithJson(#"{""alert"":""This is the future"",""badge"":7,""sound"":""sound.caf"",""title"":""Status Bar title"",""message"":""Some text you want to display to the user""}"));
Otherwise if your app happens to be developed using Cordova and its not currently in the foreground, nothing, repeat nothing will happen.
Tip my hat to gdelavald with his comment on PushPlugin for pointing me in the right direction here:
https://github.com/phonegap-build/PushPlugin/issues/212

Resources