I followed the new tutorial Implementing GCM Client on Android, and I'm unnable to make it work.
I get the token form my device succesfully, and when I send the following message
{
"to": "f19jCbaw-S4:APA91b....",
"notification": {
"body": "body",
"title": "title"
},
"data": {
"message": "test"
}
}
to https://gcm-http.googleapis.com/gcm/send, I get the result:
{
"multicast_id": 844556567...,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1433092445706613%..."
}
]
}
But my app is never entering into the the onMessageReceived of MyGcmListenerService class. The only clue that I have is the following log trace:
6399-6454/com.miapp.app W/GcmNotification﹕ Failed to show notification: Missing icon
I'm duplicated step by step the Google Cloud Messaging Quickstart sample project. Obviusly I use my api key and my sender id... but id does not work, my app never stops in my onMessageReceived method.
Anybody else is having this problem?
In fact the payload without notification should reach the "onMessageReceived" method and work fine, but if the notification is present into the payload, the same error is displayed "Failed to show notification: Missing icon".
I tried to set the icon inside the AndroidManifest.xml (on the both intent-filter, on the receiver), but nothing worked.
If you do not require notification, just remove them from the payload.
And if you need the notification, you need to add another required field inside the notification:
If your icon is inside the mipmap you can add:
"icon" : "ic_launcher"
if your icon is inside the drawable, you should have:
"icon" : "#drawable/ic_myicon"
So your new request would look like:
{
"to": "f19jCbaw-S4:APA91b....",
"notification": {
"body": "body",
"title": "title",
"icon" : "#drawable/ic_myicon"
},
"data": {
"message": "test"
}
}
Related
I'm asking this question on SO, since LinkedIn support is officially moved here.
I'm receiving HTTP 500 response from LinkedIn API endpoint while trying to create a share. This happens sporadically, but it is a quite often event last week or two. The weird part is that the share being created successfully.
Please advise. Could it be caused by spiking users activity on social media due to COVID19?
For the reference, here is request body POST-ed to https://api.linkedin.com/v2/shares (real ids are replaced).
{
"owner": "urn:li:organization:111111",
"text": {
"text": "Text text text"
},
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:111111"
}
],
"shareMediaCategory": "IMAGE"
},
"distribution": {
"linkedInDistributionTarget": {
"connectionsOnly": false,
"visibleToGuest": true
}
}
}
Response:
{
"message": "Internal Server Error",
"status": 500
}
I am sending push notification using FCM legacy API and by request looks like the following
POST https://fcm.googleapis.com/fcm/send
{
"to" : "USER-DEVICE-TOKEN",
"collapse_key" : "type_a",
"priority" : "high",
"notification" : {
"body" : "Getting this?",
"title": "Let me know if you got this message",
"icon": "ic_launcher"
},
"data": {
"one": "two"
}
}
This request returns the following response
{
"multicast_id": 144107415xxxxxxxxx,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1581xxxxx5%32xxxxxxxxx"
}
]
}
But the user never receives any push notification. This happens for most of the user but about 10% of total user does receive push notification send by the same mechanism. I am out of sorts regarding this, I don't know whats going on or even how to go about debugging this. Has anyone run into this issue? The app is written in React Native and uses invertase/react-native-firebase for firebase features. Thanks
After delete user from Active Directory(AD) got this notification (using Microsoft Graph subscription):
{
"value": [
{
"changeType": "updated",
"clientState": null,
"resource": "Users/{user-id}",
"resourceData": {
"#odata.type": "#Microsoft.Graph.User",
"#odata.id": "Users/{user-id}",
"id": "{user-id}",
"organizationId": "{organisation-id}",
"sequenceNumber": hidden
},
"subscriptionExpirationDateTime": "2019-01-17T12:48:43.7825578+00:00",
"subscriptionId": "hidden",
"tenantId": "hidden"
}
]
}
Next tried to get this user from Microsoft Graph
/GET https://graph.microsoft.com/v1.0/users/{user-id}
And got
{
"error": {
"code": "Request_ResourceNotFound",
"message": "Resource '{user-id}' does not exist or one of its queried reference-property objects are not present.",
"innerError": {
"request-id": "{user-id}",
"date": "2019-01-15T13:41:49"
}
}
}
why notification came with changeType = "updated" if user not exists?
When a user is deleted from the directory, they are "soft-deleted" (which means the object can still be access - see below, and restored). This type of change is modeled as an 'update'. We plan to improve that in future versions.
A resource will be finally hard-deleted (typically after 30 days), and when that happens you will see a 'deleted' notification.
Soft-deleted users cannot be access using users/id - hence the error you are seeing.
However, soft-deleted resources in Azure AD can be accessed using the special deletedItems API:
https://learn.microsoft.com/en-us/graph/api/directory-deleteditems-get?view=graph-rest-1.0
I'm not able to change 'text' in an announcements using Google-Classroom API.
When I try to use the PATCH method I have the following error:
{
"error": {
"code": 400,
"message": "updateMask: Non-supported update mask fields specified",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "updateMask",
"description": "Non-supported update mask fields specified"
}
]
}
]
}
}
request and updateMask
I send a updateMask 'text' and a text in request body.
When I try with the updateMask 'state,scheduledTime' I get a successful.
Has anyone ever had this error?
References:
https://developers.google.com/classroom/reference/rest/v1/courses.announcements/patch
I had the same issue. Despite what the documentation seems to indicate (that updateMask can be text), I couldn't get it to work.
I got around it by creating a new post with the information from the announcement, and deleting the old announcement.
This is probably what you did too.
I'm using EventStore and want to post a message (event) to it. I use the HTTP API for testing purposes. I've managed to post the event itself, with an event type specified, but I can't figure out how to specify metadata for my event. (and I must provide this metadata because my consuming application on the other side expects it).
This is what my HTTP request looks like:
Content-Type: application/json
ES-EventType: My.own.event.type
POST http://10.0.75.2:2113/web/index.html#/streams/foobar
{
"props": "andvalues"
}
Do I specify metadata in the body in through headers? I can't find much docs about this, only the official that doesn't mention it.
The documentation mentions the full schema for an event being written. It looks like this:
[
{
"eventId" : "string",
"eventType" : "string",
"data" : "object",
"metadata" : "object"
}
]
For example:
[
{
"eventId": "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4",
"eventType": "event-type",
"data": { "a": "1" },
"metadata": { "b": "2" }
}
]
Note that it's an array, and that you must pass content-type as application/vnd.eventstore.events+json
Check this page, scroll to Event Store Events Media Type.