Our documentation is changing, please click here to enjoy it!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Retrieve custom parameters from Push/In-App/Geofence/Beacons

If you want to retrieve custom parameters from Push, In-App or Inbox features, call:

Code Block
BMA4S.setCustomParametersListener(your-callback-function)

Each time an Push/In-App is displayed or clicked, you will receive a response like this one:

Deck of Cards
idCustoms parameters
Card
labeliOS
Code Block
{
	"params": {
		"notificationParams": {
			"keyCustomParam1": "valueCustomParam1",
			"keyCustomParam2": "valueCustomParam2"
		},
		"notificationId":"1_2345678_12345678_12345678" 
	},
	"action": "CLICKED", 
	"categories":[PUSH_NOTIFICATIONS"]
}
 
Card
labelAndroid
Code Block
{
  "action": "CLICKED",
  "categories": [
    "PUSH_NOTIFICATIONS"
  ],
  "params": {
    "a4stitle": "",
    "a4sid": "251_530143_16632_3892",
    "collapse_key": "16632",
    "a4scancel": "Cancel",
    "a4scontent": "Rich push with webview",
    "a4sforeground": "y",
    "a4spopup": "y",
    "from": "255322792147",
    "a4surl": "http://google.fr",
    "my-key": "settings",
    "a4sok": "Let's see",
    "a4ssysid": "16632"
  }
}

 


Here, it's a push which has just been clicked.

 

action can contains:

Code Block
CLICKED
Code Block
DISPLAYED
Code Block
CLOSED
Code Block
TRIGGER

categories can contains:

Code Block
PUSH_NOTIFICATIONS
Code Block
INAPP_NOTIFICATIONS
Code Block
BEACON_NOTIFICATIONS
Code Block
GEOFENCE_NOTIFICATIONS
Info

Only our Android SDK is broadcasting BEACON_NOTIFICATIONS and GEOFENCE_NOTIFICATIONS information to third party developer.

All parameters including your custom parameters are inside params (here we have a custom param named 'my-key')

Geofence/Beacons

For a Geofence/Beacon, you will receive a response like this one :

Code Block
{
   "action":"TRIGGER",
   "categories":[
      "GEOFENCE_NOTIFICATIONS"
   ],
   "params":{
      "com.ad4screen.sdk.extra.GEOFENCE_PAYLOAD":{
         "transition":1,
         "ids":[
            "1921",
            "4282"
         ],
         "triggeringLocation":"{\"latitude\":48.8699786,\"longitude\":2.3347858,\"altitude\":0,\"accuracy\":26.3700008392334,\"bearing\":0,\"provider\":\"fused\",\"speed\":0,\"time\":1454670928159}"
      }
   }
}

Here, we have entered 2 geofences.

transition :

  • 1 for enter
  • 0 for exit

 

For a beacon, the key will be

 

Code Block
com.ad4screen.sdk.extra.BEACON_PAYLOAD

 

 instead of

Code Block
com.ad4screen.sdk.extra.GEOFENCE_PAYLOAD

 


More details can be found on Android#RetrievingBeaconinformationwithaBroadcastReceiver

Stop listening for custom parameters

If you don't want to retrieve custom parameters anymore, please call:

Code Block
BMA4S.removeCustomParametersListener()