I can send PushNotifications through Firebase Console, even when my application is Killed. (I had a little trouble because my device is a Huawei Honor)
But still didn't managed to get it working on GameSparks.
F
Flávio Correia
said
over 3 years ago
My device wasn't receiving notifications because I had a button to do a LogEventRequest to message EVENT, If my application is running and focused I can't receive the notification.
However, with application in background or killed, I receive notifications just fine If I run the Event through the TestHarness. No sound on notification though, Like through the FirebaseConsole, I'll have to do some reasearch on firebase docs.
Customer Support
said
over 3 years ago
Answer
Hi Flávio
To enable the default message sound add "sound" : true to the FCM template json in Messages
Please to go to configurator->messages->ScriptMessage Extensions and edit the script message you want to send as a notification.
Under FCM message Template
{
"notification": {
"title": "${data.title}",
"body": "${data.body}",
"sound": true
}
}
Regards
Katie
F
Flávio Correia
said
over 3 years ago
Done, Worked out of the box :)
Thank you Katie.
Customer Support
said
over 3 years ago
Hi Flávio
Great to hear it is working.
You can also add a custom notification sound
by changing true to a string of the sound file name(don't include file extension)
You will need to place the sound file in Unity under Assets\Plugins\Android\res\raw, you may need to create the res and raw folders
The app will need to be rebuilt for Device to get these changes.
Regards
Katie
1 person likes this
F
Flávio Correia
said
over 3 years ago
Definitely I'm gonna need this!! Thank you very much for the tip!
Customer Support
said
over 3 years ago
Hi Flávio
I have not had this problem, If a user has this disabled on there device I don't think there would be a way around it. Push notifications are set to high by default but you can manual add it { "priority": "high", "notification": { "title": "${data.title}", "body": "${data.body}", "sound": "mysound" } }
Regards Katie
F
Flávio Correia
said
over 3 years ago
I thought GameSparks would act like a service after building, and then, when user Receives Push Notification, It would call the App to run in background or something.
My problem is that by default In android systems, App Settings Notification Method => LockScreen is OFF, and Battery => Keep running after screen off is OFF aswell, so I can't receive Notifications.
It is most likely some user-permissions I have to set in Android Manifest and have nothing to do with GameSparks I think.
F
Flávio Correia
said
over 3 years ago
Just to clarify some users that might come across the same issue.
It seems that Huawei has a built in feature called Protected apps that prevents applications from keep running after the screen is turned Off. And by default installed applications are not put on the Protected Apps list. It's a Power Management Feature. (Galaxy S7 has something like that aswell I think)
So , it force closes the App, and users can't receive notifications.
There is no way to declare this on Android Manifest file. Just have to Advice users in a FAQ.
Notifications are OK if I close the app through "Swipe" on Android Opened Applications Menu, because it doesn't force close.
Anyway, appart from this, everything is running properly.
Flávio Correia
I've been trying to implement FCM with Unity and GameSparks.
Has anyone had sucess doing this?
Set the Listeners on Start
And then on
public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token)
So I can send it to GameSpark with a PushRegistrationRequest
And after that I can cal the Msg Event from the tutorial.
But I'm not getting a Token when the App Starts.
Anyone managed to implement this?
Thanks in advance.
Hi Flávio
To enable the default message sound add "sound" : true to the FCM template json in Messages
Please to go to configurator->messages->ScriptMessage Extensions and edit the script message you want to send as a notification.
Under FCM message Template
{
"notification": {
"title": "${data.title}",
"body": "${data.body}",
"sound": true
}
}
Regards
Katie
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstFlávio Correia
*and then on OnTokenReceived, I store it on a .txt to test and send it to GS
Flávio Correia
I've managed to get the Token, but I'm still confused ...
I've got the following in my code
I login on my device, and see the token in a label.
Then i go back to Harness and run the provided Event on tutorial
To send a message, but i don't receive the message on device.
Sockets are, OFF Pussh is ON , Supress push is OFF so it always pushes.
I'm pretty sure I'm doing something wrong but don't know what.
Flávio Correia
var msgData = msg.Send();
Flávio Correia
I can send PushNotifications through Firebase Console, even when my application is Killed.
(I had a little trouble because my device is a Huawei Honor)
But still didn't managed to get it working on GameSparks.
Flávio Correia
My device wasn't receiving notifications because I had a button to do a LogEventRequest to message EVENT, If my application is running and focused I can't receive the notification.
However, with application in background or killed, I receive notifications just fine If I run the Event through the TestHarness.
No sound on notification though, Like through the FirebaseConsole, I'll have to do some reasearch on firebase docs.
Customer Support
Hi Flávio
To enable the default message sound add "sound" : true to the FCM template json in Messages
Please to go to configurator->messages->ScriptMessage Extensions and edit the script message you want to send as a notification.
Under FCM message Template
{
"notification": {
"title": "${data.title}",
"body": "${data.body}",
"sound": true
}
}
Regards
Katie
Flávio Correia
Done, Worked out of the box :)
Thank you Katie.
Customer Support
Hi Flávio
Great to hear it is working.
You can also add a custom notification sound
by changing true to a string of the sound file name(don't include file extension)
You will need to place the sound file in Unity under Assets\Plugins\Android\res\raw, you may need to create the res and raw folders
The app will need to be rebuilt for Device to get these changes.
Regards
Katie
1 person likes this
Flávio Correia
Definitely I'm gonna need this!! Thank you very much for the tip!
Customer Support
I have not had this problem, If a user has this disabled on there device I don't think there would be a way around it.
Push notifications are set to high by default but you can manual add it
{
"priority": "high",
"notification": {
"title": "${data.title}",
"body": "${data.body}",
"sound": "mysound"
}
}
Regards
Katie
Flávio Correia
I thought GameSparks would act like a service after building, and then, when user Receives Push Notification, It would call the App to run in background or something.
My problem is that by default In android systems, App Settings Notification Method => LockScreen is OFF, and Battery => Keep running after screen off is OFF aswell, so I can't receive Notifications.
It is most likely some user-permissions I have to set in Android Manifest and have nothing to do with GameSparks I think.
Flávio Correia
Just to clarify some users that might come across the same issue.
It seems that Huawei has a built in feature called Protected apps that prevents applications from keep running after the screen is turned Off. And by default installed applications are not put on the Protected Apps list. It's a Power Management Feature.
(Galaxy S7 has something like that aswell I think)
So , it force closes the App, and users can't receive notifications.
There is no way to declare this on Android Manifest file.
Just have to Advice users in a FAQ.
Notifications are OK if I close the app through "Swipe" on Android Opened Applications Menu, because it doesn't force close.
Anyway, appart from this, everything is running properly.
-
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 2486 topics