Back to All

about push message (targetUrl & data)

I use one signal push message for my app, I can always receive push message, but Ive encountering some problems:

  1. I want to open the link send with the push message, I send the message by rest api with data:
    when I tap on the message when the app is awake (foreground/background), the app will always open the url successfully. However, if the app is close(swiped away), the push message will awake the app up but doesn't able to open the url anymore, even if I send another push message. What I have to do is shutdown the app then open the app again. So I can open the url by tapping push message....
    "data": { "targetUrl":"https://www.google.com"}	
    
  2. Since the last problem occurred, I tried to receive normal data in my app then handler the url by my self.
    What I did is: I defined a function in my app, but when I tap on the push message, the function doesn't get called. But indeed see the function is defined, because I turn up debug mode and able to log the function and call the function out. But I cant receive the data. Please help, thank you!
    window.median_onesignal_push_opened = function(data) {
    console.log('push notification data received:', data)
    }