using GameSparks.Api;
using GameSparks.Api.Requests;
using GameSparks.Api.Responses;
new PushRegistrationRequest()
.SetPushId(pushId)
.Send((response) => {
string registrationId = response.RegistrationId;
GSData scriptData = response.ScriptData;
});
For Unity you will need a 3rd party plugin for get the push Id, there are many different ones available via the unity store.
Regards
Katie
S
Saad Anees
said
over 5 years ago
What is pushId? your docs are incomplete i guess. how do i get pushId in unity for android if im using FCM. I followed this link as your docs instruct so the token which I get when i set up FCM messaging like this as show in the picture. Please help me.
From your code it looks like you are sending the right information.
Is OnTokenReceived not firing or are you getting any errors?
Regards
Katie
S
Saad Anees
said
over 5 years ago
Thanks for your quick response. Yes its not firing. Also correct me that do i have to make build to see if its firing or does it work in unity editor too?
C
Christopher Bonnell
said
over 5 years ago
Per FCM docs, Firebase will not initialize in the editor. You have to compile it and test it on your device.
S
Saad Anees
said
over 5 years ago
Hello Christopher,
Yes you are right. I built it and i am getting pushIds in scriptData. But I still dont get push notification. Do i still need third party plugin to show notification?
Regards, Saad
C
Christopher Bonnell
said
over 5 years ago
Did you set up the payload JSON in GameSparks?
S
Saad Anees
said
over 5 years ago
Do you mean FCM template in google integration page?
C
Christopher Bonnell
said
over 5 years ago
Yes
S
Saad Anees
said
over 5 years ago
yes I did as mentioned GameSparks docs to setup FCM. One thing more. I tried using Firebase Notification to send message via push token. I copied pushId which received in in NoSQL and it gave an error saying Invalid Token. Then i tried different option to send message to bundle identifier of the app and I received message as push successfully.
C
Christopher Bonnell
said
over 5 years ago
Print out the Token via Debug.Log and make sure it matches the one put into NoSQL. If you are Android, you can use adb logcat | find "Unity"
S
Saad Anees
said
over 5 years ago
It doesn't get called in editor. and i dont know adb logcat. let me see that. thanks anyway.
C
Christopher Bonnell
said
over 5 years ago
adb will be in your android sdk. personally, I set up a local variable to always point to the sdk so I can just do 'adb logcat' in cmd
S
Saad Anees
said
over 5 years ago
Hello,
I asked one of the support member of GameSparks and he said the token i got is fine. I also tried GCM tutorial and test GCM from GameSparks. I got Status code: 200 which means response is okay. But i didn't receive any notification.
Agustín Díaz
Hello,
I'm trying to implemeng push notifications on Android and also iOS on my Unity's project.
For Android, I obtained the GCM API key from Firebase/Google consola.
I think that I have set properly the part of Gamesparks (I hope)
But how I can send the PushId from Unity's client?
On this tutorial https://docs.gamesparks.com/tutorials/social-features/configuring-android-push-notifications.html seems to easy that don't explain this part...
It would greatly appreciate any help!!
Many thanks and sorry for my english grammar ;-)
Hi Agustin
You need to send the pushId to Gamesparks using a PushRegistrationRequest
In Unity
For Unity you will need a 3rd party plugin for get the push Id, there are many different ones available via the unity store.
Regards
Katie
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Agustin
You need to send the pushId to Gamesparks using a PushRegistrationRequest
In Unity
For Unity you will need a 3rd party plugin for get the push Id, there are many different ones available via the unity store.
Regards
Katie
Saad Anees
What is pushId? your docs are incomplete i guess. how do i get pushId in unity for android if im using FCM. I followed this link as your docs instruct so the token which I get when i set up FCM messaging like this as show in the picture. Please help me.
Customer Support
Hi Saad Anees
A push id is a token that is received from the device.
In unity a plugin in is required to get a push Id from the device.
In the FCM plugin the push id is in the OnTokenReceived function in token.Token
From your code it looks like you are sending the right information.
Is OnTokenReceived not firing or are you getting any errors?
Regards
Katie
Saad Anees
Thanks for your quick response. Yes its not firing. Also correct me that do i have to make build to see if its firing or does it work in unity editor too?
Christopher Bonnell
Saad Anees
Hello Christopher,
Yes you are right. I built it and i am getting pushIds in scriptData. But I still dont get push notification. Do i still need third party plugin to show notification?
Regards,
Saad
Christopher Bonnell
Saad Anees
Do you mean FCM template in google integration page?
Christopher Bonnell
Saad Anees
yes I did as mentioned GameSparks docs to setup FCM. One thing more. I tried using Firebase Notification to send message via push token. I copied pushId which received in in NoSQL and it gave an error saying Invalid Token. Then i tried different option to send message to bundle identifier of the app and I received message as push successfully.
Christopher Bonnell
Saad Anees
It doesn't get called in editor. and i dont know adb logcat. let me see that. thanks anyway.
Christopher Bonnell
adb will be in your android sdk. personally, I set up a local variable to always point to the sdk so I can just do 'adb logcat' in cmd
Saad Anees
Hello,
I asked one of the support member of GameSparks and he said the token i got is fine. I also tried GCM tutorial and test GCM from GameSparks. I got Status code: 200 which means response is okay. But i didn't receive any notification.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics