question

monabindary avatar image
monabindary asked

pushNitification error:

I get Errors from this 2 lines of code

PlayFabAndroidPushPlugin.SendNotification.SendConfirmationMessage = true; // OPTIONAL: This sends a confirmation message when you register

PlayFabAndroidPushPlugin.ConfirmationMessage = "Push notifications registered successfully";
// OPTIONAL: This sends a confirmation message when you register

that PlayFabAndroidPushPlugin didnt contains ConfirmationMessage or SendNotification
any helpplz

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.

1807605288 avatar image
1807605288 answered

Hello, sorry to hear you are having issues.

Please delete all of the PlayFab push plugin files, and re-import the latest plugin here:

https://github.com/PlayFab/UnitySDK/tree/master/Packages

I believe you have somehow gotten files from two different versions of our plugin. We have recently put a lot of work into making our plugin much less bulky and difficult to use, but that's also meant that older versions are incompatible with newer ones.

We have removed the fields you describe in favor of a simpler approach.

public static void TriggerManualRegistration(string message = null)

If you are not trying to send a confirmation message, just call:

PlayFabAndroidPushPlugin.Setup(androidPushSenderId); // Before PlayFab login
// and
PlayFabAndroidPushPlugin.TriggerManualRegistration(); // After PlayFab login, and after player accepts/enables push notification (Google requires explicit player-interaction/permission before you send them push messages)

If you want to send a test confirmation message immediately, you can call TriggerManualRegistration with a string parameter: TriggerManualRegistration("This is a test message");

10 |1200

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

monabindary avatar image
monabindary answered

this is the code i attached to Gameobject in scene

private const string TITLE_ID = "3BED"; // TODO: Use your own titleId private const string ANDROID_PUSH_SENDER_ID = "334649036857"; // TODO: Use your own FCM SenderId private void Start()

{

PlayFabSettings.TitleId = TITLE_ID; PlayFabAndroidPushPlugin.Setup(ANDROID_PUSH_SENDER_ID); PlayFabAndroidPushPlugin.AlwaysShowOnNotificationBar(true);

StartLoginSequence();

}

private static void OnSharedFailure(PlayFabError error) {

Debug.LogError(error.GenerateErrorReport());

}

void StartLoginSequence()

{

var loginRequest = new LoginWithCustomIDRequest { CustomId = SystemInfo.deviceUniqueIdentifier, CreateAccount = true,

};

PlayFabClientAPI.LoginWithCustomID(loginRequest, OnLoginSuccess, OnSharedFailure); }

void OnLoginSuccess(LoginResult result) { PlayFabAndroidPushPlugin.TriggerManualRegistration("This is a test message");

}

but when i build and open the app nothing happened and there is no notification i get

kindly tell me wht's wrong

10 |1200

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

1807605288 avatar image
1807605288 answered

Please debug or add prints to your monobehavior object and ensure that the Start() function is triggering properly.

Also, I suspect the code above is incomplete, as it doesn't implement Start().

This block:

{
PlayFabSettings.TitleId = TITLE_ID;
PlayFabAndroidPushPlugin.Setup(ANDROID_PUSH_SENDER_ID);
PlayFabAndroidPushPlugin.AlwaysShowOnNotificationBar(true);
StartLoginSequence();
}

should be the body of your start function.

More information here: https://docs.unity3d.com/ScriptReference/MonoBehaviour.html

10 |1200

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

monabindary avatar image
monabindary answered

it's a body of start function and yes it enter the start if i debug
i bulild it in mobile but didnt recive anything

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.

1807605288 avatar image 1807605288 ♦ commented ·

The code you have posted is incomplete, so I can't determine the problem.

Since the latter issue is not related to push notifications, but rather making your first login call, I'm going to refer to you to our Unity Getting Started Guide:

https://api.playfab.com/docs/getting-started/unity-getting-started

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.