Reputation: 317
I am answering my own question here in case anyone runs into a similar problem.
I recently have been working with GoNative to spin up a hybrid native application for DoneDone, a task management and shared inbox tool.
I am also using OneSignal's push notification integration with GoNative to handle native push notifications to the user. In addition, I am sending out push notification messages from the server-side (C#/.NET in my case, but the server-side platform is irrelevant here).
I have already set up the necessary files to get universal links to open up in the native app rather than the browser (e.g. the apple-app-association-file
). I am getting push notifications created and sent correctly.
However, I cannot get the push notification to link to a specific page on the application via the server-side API.
In OneSignal's Create Notification API doc, it seems like you would send across either the url
, web_url
, or app_url
parameter in your JSON request. However, none of these work correctly if you are using GoNative's push notification integration with OneSignal.
For instance, if you use the url
or app_url
parameter, you get a secondary browser pop-up inside your native app, instead of a load from just your native app.
Upvotes: 1
Views: 1381
Reputation: 317
You need to set your own url value in the "Additional Data" property of your push notification. GoNative has documentation on this if you are creating push notifications from within OneSignal's web platform, but not specific guidance if you are programmatically creating push notifications via their API.
To do this via JSON, you add a targetUrl
value to the data
property.
{
"app_id":"3baaa656-8832-4733-a88b-b83aba2598a7",
"include_player_ids":[
"3baaa656-8832-4733-a88b-b83aba2598a7",
"3baaa656-8832-4733-a88b-b83aba2598a7"
],
"headings":{
"en":"DoneDone Project"
},
"subtitle":{
"en":"#123: This is a bug!"
},
"contents":{
"en":"Ka Wai Cheung created the task."
},
"data":{
"targetUrl":"[LINK TO THE WEB APP]"
}
}
Once you specify the targetUrl
, it works. I hope this saves someone time one day!
Upvotes: 2