Hello.
I'm writing SendPushNotification as follows.
[FunctionName("SendPushNotification")] public static async Task<dynamic> SendPushNotification( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string body = await req.ReadAsStringAsync(); var context = JsonConvert.DeserializeObject<PlayerPlayStreamFunctionExecutionContext<dynamic>>(body); string playFabId = context.PlayerProfile.PlayerId; var serverApi = GetServerInstance(context.TitleAuthenticationContext); var result = await serverApi.SendPushNotificationAsync(new SendPushNotificationRequest { Recipient = playFabId, AdvancedPlatformDelivery = new List<AdvancedPushPlatformMsg> { new AdvancedPushPlatformMsg { Json = "{\"alert\":{\"title\":\"プッシュ通知タイトル\",\"body\":\"プッシュ通知メッセージ\",\"badge\":1,\"sound\":\"default\"}", Platform = PushNotificationPlatform.ApplePushNotificationService }, new AdvancedPushPlatformMsg { Json = "{\"title\":\"プッシュ通知タイトル\",\"body\":\"プッシュ通知メッセージ\",\"sound\":\"default\"}", Platform = PushNotificationPlatform.GoogleCloudMessaging }, } }); return new { error = PlayFabSimpleJson.SerializeObject(result.Error), result = PlayFabSimpleJson.SerializeObject(result.Result) }; } private static PlayFabServerInstanceAPI GetServerInstance(TitleAuthenticationContext titleAuthenticationContext) { var apiSettings = new PlayFabApiSettings { TitleId = titleAuthenticationContext.Id, DeveloperSecretKey = Environment.GetEnvironmentVariable("PLAYFAB_DEV_SECRET_KEY", EnvironmentVariableTarget.Process), }; return new PlayFabServerInstanceAPI(apiSettings); }
I have specified two in AdvancedPlatformDelivery, iOS and Android, but apparently the first one is being used in a fixed way.
This means that when I put iOS and Android in the list in order, when I run Android push notifications, the iOS one will be called and I will get an error.
"error": "{\"HttpCode\":400,\"HttpStatus\":\"BadRequest\",\"Error\":1071,\"ErrorMessage\":\"Invalid JSON in request\",\"ErrorDetails\":{\"ValidationError\":[\"Unexpected end when deserializing object. Path 'alert', line 1, position 80.\"]},\"RequestId\":\"Failed to Enumerate RequestId. Exception message: Enumeration has not started. Call MoveNext.\"}",
Is this a bug?