question

garrygaber avatar image
garrygaber asked

Android Push Notifications - Invalid Parameter: Name Reason

In trying to setup Android Push Notifications on the Push Notifications tab of the developer console, I find that no matter what I enter in the Google server API key (including the valid keys from the Google Play Developer areas for cloud server and firebase, and the legacy key) I get the "Error: Invalid parameter: Name Reason: An application with the same name but different properties already exists" error. I even put the letter "a" in there, and I get the same result. Is there possibly something else wrong in my project triggering this besides the name?

Kindest Regards,
Garry

Push Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

In general, that error means that there's another project in Amazon SNS that has already claimed the name you're trying to use. Specifically, that's the name of your game. If you change the name of your Title ID to something more unique in the Game Manager, that should get you past this.

11 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

garrygaber avatar image garrygaber commented ·

Hi Brendan -

@Brendan - Before I do something terrible to my game that I can't undo, I just want to be crystal clear with what you're asking: I should change the title of my game in the Edit Title screen of Playfab to something else than "Starlight Weaponaire", to something like "Starlight Weaponaire Special"? And then, if I am doing this, will that mess up anything else in Playfab that is set up?

I'm guessing it won't, but want to insure I don't break anything to fix push on Android before I try this.

0 Likes 0 ·
garrygaber avatar image garrygaber garrygaber commented ·

And one other thing: can I change it back after I'm done establishing Push, or does it have to stay the altered name in Playfab for Push to continue working? My guess is that the conflict is because Apple Push uses this name for notifications and it's already out there through the Amazon service?

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

Correct. the name of the game is used when setting up Push in SNS, but it doesn't control anything in terms of the game behavior. Changing it won't "disconnect" any services. And I'd recommend leaving it set to whatever you change it to, so that if you have to re-register the title for Push, it'll already be set correctly.

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan - That worked great (and thank you for your help) - I can now see that push notifications are active under Push Notifications in Settings in my modified title game.

However, under Notifications in the player within the Game Manager, it has the "Push notifications are not set up" message. I can send push notifications through Firebase however, and they show up on the target device, so I know they work that way.

In my ADM, I see the Playfab: Received Registration Token, and there is a long value associated with it. When I send a message through Notifications with that token, it gets to the device as well.

Anything I can look for in Playfab or the ADM to fix this?

g

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

Did you use the Admin API call to set it up, or the Game Manager? What is the Title ID?

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan I used the Game Manager to set it up, then registered from the app. Title ID is 5F23.

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

Where are you seeing that error ("Push Notifications are not set up")? As far as I can see, they're set up fine, and are enabled for your PlayStream Actions.

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan. It isn’t an error - it shows up in the user’s player screen under Notifications. For my ios users, there is a registration block and ability to send messages there.

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

Ah, I see - the Push Notification registration of the user. Can you copy/paste the PlayFab ID of the user here? It's a bit hard to make out in that screenshot.

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan - Playfab ID is: Tiberius1701e : 5AC13144D0CDA238

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

So, I can confirm that the player account in question has no tokens for Push Notifications. Where in your game flow are you calling AndroidDevicePushNotificationRegistrationRegisterForIOSPushNotification?

0 Likes 0 ·
garrygaber avatar image
garrygaber answered

@Brendan I have a PlayFabLogin object that establishes all of the logins in my game - it is in the first scene and loads when the game starts.

Within PlayFabLogin, in this sequence I:

1. Set up PlayGamesPlatform (initializing an instance and activating)

2. GetDeviceID () (gets the android_id of the device)

3. Setup TokenReceived from FirebaseMessaging:

 Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;

OnTokenReceived looks like this:

private void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token)
{
 	Debug.Log("PlayFab:ReceivedRegistrationToken:" + token.Token);
 	pushToken = token.Token;
 	PlayFabPushRegister ();
 }

PlayfabPushRegister (called from OnTokenReceived) looks like this:

if (string.IsNullOrEmpty(pushToken) || string.IsNullOrEmpty(playFabId))
 	return;
var request = new AndroidDevicePushNotificationRegistrationRequest {
DeviceToken = pushToken,
SendPushNotificationConfirmation = true,
ConfirmationMessage = "Push notifications registered successfully"
 };
PlayFabClientAPI.AndroidDevicePushNotificationRegistration(request, OnPfAndroidReg, OnPfFail);

OnPfAndroidReg returns a Debug.Log letting me know that Playfab: Push Registration Successful.

And the OnPfFail returns an error.

4. Setup OnMessageReceived from FirebaseMessaging:

 Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;

OnMessageReceived looks like this:

private void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
 	Debug.Log("PlayFab:Receivedanewmessagefrom:" + e.Message.From);
 	lastMsg = "";
 	if (e.Message.Data != null)
 	{
 		lastMsg += "DATA:" + JsonWrapper.SerializeObject(e.Message.Data) + "\n";
 		Debug.Log("PlayFab:Receivedamessagewithdata:");
 		foreach (var pair in e.Message.Data)
 			Debug.Log("PlayFabdataelement:" + pair.Key + "," + pair.Value);
 	}
 	if (e.Message.Notification != null)
	 {
		Debug.Log("PlayFab:Receivedanotification:");
 		lastMsg += "TITLE:" + e.Message.Notification.Title + "\n";
 		lastMsg += "BODY:" + e.Message.Notification.Body + "\n";
 	}
 }

5. Login with the DeviceID through Playfab,

6. Authenticate through PlayGamesPlatform:

 PlayGamesPlatform.Instance.Authenticate(SignInCallback, false);

The SignInCallback sets my username in game or gives me a fail if it errors out.

Hopefully this helps!

g

11 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

I don't see any calls to AndroidDevicePushNotificationRegistration on Title ID 5F23 in the last week. You can see this in the API graph in your dashboard: https://developer.playfab.com/en-us/5F23/dashboard. Can you double-check the Title ID you have set, and re-check the test, stepping through the calls to confirm that they are indeed being made?

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan That last reply gave me the hint I needed to find out what was wrong. I did a debug and found that my playfabid hadn’t been registered before the Push Register with Playfab. It now works, however...

When I send a push to an Android device it sends with a title of 5F23, not the title of my game or the title that I punch into Playfab in Google Cloud Messaging.

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

How are you sending the Push, specifically? What parameters are you passing into the call? Also, what did you pass in as the Title in the call to https://api.playfab.com/documentation/admin/method/SetupPushNotification?

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan Not doing it through code. Just sending it from the user’s page.

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

Thanks. What did you pass into the call to SetupPushNotifications? Also, what do you see if you use SendPushNotification?

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan I haven't tried SendPushNotification (i.e. doing this through code), and setup was done entirely through the Push Notifications tab in the PlayFab settings:

It seems very similar to this post:

https://community.playfab.com/questions/16868/title-shown-playfabtitleid-on-android-push-notific.html

g

0 Likes 0 ·
capture-push.jpg (23.6 KiB)
brendan avatar image brendan garrygaber commented ·

So, how exactly did you send the Push Notification, then? Through a PlayStream Action? The screenshot above shows the ARN, but it doesn't tell me that the name was you passed into the SetupPushNotification call, which is why I'm asking for that information. The name you passed in there is the name SNS is going to use for all Push Notifications.

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan I sent it this way with this information:

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

Thanks, that confirms what I've been thinking. The issue is that when you called https://api.playfab.com/documentation/admin/method/SetupPushNotification, you used "5F23" as the Name parameter in the call. You need to re-register your title with the actual name of your game as the Name parameter in that call. What you're seeing is the name you set in SetupPushNotification. The way that "Send push notification" panel works, the resultant message is:

[Name of game]

[Message]

I'll file a bug on the panel, as it is confusing. The https://api.playfab.com/documentation/server/method/SendPushNotification call gives you the ability to specify a different Title to the Push, using the PushNotificationPackage (apart from iOS, which doesn't support this).

0 Likes 0 ·
fiveampsoftware avatar image fiveampsoftware brendan commented ·

When trying to set the name on ours, we get must contain only characters 'a'-'z', 'A'-'Z', '0'-'9', '_', '-', and '.'"

We see the same issue with seeing our title id in the push notification.

When we first created the title, it said our name of the game was already taken. So I renamed it. Maybe this didn't get applied? And then for notifications, I first tried to set it up in PlayFab (didn't use the SetupPushNotification call manually, just playfab interface) and that showed up as title id. I removed push notification feature and then did it via the Try It now on the api page. The name wouldn't allow us to put spaces... which doesn't make sense. So I removed the spaces and saw a success but we still see the title id being passed through

0 Likes 0 ·
Show more comments
garrygaber avatar image
garrygaber answered

@Brendan I thank you for the answer, but am very confused by it. I never called https://api.playfab.com/documentation/admin/method/SetupPushNotification and didn't use "5F23" as the Name parameter in the call, unless that is what happens when you manually set up push notifications in the developer console [not through code]. I wish I had done this, because then I would know how to undo it. :)

This is where it was set up:

What would I need to do to fix this?


1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

Yes, when you set up via the Game Manager, it uses whatever you have as the name of your game at that time. What I was suggesting was re-doing it, using the SetupPushNotification call specifically - which you did, so I'll answer that, below.

0 Likes 0 ·
garrygaber avatar image
garrygaber answered

@Brendan So I had no idea that this was possible, but by hitting 'TRY IT' on the admin function "SetupPushNotification' I was able to actually do a call (very handy!). However, after filling in all the necessary information (including a name change as specified above), and reregistering my device, it still says SF23 on the title. Here's what I entered (with the results):

Note: the Title ID was a drop down - I know I can change the name part of it, but the 5F23 is assigned by PlayFab.


1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

Glad you like it - I find that Try It and the Postman tool are two of the handiest (and quickest) ways to get testing done.

If you overwrote your ARN with a new one that has the name set, I can't see any reason it would be showing up with the Title ID rather than the name. I just tested this on our demo title, also using Android for the Push, and the name ("Unicorn Battle") of the game shows up correctly. Can you send your GCM API Key to us at devrel@playfab.com, so that we can try setting your title up from our side?

0 Likes 0 ·
garrygaber avatar image
garrygaber answered

@Brendan - just sent that info over - my theory is that the text push is sending the TitleID (not the Name, as it should) to the device, not happy with the space and stopping after the 5F23. This is just a theory, but that's what shows up on the device when I send this.

Thanks for looking into this, and yes, you guys should publicize "Try It" a bit more - I had no idea that was what it did, and now I see it being hugely valuable for my future workflow. :)

g

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

No, there's a space in the name of Unicorn Battle, so I don't think that's going to be the cause. I've just replaced your ARN - can you give it another try?

0 Likes 0 ·
garrygaber avatar image
garrygaber answered

@Brendan Just tried this (and sent a reply in the email to playful as well) - still no joy. I made sure I closed the app, then started it, made sure it was registered and it still came up with a message title of 5F23.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Okay, I believe we have this tracked down, and we have a bug open on it. Long story short, it is impacting newly set up titles, but only for Push messages coming from the Game Manager. Can you try testing a Push via the actual SendPushNotification API call? I believe you'll find that those look correct.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

fiveampsoftware avatar image fiveampsoftware commented ·

Hi Brendan - is there an eta for the fix? Still seeing the issue - I don't see it when I use the api. I created a cloud script workaround for this but using the Game Manager is much more usable

0 Likes 0 ·
brendan avatar image brendan fiveampsoftware commented ·

Sorry, but due to the work to confirm that everything is ready for GDPR, we're a bit behind. Were you able to confirm the behavior using a direct API call?

0 Likes 0 ·
garrygaber avatar image garrygaber commented ·

@Brendan Not yet. Been busy readying the game for release. I'll let you know as soon as I do test it.

0 Likes 0 ·
adrianvoinea avatar image
adrianvoinea answered

Hey there,

.

Maybe this helps you, as I did a bit of "logging", on Android.

.

I see the following issues, including differences between the way direct PNs are sent to an user (from the Game Manager, Player Overview) vs the way it is sent to all via Scheduled Tasks.

Let's assume in all cases, I'm trying to send a message: "TestMessage" with the title "TestTitle".

.

A) Sending a Playfab direct PN (from GameManager, Player Overview). Setting "TestTitle" and "TestMessage" in the notification window triggers the following result on the client:

- PN Title: Playfab TitleId, let's call it A321

- PN Message: "TestMessage" (what is expected)

- Extra Data: null

.

B) Sending PNs through the Scheduled Tasks interface triggers the following in the client:

- PN Title: none

- PN Message: none (the Firebase notification object is completely null)

- Extra Data:

- count 1: key = "default", value = "TestMessage"

.

Finally, I've did a global send to all via Firebase Cloud Messaging (in the Firebase Console), and all fields are coming in correctly.

Hope this helps.

.

Regards,

Adrian

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered

Hi there (All on this chain), I'm head of our Developer Tools team here at PlayFab. I'm taking over this issue and I am going to get to the bottom of it. I've read up on all posts in this thread.


From what I can see there are a few issues and I'll first confirm them all, then see it through that they get fixed if there are actual bugs in Game Manager and / or API sending Push Messages.

Understanding what was reported, I've gathered the following from the previous posts.

1. It appears that Game Manager send push has an issue where it does not set the Fields properly resulting in the TitleId showing as the Name of the App.

2. It appears that scheduled tasks may also have a problem sending push notifications in the Title and Message body.


I will make an attempt to validate these issues with our Sample Push notifications app over the next couple of days.

1. I'll have to update our sample to use the latest Firebase messaging so that I can test these scenarios.

2. I'll test that Game Manager & Scheduled tasks will perform as expected, if not I'll file issues with the appropriate teams ( if they have not been filed by Brendan already ) if they are filed, I'll follow up with the team(s) and get a status on a fix.

3. I'll also test via sending a push in the following ways: Via the API, Via CloudScript & Via a Rule.

Thanks for your patience, I'll try to get a speedy resolve on this and escalate where needed.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

garrygaber avatar image garrygaber commented ·

Thank you!

g

0 Likes 0 ·
fiveampsoftware avatar image fiveampsoftware commented ·

still shows up for us (checked just now) - I created a cloud script that is a temporary workaround. It pretty much just calls the push api in playfab. So it looks like GameManager uses the incorrect Subject for the message

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.