willblaschko / AlexaAndroid

A library and sample app to abstract access to the Amazon Alexa service for Android applications.
GNU General Public License v2.0
280 stars 132 forks source link

PlaybackFinished Event response is Bad Request always #137

Open prasannakumark opened 6 years ago

prasannakumark commented 6 years ago

Hi All,

When we send PlaybackFinished Event response always returns Exeception

Request : {"header":{"messageId":"5av2W5o3j88VzQgvz5LfTI7XX5zCbf.5f4fd0f9-bb9f-44f0-95ff-4cb36cf85b3d","name":"PlaybackFinished","namespace":"AudioPlayer"},"payload":{"token":"amzn1.as-ct.v1.Domain:Phatic:AlexaOriginals#ACRI#url#ACRI#AlexaOriginals|249cd095-7be5-4ee4-944d-06c90c83ba55|https:\/\/dvi8md6049w6b.cloudfront.net\/ira_v1_3f5d819f5c32d8ce96b4Songs_en_in_ira_moonlightsky.mp3?Expires=1516311617&Signature=ilUG~VjihwEzWrOEWhEEyjRY7MN~JoFpZ5HJiwxwf1uO8r45GMUTYuOGcLoM7PoLiclxp74ydH1MquFDiXZ2PB73XAZ~B7sCBYRNTbg7MpxXwQw47u5lIHYvkXcCCV2NDHoJs0S60ALElgKhOWzAURAWIitw5e-FtsKPz6tMwaYFBj0xLGEZ4z5HjKhy7SOasL6VlZ8FipX8GOb53Kz0t-GyiPK4Urkh012lvjH17xjkwhNq6fNeqyKW2lXj8s4Fn2jeMr3IUJRieLGLJY-ka83tUR2XqWzMwBean0TeNspS0RyvnXALlfoebtWIiqM1xkRRK1~QLNjDou9m-8l~cA&Key-Pair-Id=APKAJMAIYIGWWT37OIHA|Moonlight|1516282817644|A21TJRUUN4KGV|A356GS0CB7314K|en_IN|Alexa3P:1.0\/2018\/01\/18\/13\/d74fa0bfd5a64aefa5a7650cfff31a17\/40:16::TNIH_2V.868889bb-873c-4e0a-a367-eaae21e53138LPM\/0|9cb2d05d-a90f-4ed3-958e-0eeaf4d53f59|PhaticIntent"}}

Response : {"header":{"namespace":"System","name":"Exception","messageId":"1eaa56a6-9134-49b6-a106-626c0a8b7a64"},"payload":{"code":"INVALID_REQUEST_EXCEPTION","description":"Bad Request"}}

Please help me how to solve this problem.

brandall76 commented 6 years ago

@prasannakumark did you solve this issue? I'm having the same problem

prasannakumark commented 6 years ago

@brandall76 Yes its solved. we have to send .setPlayloadOffsetInMilliseconds(offset) as well. FYI, https://forums.developer.amazon.com/questions/105694/playbackfinished-event-response-is-bad-request-alw.html#answer-106368

brandall76 commented 6 years ago

Thank you @prasannakumark

I also found, when obfuscating the code, it was necessary to add the serialised names for gson

@SerializedName("header")

anoop4real commented 6 years ago

@prasannakumark Are you able to successfully use this library? Will this work with latest OS versions? Let me know