{"_id":"5770cbea4607a30e001debf6","user":"54e5a4a0d3ab670d00f3af54","updates":[],"link_url":"","githubsync":"","title":"1.14.0","version":"5770cba14607a30e001debc2","api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required"},"slug":"1140","hidden":false,"sync_unique":"","order":999,"excerpt":"","link_external":false,"category":"5770cba14607a30e001debc3","createdAt":"2016-06-27T06:47:06.595Z","isReference":false,"body":"- Minor bug fixes and stability improvements\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"https://issues.apache.org/jira/browse/CB-10530\\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\\ncordova platform rm ios\\ncordova platform add ios@4.1.0\",\n  \"title\": \"Major Cordova app freeze issue on iOS platforms prior to 4.1.0\"\n}\n[/block]","type":"basic","__v":0,"project":"56d4304373dcd20b00fb854e","childrenPages":[]}

1.14.0


- Minor bug fixes and stability improvements [block:callout] { "type": "warning", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0" } [/block]
- Minor bug fixes and stability improvements [block:callout] { "type": "warning", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0" } [/block]
{"_id":"5770cba14607a30e001debd4","githubsync":"","isReference":false,"sync_unique":"","title":"Getting started with the Proximity Public REST API","updates":[],"__v":0,"createdAt":"2016-02-29T12:01:36.844Z","excerpt":"","version":"5770cba14607a30e001debc2","order":0,"slug":"getting-started-with-the-proximity-public-rest-api","type":"basic","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":""},"body":"This documentation describes the public REST API for the Proximity Platform used to sync data. The following APIs are available:\n\n* **EventDefinition**\nGet EventDefinition by id\n* **EventDefinition Collection**\nGet all EventDefinitions for an account\n* **Location**\nGet Location by id\n* **Location collection**\nGet all Locations for an account\n* **Layer**\nGet Layer by id\n* **Layer collection**\nGet all Layers per Location\n* **Map**\nGet Map by id\n* **Map collection**\nGet all Maps per Layer\n* **Zone**\nGet Zone by id\n* **Zone collection**\nGet all Zones by ZoneOwner\n* **Image**\nGet Image by id\n* **Image Base64**\nGet Image by id Base64\n* **Meta-data revision**\nGet revision number\n* **BeaconEvent**\nSubmit BeaconEvent\n* **ZoneEvent**\nSubmit ZoneEvent","category":"5770cba14607a30e001debc4","parentDoc":null,"project":"56d4304373dcd20b00fb854e","user":"54e5a4a0d3ab670d00f3af54","hidden":false,"link_external":false,"link_url":"","childrenPages":[]}

Getting started with the Proximity Public REST API


This documentation describes the public REST API for the Proximity Platform used to sync data. The following APIs are available: * **EventDefinition** Get EventDefinition by id * **EventDefinition Collection** Get all EventDefinitions for an account * **Location** Get Location by id * **Location collection** Get all Locations for an account * **Layer** Get Layer by id * **Layer collection** Get all Layers per Location * **Map** Get Map by id * **Map collection** Get all Maps per Layer * **Zone** Get Zone by id * **Zone collection** Get all Zones by ZoneOwner * **Image** Get Image by id * **Image Base64** Get Image by id Base64 * **Meta-data revision** Get revision number * **BeaconEvent** Submit BeaconEvent * **ZoneEvent** Submit ZoneEvent
This documentation describes the public REST API for the Proximity Platform used to sync data. The following APIs are available: * **EventDefinition** Get EventDefinition by id * **EventDefinition Collection** Get all EventDefinitions for an account * **Location** Get Location by id * **Location collection** Get all Locations for an account * **Layer** Get Layer by id * **Layer collection** Get all Layers per Location * **Map** Get Map by id * **Map collection** Get all Maps per Layer * **Zone** Get Zone by id * **Zone collection** Get all Zones by ZoneOwner * **Image** Get Image by id * **Image Base64** Get Image by id Base64 * **Meta-data revision** Get revision number * **BeaconEvent** Submit BeaconEvent * **ZoneEvent** Submit ZoneEvent
{"_id":"5770cba14607a30e001debd5","hidden":false,"isReference":false,"link_url":"","order":1,"project":"56d4304373dcd20b00fb854e","__v":0,"createdAt":"2016-02-29T12:05:02.414Z","githubsync":"","user":"54e5a4a0d3ab670d00f3af54","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"EventDefinition {\\n  id (integer),\\n  accountId (integer),\\n  active (boolean),\\n  activeFrom (string),\\n  activeUntil (string),\\n  name (string),\\n  description (string, optional),\\n  trigger (string): ['OnEntry', 'OnExit'],\\n  frequency (string): ['Always', 'Never', 'Once', 'Hours', 'Days', 'Weeks', 'Months'],\\n  frequencyAmount (integer, optional),\\n  data {\\n    data (optional, type == 'Text') {\\n      en (string),\\n      de (string),\\n      fr (string),\\n      it (string)\\n    },\\n    url (string, optional, type == 'URL'),\\n    image (string, optional)\\n    type (string): ['Text', 'URL', 'Image']\\n  },\\n  zones (Array[Zone], optional)\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","version":"5770cba14607a30e001debc2","link_external":false,"slug":"event-definition","title":"EventDefinition","updates":[],"api":{"method":"get","params":[{"default":"","type":"int","name":"id","in":"path","_id":"56d43589de84300b002e4995","ref":"","required":true,"desc":"The id of the EventDefinition"}],"results":{"codes":[{"language":"json","code":"{\n  \"id\": 123,\n  \"accountId\": 1,\n  \"active\": true,\n  \"activeFrom\": \"2015-05-27T15:13:20.476\",\n  \"activeUntil\": \"2015-05-27T15:13:20.476\",\n  \"name\": \"Example Event\",\n  \"description\": \"Event description\",\n  \"trigger\": \"OnEntry\",\n  \"frequency\": \"Always\",\n  \"frequencyAmount\": null,\n  \"data\": {\n    \"data\": {\n      \"en\": \"English text data\",\n      \"de\": \"German text data\",\n      \"fr\": \"French text data\",\n      \"it\": \"Italian text data\"\n    },\n    \"type\": \"Text\"\n  },\n  \"zones\": [\n    {\n      \"id\": 1,\n      \"name\": \"Example Zone\",\n      \"description\": \"Zone description,\n      \"zoneSize\": \"SMALL\",\n      \"ownerId\": 1,\n      \"beacon\": null,\n      \"position\": {\n        \"latitude\": 38.20898825300811,\n        \"longitude\": 56.372997760772705\n      },\n      \"parents\": \"Map name / Layer name / Location name\"\n    }\n  ]\n}","name":"","status":200}]},"settings":"","url":"/api/event-definitions/:id","auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/event-definitions/65"}]}},"editedParams2":true,"sync_unique":"","type":"get","editedParams":true,"excerpt":"Get event definition by id","parentDoc":null,"childrenPages":[]}

getEventDefinition

Get event definition by id

Path Params

id:
required
integer
The id of the EventDefinition
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "EventDefinition {\n id (integer),\n accountId (integer),\n active (boolean),\n activeFrom (string),\n activeUntil (string),\n name (string),\n description (string, optional),\n trigger (string): ['OnEntry', 'OnExit'],\n frequency (string): ['Always', 'Never', 'Once', 'Hours', 'Days', 'Weeks', 'Months'],\n frequencyAmount (integer, optional),\n data {\n data (optional, type == 'Text') {\n en (string),\n de (string),\n fr (string),\n it (string)\n },\n url (string, optional, type == 'URL'),\n image (string, optional)\n type (string): ['Text', 'URL', 'Image']\n },\n zones (Array[Zone], optional)\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "EventDefinition {\n id (integer),\n accountId (integer),\n active (boolean),\n activeFrom (string),\n activeUntil (string),\n name (string),\n description (string, optional),\n trigger (string): ['OnEntry', 'OnExit'],\n frequency (string): ['Always', 'Never', 'Once', 'Hours', 'Days', 'Weeks', 'Months'],\n frequencyAmount (integer, optional),\n data {\n data (optional, type == 'Text') {\n en (string),\n de (string),\n fr (string),\n it (string)\n },\n url (string, optional, type == 'URL'),\n image (string, optional)\n type (string): ['Text', 'URL', 'Image']\n },\n zones (Array[Zone], optional)\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debd6","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Inline Model [\\n  EventDefinition\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","isReference":false,"link_external":false,"version":"5770cba14607a30e001debc2","createdAt":"2016-02-29T12:14:04.231Z","excerpt":"","hidden":false,"link_url":"","order":2,"project":"56d4304373dcd20b00fb854e","title":"EventDefinition Collection","__v":0,"updates":[],"user":"54e5a4a0d3ab670d00f3af54","type":"get","category":"5770cba14607a30e001debc4","parentDoc":null,"slug":"eventdefinition-collection","api":{"settings":"","url":"/api/event-definitions","auth":"required","examples":{"codes":[]},"method":"get","params":[],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"id\": 123,\n    \"accountId\": 1,\n    \"active\": true,\n    \"activeFrom\": null,\n    \"activeUntil\": null,\n    \"name\": \"Example Event\",\n    \"description\": \"Event description\",\n    \"trigger\": \"OnEntry\",\n    \"frequency\": \"Always\",\n    \"frequencyAmount\": null,\n    \"data\": {\n      \"data\": {\n        \"en\": \"English text data\",\n        \"de\": \"German text data\",\n        \"fr\": \"French text data\",\n        \"it\": \"Italian text data\"\n      },\n      \"type\": \"Text\"\n    },\n    \"zones\": [\n      {\n        \"id\": 1,\n        \"name\": \"Example Zone\",\n        \"description\": \"Zone description,\n        \"zoneSize\": \"SMALL\",\n        \"ownerId\": 1,\n        \"beacon\": null,\n        \"position\": {\n          \"latitude\": 38.20898825300811,\n          \"longitude\": 56.372997760772705\n        },\n        \"parents\": \"Swisscom \\ Zurich\"\n      }\n    ]\n  }\n]","name":""}]}},"sync_unique":"","githubsync":"","childrenPages":[]}

getEventDefinition Collection


[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n EventDefinition\n]", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n EventDefinition\n]", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debd7","version":"5770cba14607a30e001debc2","__v":0,"editedParams2":true,"link_external":false,"slug":"location","createdAt":"2016-02-29T12:18:59.132Z","title":"Location","type":"get","parentDoc":null,"project":"56d4304373dcd20b00fb854e","user":"54e5a4a0d3ab670d00f3af54","api":{"auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/locations/31"}]},"method":"get","params":[{"ref":"","required":true,"desc":"The id of the location","default":"","type":"int","name":"id","in":"path","_id":"56d43733ffd25c150090e03f"}],"results":{"codes":[{"code":"{\n    \"id\": 31,\n    \"accountId\": 16,\n    \"name\": \"Location name\",\n    \"description\": \"Location description\",\n    \"position\": {\n        \"latitude\": 47.37430544139123,\n        \"longitude\": 8.53136122226715\n    },\n    \"imageId\": 99\n}","name":"","status":200,"language":"json"}]},"settings":"","url":"/api/locations/:id"},"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Location {\\n  id (integer),\\n  accountId (integer),\\n  name (string),\\n  description (string, optional),\\n  position {\\n    latitude (float),\\n    longitude (float)\\n  }\\n  imageId (integer, optional)\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","githubsync":"","isReference":false,"hidden":false,"link_url":"","order":3,"sync_unique":"","category":"5770cba14607a30e001debc4","editedParams":true,"excerpt":"Get location by id","updates":[],"childrenPages":[]}

getLocation

Get location by id

Path Params

id:
required
integer
The id of the location
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Location {\n id (integer),\n accountId (integer),\n name (string),\n description (string, optional),\n position {\n latitude (float),\n longitude (float)\n }\n imageId (integer, optional)\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Location {\n id (integer),\n accountId (integer),\n name (string),\n description (string, optional),\n position {\n latitude (float),\n longitude (float)\n }\n imageId (integer, optional)\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debd8","parentDoc":null,"title":"LocationCollection","type":"get","__v":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Inline Model [\\n  Location\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","link_external":false,"excerpt":"Get all Locations for an account","isReference":false,"order":4,"sync_unique":"","createdAt":"2016-02-29T12:20:35.176Z","githubsync":"","slug":"locationcollection","user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[],"results":{"codes":[{"status":200,"language":"json","code":"[\n    {\n        \"id\": 31,\n        \"accountId\": 16,\n        \"name\": \"Location name\",\n        \"description\": \"Location description\",\n        \"position\": {\n            \"latitude\": 47.37430544139123,\n            \"longitude\": 8.53136122226715\n        },\n        \"imageId\": 99\n    }\n]","name":""}]},"settings":"","url":"/api/locations"},"hidden":false,"link_url":"","project":"56d4304373dcd20b00fb854e","updates":[],"childrenPages":[]}

getLocationCollection

Get all Locations for an account

[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Location\n]", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Location\n]", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debd9","api":{"auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/layers/84"}]},"method":"get","params":[{"type":"int","name":"id","in":"path","_id":"56d437f78001e30b00896e31","ref":"","required":true,"desc":"The id of the Layer","default":""}],"results":{"codes":[{"code":"{\n    \"id\": 84,\n    \"name\": \"Layer name\",\n    \"description\": \"Layer description\"\n}","name":"","status":200,"language":"json"}]},"settings":"","url":"/api/layers/:id"},"editedParams":true,"editedParams2":true,"order":5,"title":"Layer","user":"54e5a4a0d3ab670d00f3af54","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Layer {\\n  id (integer),\\n  name (string),\\n  description (string, optional)\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","createdAt":"2016-02-29T12:22:15.707Z","parentDoc":null,"slug":"layer","version":"5770cba14607a30e001debc2","type":"get","__v":0,"category":"5770cba14607a30e001debc4","githubsync":"","isReference":false,"link_external":false,"link_url":"","project":"56d4304373dcd20b00fb854e","excerpt":"Get Layer by id","hidden":false,"sync_unique":"","updates":[],"childrenPages":[]}

getLayer

Get Layer by id

Path Params

id:
required
integer
The id of the Layer
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Layer {\n id (integer),\n name (string),\n description (string, optional)\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Layer {\n id (integer),\n name (string),\n description (string, optional)\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debda","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Inline Model [\\n  Layer\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","createdAt":"2016-02-29T12:31:29.567Z","sync_unique":"","user":"54e5a4a0d3ab670d00f3af54","link_external":false,"link_url":"","project":"56d4304373dcd20b00fb854e","slug":"layer-collection","version":"5770cba14607a30e001debc2","editedParams2":true,"excerpt":"Get all Layers per Location","githubsync":"","hidden":false,"title":"Layer Collection","type":"get","order":6,"parentDoc":null,"__v":0,"api":{"examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/layers?location=31"}]},"method":"get","params":[{"default":"","type":"string","name":"locationId","in":"path","_id":"56d43a2173dcd20b00fb8576","ref":"","required":true,"desc":"The id of the Location"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n    {\n        \"id\": 84,\n        \"name\": \"Layer name\",\n        \"description\": \"Layer description\"\n    }\n]","name":""}]},"settings":"","url":"/api/layers?location=:locationId","auth":"required"},"category":"5770cba14607a30e001debc4","editedParams":true,"isReference":false,"updates":[],"childrenPages":[]}

getLayer Collection

Get all Layers per Location

Path Params

locationId:
required
string
The id of the Location
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Layer\n]", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Layer\n]", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debdb","sync_unique":"","api":{"url":"/api/maps/:id","auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/maps/85"}]},"method":"get","params":[{"name":"id","in":"path","_id":"56d43a9373dcd20b00fb8579","ref":"","required":false,"desc":"The id of the Map","default":"","type":"string"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"id\": 85,\n    \"name\": \"Map name\",\n    \"description\": \"Map description\",\n    \"topLeft\": {\n        \"latitude\": 47.37463387587801,\n        \"longitude\": 8.530282056138743\n    },\n    \"topRight\": {\n        \"latitude\": 47.3750195838079,\n        \"longitude\": 8.530700452936712\n    },\n    \"bottomLeft\": {\n        \"latitude\": 47.37406719678461,\n        \"longitude\": 8.531421176778254\n    },\n    \"bottomRight\": {\n        \"latitude\": 47.374452904714495,\n        \"longitude\": 8.531839573576223\n    },\n    \"markerStart\": {\n        \"latitude\": 0.7271380731413705,\n        \"longitude\": 0.3149986267089844\n    },\n    \"markerEnd\": {\n        \"latitude\": 0.6933233804787696,\n        \"longitude\": 0.3071022033691406\n    },\n    \"markerDistance\": 3.7,\n    \"imageId\": 100\n}","name":""}]},"settings":""},"order":7,"project":"56d4304373dcd20b00fb854e","user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","editedParams":true,"editedParams2":true,"githubsync":"","excerpt":"Get Map by id","hidden":false,"link_url":"","parentDoc":null,"slug":"map","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Map {\\n  id (integer),\\n  name (string)\\n  description (string, optional)\\n  topLeft {\\n    latitude (float),\\n    longitude (float),\\n  },\\n  topRight {\\n    latitude (float),\\n    longitude (float)\\n  },\\n  bottomLeft {\\n    latitude (float)\\n    longitude (float)\\n  },\\n  bottomRight {\\n    latitude (float)\\n    longitude (float)\\n  },\\n  markerStart {\\n    latitude (float)\\n    longitude (float)\\n  },\\n  markerEnd {\\n    latitude (float)\\n    longitude (float)\\n  },\\n  markerDistance (integer),\\n  imageId (integer)\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","createdAt":"2016-02-29T12:33:23.901Z","updates":[],"title":"Map","type":"get","__v":0,"isReference":false,"link_external":false,"childrenPages":[]}

getMap

Get Map by id

Path Params

id:
string
The id of the Map
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Map {\n id (integer),\n name (string)\n description (string, optional)\n topLeft {\n latitude (float),\n longitude (float),\n },\n topRight {\n latitude (float),\n longitude (float)\n },\n bottomLeft {\n latitude (float)\n longitude (float)\n },\n bottomRight {\n latitude (float)\n longitude (float)\n },\n markerStart {\n latitude (float)\n longitude (float)\n },\n markerEnd {\n latitude (float)\n longitude (float)\n },\n markerDistance (integer),\n imageId (integer)\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Map {\n id (integer),\n name (string)\n description (string, optional)\n topLeft {\n latitude (float),\n longitude (float),\n },\n topRight {\n latitude (float),\n longitude (float)\n },\n bottomLeft {\n latitude (float)\n longitude (float)\n },\n bottomRight {\n latitude (float)\n longitude (float)\n },\n markerStart {\n latitude (float)\n longitude (float)\n },\n markerEnd {\n latitude (float)\n longitude (float)\n },\n markerDistance (integer),\n imageId (integer)\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debdc","user":"54e5a4a0d3ab670d00f3af54","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Inline Model [\\n  Map\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","createdAt":"2016-02-29T12:34:49.900Z","githubsync":"","link_url":"","slug":"map-collection","type":"get","api":{"examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/maps?layer=84"}]},"method":"get","params":[{"desc":"The id of the Layer","default":"","type":"string","name":"layerId","in":"path","_id":"56d43ae9ffd25c150090e044","ref":"","required":false}],"results":{"codes":[{"status":200,"language":"json","code":"[\n    {\n        \"id\": 85,\n        \"name\": \"Map name\",\n        \"description\": \"Map description\",\n        \"topLeft\": {\n            \"latitude\": 47.37463387587801,\n            \"longitude\": 8.530282056138743\n        },\n        \"topRight\": {\n            \"latitude\": 47.3750195838079,\n            \"longitude\": 8.530700452936712\n        },\n        \"bottomLeft\": {\n            \"latitude\": 47.37406719678461,\n            \"longitude\": 8.531421176778254\n        },\n        \"bottomRight\": {\n            \"latitude\": 47.374452904714495,\n            \"longitude\": 8.531839573576223\n        },\n        \"markerStart\": {\n            \"latitude\": 0.7271380731413705,\n            \"longitude\": 0.3149986267089844\n        },\n        \"markerEnd\": {\n            \"latitude\": 0.6933233804787696,\n            \"longitude\": 0.3071022033691406\n        },\n        \"markerDistance\": 3.7,\n        \"imageId\": 100\n    }\n]","name":""}]},"settings":"","url":"/api/maps?layer=:layerId","auth":"required"},"editedParams":true,"isReference":false,"link_external":false,"order":8,"parentDoc":null,"updates":[],"title":"Map Collection","__v":0,"editedParams2":true,"excerpt":"Get all Maps per Layer","hidden":false,"project":"56d4304373dcd20b00fb854e","sync_unique":"","version":"5770cba14607a30e001debc2","childrenPages":[]}

getMap Collection

Get all Maps per Layer

Path Params

layerId:
string
The id of the Layer
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Map\n]", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Map\n]", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debdd","excerpt":"Get Zone by id","slug":"zone","sync_unique":"","user":"54e5a4a0d3ab670d00f3af54","__v":0,"createdAt":"2016-02-29T13:55:55.503Z","editedParams":true,"githubsync":"","order":9,"title":"Zone","category":"5770cba14607a30e001debc4","editedParams2":true,"hidden":false,"link_external":false,"type":"get","version":"5770cba14607a30e001debc2","updates":[],"api":{"params":[{"ref":"","required":false,"desc":"The id of the Zone","default":"","type":"int","name":"id","in":"path","_id":"56d44deb73dcd20b00fb85c2"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"id\": 123,\n  \"name\": \"Example Zone\",\n  \"description\": \"Description of the Example Zone\",\n  \"zoneSize\": \"LARGE\",\n  \"ownerId\": 13,\n  \"beacon\": {\n    \"id\": 20,\n    \"accountId\": 25,\n    \"name\": \"Example Beacon\",\n    \"description\": \"Decription of the Example Beacon\",\n    \"vendor\": \"KONTAKT_IO\",\n    \"vendorSpecificId\": \"Only set for vendor == KONTAKT_IO\",\n    \"uuid\": \"abcd-1234-abcd\",\n    \"major\": 1000,\n    \"minor\": 10,\n    \"password\": \"Super secret password\",\n    \"txPower\": 13,\n    \"signalInterval\": 10,\n    \"firmwareVersion\": \"V_1.0\",\n    \"installationDate\": \"2015-05-27T15:13:20.476\",\n    \"imageId\": 156,\n    \"zoneId\": 8\n  },\n  \"position\": {\n    \"latitude\": 48.20913125006481,\n    \"longitude\": 16.36086344718933\n  },\n  \"parents\": \"Example Map / Example Layer / Zurich\"\n}","name":""}]},"settings":"","url":"/api/zones/:id","auth":"required","examples":{"codes":[{"code":"https://proximity.indoo.rs/api/zones/116","language":"text"}]},"method":"get"},"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Zone {\\n  id (integer),\\n  name (string),\\n  description (string),\\n  zoneSize (string): ['SMALL', 'MEDIUM', 'LARGE'],\\n  ownerId (integer),\\n  beacon (optional) {\\n    id (integer),\\n    accountID (integer),\\n    name (string),\\n    decription (string, optional),\\n    vendor (string): ['BEACON_INSIDE', 'KONTAKT_IO', 'OTHER'],\\n    vendorSpecificId (string, optional),\\n    uuid (string),\\n    major (integer),\\n    minor (integer),\\n    password (string, optional),\\n    txPower (float),\\n    signalInterval (float, optional),\\n    firmwareVersion (string, optional),\\n    installationDate (string, optional),\\n    imageId (integer, optional),\\n    zoneId (integer, optional)\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","isReference":false,"link_url":"","parentDoc":null,"project":"56d4304373dcd20b00fb854e","childrenPages":[]}

getZone

Get Zone by id

Path Params

id:
integer
The id of the Zone
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Zone {\n id (integer),\n name (string),\n description (string),\n zoneSize (string): ['SMALL', 'MEDIUM', 'LARGE'],\n ownerId (integer),\n beacon (optional) {\n id (integer),\n accountID (integer),\n name (string),\n decription (string, optional),\n vendor (string): ['BEACON_INSIDE', 'KONTAKT_IO', 'OTHER'],\n vendorSpecificId (string, optional),\n uuid (string),\n major (integer),\n minor (integer),\n password (string, optional),\n txPower (float),\n signalInterval (float, optional),\n firmwareVersion (string, optional),\n installationDate (string, optional),\n imageId (integer, optional),\n zoneId (integer, optional)\n }\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Zone {\n id (integer),\n name (string),\n description (string),\n zoneSize (string): ['SMALL', 'MEDIUM', 'LARGE'],\n ownerId (integer),\n beacon (optional) {\n id (integer),\n accountID (integer),\n name (string),\n decription (string, optional),\n vendor (string): ['BEACON_INSIDE', 'KONTAKT_IO', 'OTHER'],\n vendorSpecificId (string, optional),\n uuid (string),\n major (integer),\n minor (integer),\n password (string, optional),\n txPower (float),\n signalInterval (float, optional),\n firmwareVersion (string, optional),\n installationDate (string, optional),\n imageId (integer, optional),\n zoneId (integer, optional)\n }\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debde","createdAt":"2016-02-29T13:57:23.093Z","order":10,"excerpt":"Get all Zones by ZoneOwner which can be a Layer or a Map","githubsync":"","parentDoc":null,"project":"56d4304373dcd20b00fb854e","type":"get","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Inline Model [\\n  Zone\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","updates":[],"user":"54e5a4a0d3ab670d00f3af54","link_external":false,"link_url":"","slug":"zone-collection","title":"Zone Collection","version":"5770cba14607a30e001debc2","__v":0,"editedParams":true,"editedParams2":true,"sync_unique":"","api":{"method":"get","params":[{"default":"","type":"int","name":"ownerId","in":"path","_id":"56d44e438001e30b00896e78","ref":"","required":false,"desc":"The id of the ZoneOwner"}],"results":{"codes":[{"language":"json","code":"[\n  {\n    \"id\": 123,\n    \"name\": \"Example Zone\",\n    \"description\": \"Description of the Example Zone\",\n    \"zoneSize\": \"LARGE\",\n    \"ownerId\": 13,\n    \"beacon\": {\n      \"id\": 20,\n      \"accountId\": 25,\n      \"name\": \"Example Beacon\",\n      \"description\": \"Decription of the Example Beacon\",\n      \"vendor\": \"KONTAKT_IO\",\n      \"vendorSpecificId\": \"Only set for vendor == KONTAKT_IO\",\n      \"uuid\": \"abcd-1234-abcd\",\n      \"major\": 1000,\n      \"minor\": 10,\n      \"password\": \"Super secret password\",\n      \"txPower\": 13,\n      \"signalInterval\": 10,\n      \"firmwareVersion\": \"V_1.0\",\n      \"installationDate\": \"2015-05-27T15:13:20.476\",\n      \"imageId\": 156,\n      \"zoneId\": 8\n    },\n    \"position\": {\n      \"latitude\": 48.20913125006481,\n      \"longitude\": 16.36086344718933\n    },\n    \"parents\": \"Example Map / Example Layer / Zurich\"\n  }\n]","name":"","status":200}]},"settings":"","url":"/api/zones?owner=:ownerId","auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/zones?owner=85"}]}},"hidden":false,"isReference":false,"childrenPages":[]}

getZone Collection

Get all Zones by ZoneOwner which can be a Layer or a Map

Path Params

ownerId:
integer
The id of the ZoneOwner
[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Zone\n]", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "Inline Model [\n Zone\n]", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debdf","createdAt":"2016-02-29T13:59:20.304Z","excerpt":"Get Image by id","parentDoc":null,"title":"Image","user":"54e5a4a0d3ab670d00f3af54","api":{"results":{"codes":[{"language":"text","code":""}]},"settings":"","url":"/api/images/:id","auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/images/100"}]},"method":"get","params":[{"name":"id","in":"path","_id":"56d44eb873dcd20b00fb85c7","ref":"","required":true,"desc":"The id of the Image","default":"","type":"int"}]},"body":"","link_external":false,"updates":[],"__v":0,"category":"5770cba14607a30e001debc4","editedParams":true,"editedParams2":true,"project":"56d4304373dcd20b00fb854e","slug":"image","sync_unique":"","githubsync":"","hidden":false,"isReference":false,"link_url":"","order":11,"type":"get","version":"5770cba14607a30e001debc2","childrenPages":[]}

getImage

Get Image by id

Path Params

id:
required
integer
The id of the Image

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples



{"_id":"5770cba14607a30e001debe0","title":"Image Base64","__v":0,"createdAt":"2016-02-29T14:01:59.320Z","editedParams":true,"slug":"image-base64","link_external":false,"link_url":"","order":12,"parentDoc":null,"body":"The endpoint returns a base64 encoded data url as plain text.","category":"5770cba14607a30e001debc4","excerpt":"Get Image by id encoded as Base64 string","githubsync":"","sync_unique":"","type":"get","updates":[],"isReference":false,"project":"56d4304373dcd20b00fb854e","user":"54e5a4a0d3ab670d00f3af54","api":{"url":"/api/images/:id/encoded","auth":"required","examples":{"codes":[{"code":"https://proximity.indoo.rs/api/images/100/encoded","language":"text"}]},"method":"get","params":[{"required":true,"desc":"The id of the Image","default":"","type":"int","name":"id","in":"path","_id":"56d44f57ffd25c150090e0b8","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"data:[<mediatype>][;base64],<data>","name":""}]},"settings":""},"editedParams2":true,"hidden":false,"version":"5770cba14607a30e001debc2","childrenPages":[]}

getImage Base64

Get Image by id encoded as Base64 string

Path Params

id:
required
integer
The id of the Image
The endpoint returns a base64 encoded data url as plain text.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



The endpoint returns a base64 encoded data url as plain text.
{"_id":"5770cba14607a30e001debe1","parentDoc":null,"sync_unique":"","api":{"params":[],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"revision\": 659,\n  \"lastUpdate\": \"2015-10-15T08:42:19.168+0000\"\n}","name":""}]},"settings":"","url":"/api/data/meta-data","auth":"required","examples":{"codes":[{"language":"text","code":"https://proximity.indoo.rs/api/data/meta-data"}]},"method":"get"},"excerpt":"","link_url":"","link_external":false,"order":13,"project":"56d4304373dcd20b00fb854e","slug":"meta-data-revision","title":"Meta-data revision","createdAt":"2016-02-29T14:06:18.587Z","isReference":false,"version":"5770cba14607a30e001debc2","__v":0,"hidden":false,"type":"get","updates":[],"user":"54e5a4a0d3ab670d00f3af54","body":"This api helps to check out if any data was changed in the platform. If so, the revision number will be higher.  \n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  revision (integer),\\n  lastUpdate (date)\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","githubsync":"","childrenPages":[]}

getMeta-data revision


This api helps to check out if any data was changed in the platform. If so, the revision number will be higher. [block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "{\n revision (integer),\n lastUpdate (date)\n}", "language": "javascript" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



This api helps to check out if any data was changed in the platform. If so, the revision number will be higher. [block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "{\n revision (integer),\n lastUpdate (date)\n}", "language": "javascript" } ] } [/block]
{"_id":"5770cba14607a30e001debe2","user":"54e5a4a0d3ab670d00f3af54","__v":0,"api":{"params":[],"results":{"codes":[{"code":"{\n  \"successful\": true\n}","name":"","status":200,"language":"json"}]},"settings":"","url":"/api/events/beacons","auth":"required","examples":{"codes":[{"language":"json","code":"{\n  \"uuid\": \"abcd-1234-abcd\",\n  \"major\": 1000,\n  \"minor\": 10,\n  \"battery\": 44.5,\n  \"rssi\": -77,\n  \"range\": \"NEAR\",\n\t\"position\": {\n    \"latitude\": 48.20913125006481,\n    \"longitude\": 16.36086344718933\n  },\n  \"timestamp\": \"2015-05-27T15:13:20.476\",\n  \"userdata\": {\n    \"appId\": \"abcd1234xyz\"\n  }\n}"}]},"method":"post"},"createdAt":"2016-02-29T14:08:03.168Z","hidden":false,"link_url":"","slug":"beaconevent","sync_unique":"","isReference":false,"order":14,"parentDoc":null,"updates":[],"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"BeaconEvent {\\n  uuid (string),\\n  major (integer),\\n  minor (integer),\\n  battery (float),\\n  rssi (float),\\n  range (string): ['NEAR', 'MEDIUM', 'FAR'],\\n  position {\\n    latitude (float),\\n    longitude (float)\\n  }\\n  timestamp (string),\\n  userdata {\\n    appId (string)\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","category":"5770cba14607a30e001debc4","excerpt":"Submit BeaconEvent","githubsync":"","title":"BeaconEvent","version":"5770cba14607a30e001debc2","link_external":false,"project":"56d4304373dcd20b00fb854e","type":"post","childrenPages":[]}

postBeaconEvent

Submit BeaconEvent

[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "BeaconEvent {\n uuid (string),\n major (integer),\n minor (integer),\n battery (float),\n rssi (float),\n range (string): ['NEAR', 'MEDIUM', 'FAR'],\n position {\n latitude (float),\n longitude (float)\n }\n timestamp (string),\n userdata {\n appId (string)\n }\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "BeaconEvent {\n uuid (string),\n major (integer),\n minor (integer),\n battery (float),\n rssi (float),\n range (string): ['NEAR', 'MEDIUM', 'FAR'],\n position {\n latitude (float),\n longitude (float)\n }\n timestamp (string),\n userdata {\n appId (string)\n }\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debe3","githubsync":"","hidden":false,"link_external":false,"parentDoc":null,"api":{"results":{"codes":[{"status":200,"language":"json","code":" {\n  \"successful\": true\n}","name":""}]},"settings":"","url":"/api/events/zones","auth":"required","examples":{"codes":[{"language":"json","code":"{\n  \"zoneId\": 123,\n  \"type\": \"OnEntry\",\n  \"triggeredEvents\": [3,14,15],\n  \"timestamp\": \"2015-05-27T15:13:20.476\",\n  \"userdata\": {\n    \"appId\": \"abcd1234xyz\"\n  }\n}"}]},"method":"post","params":[]},"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ZoneEvent {\\n  zoneId (integer),\\n  type (string): ['OnEntry', 'OnExit'],\\n  triggeredEvents (Array[integer]),\\n  timestamp (string),\\n  userdata {\\n    appId (string)\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Model\"\n    }\n  ]\n}\n[/block]","excerpt":"Submit ZoneEvent","title":"ZoneEvent","__v":0,"project":"56d4304373dcd20b00fb854e","order":15,"type":"post","createdAt":"2016-02-29T14:09:09.883Z","isReference":false,"link_url":"","updates":[],"user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","category":"5770cba14607a30e001debc4","slug":"zoneevent","sync_unique":"","childrenPages":[]}

postZoneEvent

Submit ZoneEvent

[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "ZoneEvent {\n zoneId (integer),\n type (string): ['OnEntry', 'OnExit'],\n triggeredEvents (Array[integer]),\n timestamp (string),\n userdata {\n appId (string)\n }\n}", "language": "json", "name": "Model" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Model" } [/block] [block:code] { "codes": [ { "code": "ZoneEvent {\n zoneId (integer),\n type (string): ['OnEntry', 'OnExit'],\n triggeredEvents (Array[integer]),\n timestamp (string),\n userdata {\n appId (string)\n }\n}", "language": "json", "name": "Model" } ] } [/block]
{"_id":"5770cba14607a30e001debe4","user":"54e5a4a0d3ab670d00f3af54","category":"5770cba14607a30e001debc4","title":"Websocket Event Push API","project":"56d4304373dcd20b00fb854e","sync_unique":"","createdAt":"2016-02-29T14:10:43.338Z","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":16,"__v":0,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":""},"parentDoc":null,"type":"basic","slug":"websocket-event-push-api","updates":[],"version":"5770cba14607a30e001debc2","body":"Clients can subscribe to the Websocket push api in order to receive live events or beacon status updates whenever they happen. \n\nThe API uses [SockJS](https://github.com/sockjs) to handle connections and uses a simple custom protocol to authenticate and subscribe for events.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Usage\"\n}\n[/block]\n**Endpoint** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ws://proximity.indoo.rs/api/events/stream/websocket\",\n      \"language\": \"text\",\n      \"name\": \"wsUri\"\n    }\n  ]\n}\n[/block]\n**Messages**\n\n*Event Types*\n* BEACON\n* ZONE\n* BEACON_STATUS\n\n*Outbound*\n\nOutbound messages include the command and a unique message ID chosen by the client as well as the message payload if necessary.\n\nOutbound Messages will always be acknowledged with an OK message or rejected with an ERR message. \n - Authentication Message\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"AUTH:ID API_KEY\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n - Subscription Message\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"SUB:ID EVENT_TYPE1 EVENT_TYPE2\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n - Unsubscribe Message\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"UNSUB:ID\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n*Inbound*\n\nInbound messages contain the message type and (except DATA messages) the ID of the message they relate to. \n - Acknowledgement\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"OK:ID\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n  - Error:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ERR:ID\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n  - Event\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"DATA\\n \\n{beaconId:1, ...}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**Example Exchange** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"SEND >> AUTH:1 7537552b-6e66-44c7-91b6-554f2a343777\\nRECV << OK:1\\nSEND >> SUB:2 BEACON_STATUS\\nRECV << OK:2\\nRECV << DATA\\n{\\n  \\\"accountId\\\":1,\\n  \\\"type\\\":\\\"BEACON_STATUS\\\",\\n  \\\"data\\\":\\n  \\t{\\n      \\\"beaconId\\\":1,\\n      \\\"lastSeen\\\":\\n      \\t{\\\"centuryOfEra\\\":20,\\n         \\\"yearOfEra\\\":2015,\\n         \\\"yearOfCentury\\\":15,\\n         \\\"weekyear\\\":2015,\\n         \\\"monthOfYear\\\":3,\\n         \\\"weekOfWeekyear\\\":13,\\n         \\\"hourOfDay\\\":9,\\n         \\\"minuteOfHour\\\":37,\\n         \\\"secondOfMinute\\\":7,\\n         \\\"millisOfSecond\\\":0,\\n         \\\"millisOfDay\\\":34627000,\\n         \\\"secondOfDay\\\":34627,\\n         \\\"minuteOfDay\\\":577,\\n         \\\"year\\\":2015,\\n         \\\"dayOfMonth\\\":24,\\n         \\\"dayOfWeek\\\":2,\\n         \\\"era\\\":1,\\n         \\\"dayOfYear\\\":83,\\n         \\\"zone\\\":\\n         \\t{\\n            \\\"fixed\\\":true,\\n            \\\"id\\\":\\\"UTC\\\"\\n          },\\n         \\\"millis\\\":1427189827000,\\n         \\\"chronology\\\":\\n         \\t{\\n            \\\"zone\\\":\\n            {  \\n              \\\"fixed\\\":true,\\n              \\\"id\\\":\\\"UTC\\\"\\n            }\\n          },\\n         \\\"beforeNow\\\":true,\\n         \\\"afterNow\\\":false,\\\"equalNow\\\":false\\n        },\\n      \\\"overallStatus\\\":\\\"RED\\\",\\n      \\\"positionStatus\\\":\\\"UNKNOWN\\\",\\n      \\\"batteryStatus\\\":\\\"EMPTY\\\",\\n      \\\"assigned\\\":false\\n    }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","childrenPages":[]}

Websocket Event Push API


Clients can subscribe to the Websocket push api in order to receive live events or beacon status updates whenever they happen. The API uses [SockJS](https://github.com/sockjs) to handle connections and uses a simple custom protocol to authenticate and subscribe for events. [block:api-header] { "type": "basic", "title": "Usage" } [/block] **Endpoint** [block:code] { "codes": [ { "code": "ws://proximity.indoo.rs/api/events/stream/websocket", "language": "text", "name": "wsUri" } ] } [/block] **Messages** *Event Types* * BEACON * ZONE * BEACON_STATUS *Outbound* Outbound messages include the command and a unique message ID chosen by the client as well as the message payload if necessary. Outbound Messages will always be acknowledged with an OK message or rejected with an ERR message. - Authentication Message [block:code] { "codes": [ { "code": "AUTH:ID API_KEY", "language": "json" } ] } [/block] - Subscription Message [block:code] { "codes": [ { "code": "SUB:ID EVENT_TYPE1 EVENT_TYPE2", "language": "json" } ] } [/block] - Unsubscribe Message [block:code] { "codes": [ { "code": "UNSUB:ID", "language": "json" } ] } [/block] *Inbound* Inbound messages contain the message type and (except DATA messages) the ID of the message they relate to. - Acknowledgement [block:code] { "codes": [ { "code": "OK:ID", "language": "json" } ] } [/block] - Error: [block:code] { "codes": [ { "code": "ERR:ID", "language": "json" } ] } [/block] - Event [block:code] { "codes": [ { "code": "DATA\n \n{beaconId:1, ...}", "language": "json" } ] } [/block] **Example Exchange** [block:code] { "codes": [ { "code": "SEND >> AUTH:1 7537552b-6e66-44c7-91b6-554f2a343777\nRECV << OK:1\nSEND >> SUB:2 BEACON_STATUS\nRECV << OK:2\nRECV << DATA\n{\n \"accountId\":1,\n \"type\":\"BEACON_STATUS\",\n \"data\":\n \t{\n \"beaconId\":1,\n \"lastSeen\":\n \t{\"centuryOfEra\":20,\n \"yearOfEra\":2015,\n \"yearOfCentury\":15,\n \"weekyear\":2015,\n \"monthOfYear\":3,\n \"weekOfWeekyear\":13,\n \"hourOfDay\":9,\n \"minuteOfHour\":37,\n \"secondOfMinute\":7,\n \"millisOfSecond\":0,\n \"millisOfDay\":34627000,\n \"secondOfDay\":34627,\n \"minuteOfDay\":577,\n \"year\":2015,\n \"dayOfMonth\":24,\n \"dayOfWeek\":2,\n \"era\":1,\n \"dayOfYear\":83,\n \"zone\":\n \t{\n \"fixed\":true,\n \"id\":\"UTC\"\n },\n \"millis\":1427189827000,\n \"chronology\":\n \t{\n \"zone\":\n { \n \"fixed\":true,\n \"id\":\"UTC\"\n }\n },\n \"beforeNow\":true,\n \"afterNow\":false,\"equalNow\":false\n },\n \"overallStatus\":\"RED\",\n \"positionStatus\":\"UNKNOWN\",\n \"batteryStatus\":\"EMPTY\",\n \"assigned\":false\n }\n}", "language": "json" } ] } [/block]
Clients can subscribe to the Websocket push api in order to receive live events or beacon status updates whenever they happen. The API uses [SockJS](https://github.com/sockjs) to handle connections and uses a simple custom protocol to authenticate and subscribe for events. [block:api-header] { "type": "basic", "title": "Usage" } [/block] **Endpoint** [block:code] { "codes": [ { "code": "ws://proximity.indoo.rs/api/events/stream/websocket", "language": "text", "name": "wsUri" } ] } [/block] **Messages** *Event Types* * BEACON * ZONE * BEACON_STATUS *Outbound* Outbound messages include the command and a unique message ID chosen by the client as well as the message payload if necessary. Outbound Messages will always be acknowledged with an OK message or rejected with an ERR message. - Authentication Message [block:code] { "codes": [ { "code": "AUTH:ID API_KEY", "language": "json" } ] } [/block] - Subscription Message [block:code] { "codes": [ { "code": "SUB:ID EVENT_TYPE1 EVENT_TYPE2", "language": "json" } ] } [/block] - Unsubscribe Message [block:code] { "codes": [ { "code": "UNSUB:ID", "language": "json" } ] } [/block] *Inbound* Inbound messages contain the message type and (except DATA messages) the ID of the message they relate to. - Acknowledgement [block:code] { "codes": [ { "code": "OK:ID", "language": "json" } ] } [/block] - Error: [block:code] { "codes": [ { "code": "ERR:ID", "language": "json" } ] } [/block] - Event [block:code] { "codes": [ { "code": "DATA\n \n{beaconId:1, ...}", "language": "json" } ] } [/block] **Example Exchange** [block:code] { "codes": [ { "code": "SEND >> AUTH:1 7537552b-6e66-44c7-91b6-554f2a343777\nRECV << OK:1\nSEND >> SUB:2 BEACON_STATUS\nRECV << OK:2\nRECV << DATA\n{\n \"accountId\":1,\n \"type\":\"BEACON_STATUS\",\n \"data\":\n \t{\n \"beaconId\":1,\n \"lastSeen\":\n \t{\"centuryOfEra\":20,\n \"yearOfEra\":2015,\n \"yearOfCentury\":15,\n \"weekyear\":2015,\n \"monthOfYear\":3,\n \"weekOfWeekyear\":13,\n \"hourOfDay\":9,\n \"minuteOfHour\":37,\n \"secondOfMinute\":7,\n \"millisOfSecond\":0,\n \"millisOfDay\":34627000,\n \"secondOfDay\":34627,\n \"minuteOfDay\":577,\n \"year\":2015,\n \"dayOfMonth\":24,\n \"dayOfWeek\":2,\n \"era\":1,\n \"dayOfYear\":83,\n \"zone\":\n \t{\n \"fixed\":true,\n \"id\":\"UTC\"\n },\n \"millis\":1427189827000,\n \"chronology\":\n \t{\n \"zone\":\n { \n \"fixed\":true,\n \"id\":\"UTC\"\n }\n },\n \"beforeNow\":true,\n \"afterNow\":false,\"equalNow\":false\n },\n \"overallStatus\":\"RED\",\n \"positionStatus\":\"UNKNOWN\",\n \"batteryStatus\":\"EMPTY\",\n \"assigned\":false\n }\n}", "language": "json" } ] } [/block]
{"_id":"5770cba14607a30e001debe6","__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"createdAt":"2016-02-29T14:18:06.772Z","title":"Stateless API","type":"basic","updates":[],"version":"5770cba14607a30e001debc2","excerpt":"","parentDoc":null,"githubsync":"","isReference":false,"link_external":false,"order":18,"user":"54e5a4a0d3ab670d00f3af54","body":"Since most of the methods of the Proximity API are account specific and a user can belong to many accounts, a way its needed to state the id of the account where the methods are operating.\n\nIn the old API this was done using the switchAccount method which indicated the system that the next operations would be performed for a certain account. For example:\n\n1. Login -> logs in the system\n2. switchAccount(1) -> switches to account 1\n3. Locations -> get locations of account 1\n4. switchAccount(2) -> switches to account 2\n5. Locations -> get locations of account 2\n\nDue to the non RESTfulness of this API (switchAccount step), a new stateless version was created to solve this situation. Now the account id is parameterized in the requests. For example:\n\n1. Login -> logs in the system\n2. /1/locations -> get locations of account 1\n3. /2/locations -> get locations of account 2\n\nThis paramerization is avaliable for the following endpoints:\n\n* **Beacon**\nGet Beacons \n* **EventDefinition**\nGet Events \n* **Image**\nGet Images\n* **InviteUser**\nGet Invitations\n* **Layer**\nGet Layers\n* **Location**\nGet Locations\n* **Map**\nGet Maps\n* **Overview**\nGet Overview of accounts\n* **UserAccount**\nGet accounts with users\n* **User**\nGet Users\n* **UserMeta**\nGet meta information for users\n* **Zone**\nGet Zones","category":"5770cba14607a30e001debc4","hidden":false,"link_url":"","project":"56d4304373dcd20b00fb854e","slug":"stateless-api","sync_unique":"","childrenPages":[]}

Stateless API


Since most of the methods of the Proximity API are account specific and a user can belong to many accounts, a way its needed to state the id of the account where the methods are operating. In the old API this was done using the switchAccount method which indicated the system that the next operations would be performed for a certain account. For example: 1. Login -> logs in the system 2. switchAccount(1) -> switches to account 1 3. Locations -> get locations of account 1 4. switchAccount(2) -> switches to account 2 5. Locations -> get locations of account 2 Due to the non RESTfulness of this API (switchAccount step), a new stateless version was created to solve this situation. Now the account id is parameterized in the requests. For example: 1. Login -> logs in the system 2. /1/locations -> get locations of account 1 3. /2/locations -> get locations of account 2 This paramerization is avaliable for the following endpoints: * **Beacon** Get Beacons * **EventDefinition** Get Events * **Image** Get Images * **InviteUser** Get Invitations * **Layer** Get Layers * **Location** Get Locations * **Map** Get Maps * **Overview** Get Overview of accounts * **UserAccount** Get accounts with users * **User** Get Users * **UserMeta** Get meta information for users * **Zone** Get Zones
Since most of the methods of the Proximity API are account specific and a user can belong to many accounts, a way its needed to state the id of the account where the methods are operating. In the old API this was done using the switchAccount method which indicated the system that the next operations would be performed for a certain account. For example: 1. Login -> logs in the system 2. switchAccount(1) -> switches to account 1 3. Locations -> get locations of account 1 4. switchAccount(2) -> switches to account 2 5. Locations -> get locations of account 2 Due to the non RESTfulness of this API (switchAccount step), a new stateless version was created to solve this situation. Now the account id is parameterized in the requests. For example: 1. Login -> logs in the system 2. /1/locations -> get locations of account 1 3. /2/locations -> get locations of account 2 This paramerization is avaliable for the following endpoints: * **Beacon** Get Beacons * **EventDefinition** Get Events * **Image** Get Images * **InviteUser** Get Invitations * **Layer** Get Layers * **Location** Get Locations * **Map** Get Maps * **Overview** Get Overview of accounts * **UserAccount** Get accounts with users * **User** Get Users * **UserMeta** Get meta information for users * **Zone** Get Zones
{"_id":"5770cba14607a30e001debce","githubsync":"","updates":[],"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"","project":"56d4304373dcd20b00fb854e","sync_unique":"","user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","__v":1,"body":"* Start by downloading the Interactor SDK --> [HERE](doc:android).\n\nExtract the files and place them in the 'libs' folder of your application. Replace the existing files, if you update the Interactor SDK. \n\nIn order to use the SDK you need to create an Account in the Web Platform. There you get your api key to use with the SDK.\n\nImplement 'BackgroundHelper' in your Application Class. At the moment only one instance of the Interactor class is supported. Therefore we offer a **getInstance()** method so you can access the singleton reference to the Interactor.\n\nAdd the following to your existing code accordingly:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import android.location.Location;\\nimport com.lbs.interactor.Interactor;\\nimport com.lbs.interactor.beacons.BackgroundHelper;\\n\\npublic class MyApplication extends Application implements Eventlistener, BeaconListener, InteractorStateChangedListener {\\n    private static Interactor interactor;\\n   \\n   \\n    @Override\\n    public void onCreate() {\\n        super.onCreate();\\n \\t\\t\\t\\t\\n      \\tString apiKey = \\\"MY-API-KEY\\\";\\n        String serverURL = \\\"WEB-PLATFORM-URL\\\";\\n\\n        try {\\n            interactor = new Interactor.Builder(this, apiKey).setServer(serverURL).build();\\n            interactor.registerEventListener(this);\\n            interactor.registerInteractorStateListener(this);\\n\\n        } catch (NoBluetoothException e) {\\n            e.printStackTrace();\\n        }\\n        registerActivityLifecycleCallbacks(interactor);\\n    }\\n \\n    @Override\\n    public void didEnterRegion(Region region) {\\n        interactor.onBootStrapEnterRegion(region);\\n    }\\n    @Override\\n    public void didExitRegion(Region region) {\\n    }\\n    @Override\\n    public void didDetermineStateForRegion(int i, Region region) {\\n    }\\n    @Override\\n    public void onLocationChanged(Location location) {\\n        interactor.onLocationChanged(location);\\n    }\\n    @Override\\n    public void onInteractorStateChanged(InteractorState state) {\\n     \\n        switch (state) {\\n            case Starting:\\n            ...\\n            break;\\n            case LoadingData\\n            ...\\n            break;\\n            case Running:\\n            ...\\n            break;\\n            case Stopping:\\n            ...\\n            break;\\n            case Stopped:\\n            ...\\n            break;  \\n        }\\n    }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"In order to get the full functionality of our Interactor SDK it is mandatory to register the activity lifecycle callbacks for the Interactor as in the last line of the onCreate() method in the example above.\",\n  \"title\": \"registerActivityLifecycleCallbacks\"\n}\n[/block]\n**isCoreRunning**\nYou can call the method **isCoreRunning()** any time to check if the Interactor was started. Starting the interactor for the first time potentially takes a long time, due to Network Synchronisation. So for debugging please first check if the interactor is actually running.\n\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.\",\n  \"title\": \"isRunning  method is deprecated since 1.13.0 version\"\n}\n[/block]\n**registerInteractorStateListener**\nRegisters StateListener, this is used to listen to the interactor states: starting, started, stopping and stopped. The initial state is stopped.\nAssuming that the InteractorStateChangedListener is correctly implemented in your class, you will receive the callback in **onInteractorStateChanged** please see example above.\n\nYou can register the InteractorStateChangedListener by calling :\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getInstance().registerInteractorStateListener(this);\\n\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n**getInteractorState**\nThis method is used to check on Interactor state using this method, the InteractorState starting, started, stopping and stopped. This method returns InteractorState enum\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getInstance().getCurrentInteractorState() \",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n**removeInteractorStateListener**\nThis method is used to removed the state listener, if it was added using **registerInteractorStateListener**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getInstance().removeInteractorStateListener(this);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n**getVersionInfo**\nYou can call the method **getVersionInfo()** any time to check the version of the used Interactor. This is the only method that you can call which does not need a first server side sync. The returned string is in the format Major.Minor.Bugfix.BuildNr.\n\n**getLogger**\nThe **getLogger()** method will return you the logger you have set up while creating the Interactor object using the Builder.\n\n##Event Listener##\nThis is the main use case of our Interactor. Use an EventListener to get Events which are set-up on the web-frontend of the Interactor. See section [Android Event Notifications](doc:event-notifications) for details.\n\n##Beacon Listener##\nThis is an alternative use case for our Interactor. If you want your app to react in proximity of a specific beacon you can register a seacon listener. See section [Beacon API](doc:beacon-api-1) for details.\n\n##Interactor.Builder##\n\nThe **Interactor.Builder** class offers more options for configuration.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Builder setHandler(Handler handler) // with which handler the callbacks are executed\\n  \\nBuilder setBackgroundScanPauseDuration(int milliseconds) // sets the pause duration between scans in milliseconds\\n\\nBuilder reduceServerTraffic(boolean reduceServerTraffic)  // when enabled the SDK sends beacon status data to the server only once per seen beacon per day. If you are not consuming beacon events in a custom back-end, we recommend enabling this feature.\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n**setBackgroundScanPauseDuration** \nsetBackgroundScanPauseDuration is used to set the pause time between scans, this method is now instead of **setBackgroundScanInterval**, which is deprecated.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"setForegroundScanInterval and setBackgroundScanInterval\",\n  \"body\": \"Starting version 1.13.0 these methods are deprecated and the value set from them is ignored.\\nThe method  **setBackgroundScanPauseDuration** is used instead of the **setBackgroundScanInterval** .\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Duration\",\n  \"body\": \"The default value for **setBackgroundScanPauseDuration** is 60000ms (1 minute) This will ensure that your users battery is not drained while they don't use your app. You can set this value even higher if you want to conserve more battery and don't need a background reaction within this time. You should never set this value lower.\"\n}\n[/block]\n**reduceServerTraffic**\nIf you are not interested in getting all beacon updates on the web front-end as soon as you have them visible within the app, you can set reduceServerTraffic property to true. This way your app will still work as it was before, but beacon information will be uploaded to the server only once per seen beacon per day.\n\n**setLogger**\nIf you prefer to set a specific logger  for the Interactor to write to you can use the **setLogger(Logger logger)** method with your custom logger.\n\n**disableLogs**\nIf you prefer to generate no logs at all you can disable logging for the interactor by calling the **disableLogs()** method.\n\n**disableAutostart**\nYou can set the Interactor to *not* start automatically (which is the default behaviour). Use this in case regulations require you to get permission from the user in the UI before you scan for Beacons. Use the method **disableAutoStart()** from the Interactor.Builder class.\n\n##Entries needed in the AndroidManifest##\n\nThe Application needs to be specified in the AndroidManifest.xml like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"    <application\\n        android:name=\\\".MyApplication\\\"\\n        ...\\n    >\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Permissions\",\n  \"body\": \"You don't need to add any permissions manually to your app. When you use our SDK the following permissions will be added *automatically*:\\n\\n  * ACCESS_FINE_LOCATION\\n  * WRITE_EXTERNAL_STORAGE\\n  * INTERNET\\n  * ACCESS_NETWORK_STATE\\n  * BLUETOOTH_ADMIN\"\n}\n[/block]\nThe Interactor SDK is a gradle library. Add the following dependencies to your applications build.grade file:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"repositories {\\n    flatDir {\\n        dirs 'libs'\\n    }\\n    jcenter()\\n}\\n\\ndependencies {\\n    compile fileTree(dir: 'libs', include: ['*.jar'])\\n    compile(name:'Interactor-sdk-release', ext:'aar')\\n    compile(name:'android-beacon-lib-release', ext:'aar')\\n    compile 'com.google.guava:guava:18.0'\\n\\t\\t\\n  //More app dependencies...\\n}\",\n      \"language\": \"groovy\"\n    }\n  ]\n}\n[/block]\nWhen you successfully configure Interactor call this function to start it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getInstance().startInteractor();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nIf you want to stop Interactor, you have to call this function:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getInstance().stopInteractor();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Using Proximity together with other native libraries\",\n  \"body\": \"If you're including other native libraries which also contain a build for arm64 you have to filter those first in your build.gradle:\\nndkConfig.abiFilters \\\"armeabi-v7a\\\", \\\"x86\\\"\"\n}\n[/block]","link_url":"","link_external":false,"slug":"getting-started-with-android","title":"Getting started with Android","category":"5770cba14607a30e001debc5","createdAt":"2016-02-29T14:19:14.471Z","hidden":false,"type":"basic","isReference":false,"order":0,"parentDoc":null,"next":{"description":"","pages":[]},"childrenPages":[]}

Getting started with Android


* Start by downloading the Interactor SDK --> [HERE](doc:android). Extract the files and place them in the 'libs' folder of your application. Replace the existing files, if you update the Interactor SDK. In order to use the SDK you need to create an Account in the Web Platform. There you get your api key to use with the SDK. Implement 'BackgroundHelper' in your Application Class. At the moment only one instance of the Interactor class is supported. Therefore we offer a **getInstance()** method so you can access the singleton reference to the Interactor. Add the following to your existing code accordingly: [block:code] { "codes": [ { "code": "import android.location.Location;\nimport com.lbs.interactor.Interactor;\nimport com.lbs.interactor.beacons.BackgroundHelper;\n\npublic class MyApplication extends Application implements Eventlistener, BeaconListener, InteractorStateChangedListener {\n private static Interactor interactor;\n \n \n @Override\n public void onCreate() {\n super.onCreate();\n \t\t\t\t\n \tString apiKey = \"MY-API-KEY\";\n String serverURL = \"WEB-PLATFORM-URL\";\n\n try {\n interactor = new Interactor.Builder(this, apiKey).setServer(serverURL).build();\n interactor.registerEventListener(this);\n interactor.registerInteractorStateListener(this);\n\n } catch (NoBluetoothException e) {\n e.printStackTrace();\n }\n registerActivityLifecycleCallbacks(interactor);\n }\n \n @Override\n public void didEnterRegion(Region region) {\n interactor.onBootStrapEnterRegion(region);\n }\n @Override\n public void didExitRegion(Region region) {\n }\n @Override\n public void didDetermineStateForRegion(int i, Region region) {\n }\n @Override\n public void onLocationChanged(Location location) {\n interactor.onLocationChanged(location);\n }\n @Override\n public void onInteractorStateChanged(InteractorState state) {\n \n switch (state) {\n case Starting:\n ...\n break;\n case LoadingData\n ...\n break;\n case Running:\n ...\n break;\n case Stopping:\n ...\n break;\n case Stopped:\n ...\n break; \n }\n }\n}", "language": "java" } ] } [/block] [block:callout] { "type": "danger", "body": "In order to get the full functionality of our Interactor SDK it is mandatory to register the activity lifecycle callbacks for the Interactor as in the last line of the onCreate() method in the example above.", "title": "registerActivityLifecycleCallbacks" } [/block] **isCoreRunning** You can call the method **isCoreRunning()** any time to check if the Interactor was started. Starting the interactor for the first time potentially takes a long time, due to Network Synchronisation. So for debugging please first check if the interactor is actually running. [block:callout] { "type": "warning", "body": "Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.", "title": "isRunning method is deprecated since 1.13.0 version" } [/block] **registerInteractorStateListener** Registers StateListener, this is used to listen to the interactor states: starting, started, stopping and stopped. The initial state is stopped. Assuming that the InteractorStateChangedListener is correctly implemented in your class, you will receive the callback in **onInteractorStateChanged** please see example above. You can register the InteractorStateChangedListener by calling : [block:code] { "codes": [ { "code": "Interactor.getInstance().registerInteractorStateListener(this);\n", "language": "java" } ] } [/block] **getInteractorState** This method is used to check on Interactor state using this method, the InteractorState starting, started, stopping and stopped. This method returns InteractorState enum [block:code] { "codes": [ { "code": "Interactor.getInstance().getCurrentInteractorState() ", "language": "java" } ] } [/block] **removeInteractorStateListener** This method is used to removed the state listener, if it was added using **registerInteractorStateListener**: [block:code] { "codes": [ { "code": "Interactor.getInstance().removeInteractorStateListener(this);", "language": "java" } ] } [/block] **getVersionInfo** You can call the method **getVersionInfo()** any time to check the version of the used Interactor. This is the only method that you can call which does not need a first server side sync. The returned string is in the format Major.Minor.Bugfix.BuildNr. **getLogger** The **getLogger()** method will return you the logger you have set up while creating the Interactor object using the Builder. ##Event Listener## This is the main use case of our Interactor. Use an EventListener to get Events which are set-up on the web-frontend of the Interactor. See section [Android Event Notifications](doc:event-notifications) for details. ##Beacon Listener## This is an alternative use case for our Interactor. If you want your app to react in proximity of a specific beacon you can register a seacon listener. See section [Beacon API](doc:beacon-api-1) for details. ##Interactor.Builder## The **Interactor.Builder** class offers more options for configuration. [block:code] { "codes": [ { "code": "Builder setHandler(Handler handler) // with which handler the callbacks are executed\n \nBuilder setBackgroundScanPauseDuration(int milliseconds) // sets the pause duration between scans in milliseconds\n\nBuilder reduceServerTraffic(boolean reduceServerTraffic) // when enabled the SDK sends beacon status data to the server only once per seen beacon per day. If you are not consuming beacon events in a custom back-end, we recommend enabling this feature.", "language": "java" } ] } [/block] **setBackgroundScanPauseDuration** setBackgroundScanPauseDuration is used to set the pause time between scans, this method is now instead of **setBackgroundScanInterval**, which is deprecated. [block:callout] { "type": "warning", "title": "setForegroundScanInterval and setBackgroundScanInterval", "body": "Starting version 1.13.0 these methods are deprecated and the value set from them is ignored.\nThe method **setBackgroundScanPauseDuration** is used instead of the **setBackgroundScanInterval** ." } [/block] [block:callout] { "type": "warning", "title": "Duration", "body": "The default value for **setBackgroundScanPauseDuration** is 60000ms (1 minute) This will ensure that your users battery is not drained while they don't use your app. You can set this value even higher if you want to conserve more battery and don't need a background reaction within this time. You should never set this value lower." } [/block] **reduceServerTraffic** If you are not interested in getting all beacon updates on the web front-end as soon as you have them visible within the app, you can set reduceServerTraffic property to true. This way your app will still work as it was before, but beacon information will be uploaded to the server only once per seen beacon per day. **setLogger** If you prefer to set a specific logger for the Interactor to write to you can use the **setLogger(Logger logger)** method with your custom logger. **disableLogs** If you prefer to generate no logs at all you can disable logging for the interactor by calling the **disableLogs()** method. **disableAutostart** You can set the Interactor to *not* start automatically (which is the default behaviour). Use this in case regulations require you to get permission from the user in the UI before you scan for Beacons. Use the method **disableAutoStart()** from the Interactor.Builder class. ##Entries needed in the AndroidManifest## The Application needs to be specified in the AndroidManifest.xml like this: [block:code] { "codes": [ { "code": " <application\n android:name=\".MyApplication\"\n ...\n >", "language": "xml" } ] } [/block] [block:callout] { "type": "info", "title": "Permissions", "body": "You don't need to add any permissions manually to your app. When you use our SDK the following permissions will be added *automatically*:\n\n * ACCESS_FINE_LOCATION\n * WRITE_EXTERNAL_STORAGE\n * INTERNET\n * ACCESS_NETWORK_STATE\n * BLUETOOTH_ADMIN" } [/block] The Interactor SDK is a gradle library. Add the following dependencies to your applications build.grade file: [block:code] { "codes": [ { "code": "repositories {\n flatDir {\n dirs 'libs'\n }\n jcenter()\n}\n\ndependencies {\n compile fileTree(dir: 'libs', include: ['*.jar'])\n compile(name:'Interactor-sdk-release', ext:'aar')\n compile(name:'android-beacon-lib-release', ext:'aar')\n compile 'com.google.guava:guava:18.0'\n\t\t\n //More app dependencies...\n}", "language": "groovy" } ] } [/block] When you successfully configure Interactor call this function to start it: [block:code] { "codes": [ { "code": "Interactor.getInstance().startInteractor();", "language": "java" } ] } [/block] If you want to stop Interactor, you have to call this function: [block:code] { "codes": [ { "code": "Interactor.getInstance().stopInteractor();", "language": "java" } ] } [/block] [block:callout] { "type": "warning", "title": "Using Proximity together with other native libraries", "body": "If you're including other native libraries which also contain a build for arm64 you have to filter those first in your build.gradle:\nndkConfig.abiFilters \"armeabi-v7a\", \"x86\"" } [/block]
* Start by downloading the Interactor SDK --> [HERE](doc:android). Extract the files and place them in the 'libs' folder of your application. Replace the existing files, if you update the Interactor SDK. In order to use the SDK you need to create an Account in the Web Platform. There you get your api key to use with the SDK. Implement 'BackgroundHelper' in your Application Class. At the moment only one instance of the Interactor class is supported. Therefore we offer a **getInstance()** method so you can access the singleton reference to the Interactor. Add the following to your existing code accordingly: [block:code] { "codes": [ { "code": "import android.location.Location;\nimport com.lbs.interactor.Interactor;\nimport com.lbs.interactor.beacons.BackgroundHelper;\n\npublic class MyApplication extends Application implements Eventlistener, BeaconListener, InteractorStateChangedListener {\n private static Interactor interactor;\n \n \n @Override\n public void onCreate() {\n super.onCreate();\n \t\t\t\t\n \tString apiKey = \"MY-API-KEY\";\n String serverURL = \"WEB-PLATFORM-URL\";\n\n try {\n interactor = new Interactor.Builder(this, apiKey).setServer(serverURL).build();\n interactor.registerEventListener(this);\n interactor.registerInteractorStateListener(this);\n\n } catch (NoBluetoothException e) {\n e.printStackTrace();\n }\n registerActivityLifecycleCallbacks(interactor);\n }\n \n @Override\n public void didEnterRegion(Region region) {\n interactor.onBootStrapEnterRegion(region);\n }\n @Override\n public void didExitRegion(Region region) {\n }\n @Override\n public void didDetermineStateForRegion(int i, Region region) {\n }\n @Override\n public void onLocationChanged(Location location) {\n interactor.onLocationChanged(location);\n }\n @Override\n public void onInteractorStateChanged(InteractorState state) {\n \n switch (state) {\n case Starting:\n ...\n break;\n case LoadingData\n ...\n break;\n case Running:\n ...\n break;\n case Stopping:\n ...\n break;\n case Stopped:\n ...\n break; \n }\n }\n}", "language": "java" } ] } [/block] [block:callout] { "type": "danger", "body": "In order to get the full functionality of our Interactor SDK it is mandatory to register the activity lifecycle callbacks for the Interactor as in the last line of the onCreate() method in the example above.", "title": "registerActivityLifecycleCallbacks" } [/block] **isCoreRunning** You can call the method **isCoreRunning()** any time to check if the Interactor was started. Starting the interactor for the first time potentially takes a long time, due to Network Synchronisation. So for debugging please first check if the interactor is actually running. [block:callout] { "type": "warning", "body": "Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.", "title": "isRunning method is deprecated since 1.13.0 version" } [/block] **registerInteractorStateListener** Registers StateListener, this is used to listen to the interactor states: starting, started, stopping and stopped. The initial state is stopped. Assuming that the InteractorStateChangedListener is correctly implemented in your class, you will receive the callback in **onInteractorStateChanged** please see example above. You can register the InteractorStateChangedListener by calling : [block:code] { "codes": [ { "code": "Interactor.getInstance().registerInteractorStateListener(this);\n", "language": "java" } ] } [/block] **getInteractorState** This method is used to check on Interactor state using this method, the InteractorState starting, started, stopping and stopped. This method returns InteractorState enum [block:code] { "codes": [ { "code": "Interactor.getInstance().getCurrentInteractorState() ", "language": "java" } ] } [/block] **removeInteractorStateListener** This method is used to removed the state listener, if it was added using **registerInteractorStateListener**: [block:code] { "codes": [ { "code": "Interactor.getInstance().removeInteractorStateListener(this);", "language": "java" } ] } [/block] **getVersionInfo** You can call the method **getVersionInfo()** any time to check the version of the used Interactor. This is the only method that you can call which does not need a first server side sync. The returned string is in the format Major.Minor.Bugfix.BuildNr. **getLogger** The **getLogger()** method will return you the logger you have set up while creating the Interactor object using the Builder. ##Event Listener## This is the main use case of our Interactor. Use an EventListener to get Events which are set-up on the web-frontend of the Interactor. See section [Android Event Notifications](doc:event-notifications) for details. ##Beacon Listener## This is an alternative use case for our Interactor. If you want your app to react in proximity of a specific beacon you can register a seacon listener. See section [Beacon API](doc:beacon-api-1) for details. ##Interactor.Builder## The **Interactor.Builder** class offers more options for configuration. [block:code] { "codes": [ { "code": "Builder setHandler(Handler handler) // with which handler the callbacks are executed\n \nBuilder setBackgroundScanPauseDuration(int milliseconds) // sets the pause duration between scans in milliseconds\n\nBuilder reduceServerTraffic(boolean reduceServerTraffic) // when enabled the SDK sends beacon status data to the server only once per seen beacon per day. If you are not consuming beacon events in a custom back-end, we recommend enabling this feature.", "language": "java" } ] } [/block] **setBackgroundScanPauseDuration** setBackgroundScanPauseDuration is used to set the pause time between scans, this method is now instead of **setBackgroundScanInterval**, which is deprecated. [block:callout] { "type": "warning", "title": "setForegroundScanInterval and setBackgroundScanInterval", "body": "Starting version 1.13.0 these methods are deprecated and the value set from them is ignored.\nThe method **setBackgroundScanPauseDuration** is used instead of the **setBackgroundScanInterval** ." } [/block] [block:callout] { "type": "warning", "title": "Duration", "body": "The default value for **setBackgroundScanPauseDuration** is 60000ms (1 minute) This will ensure that your users battery is not drained while they don't use your app. You can set this value even higher if you want to conserve more battery and don't need a background reaction within this time. You should never set this value lower." } [/block] **reduceServerTraffic** If you are not interested in getting all beacon updates on the web front-end as soon as you have them visible within the app, you can set reduceServerTraffic property to true. This way your app will still work as it was before, but beacon information will be uploaded to the server only once per seen beacon per day. **setLogger** If you prefer to set a specific logger for the Interactor to write to you can use the **setLogger(Logger logger)** method with your custom logger. **disableLogs** If you prefer to generate no logs at all you can disable logging for the interactor by calling the **disableLogs()** method. **disableAutostart** You can set the Interactor to *not* start automatically (which is the default behaviour). Use this in case regulations require you to get permission from the user in the UI before you scan for Beacons. Use the method **disableAutoStart()** from the Interactor.Builder class. ##Entries needed in the AndroidManifest## The Application needs to be specified in the AndroidManifest.xml like this: [block:code] { "codes": [ { "code": " <application\n android:name=\".MyApplication\"\n ...\n >", "language": "xml" } ] } [/block] [block:callout] { "type": "info", "title": "Permissions", "body": "You don't need to add any permissions manually to your app. When you use our SDK the following permissions will be added *automatically*:\n\n * ACCESS_FINE_LOCATION\n * WRITE_EXTERNAL_STORAGE\n * INTERNET\n * ACCESS_NETWORK_STATE\n * BLUETOOTH_ADMIN" } [/block] The Interactor SDK is a gradle library. Add the following dependencies to your applications build.grade file: [block:code] { "codes": [ { "code": "repositories {\n flatDir {\n dirs 'libs'\n }\n jcenter()\n}\n\ndependencies {\n compile fileTree(dir: 'libs', include: ['*.jar'])\n compile(name:'Interactor-sdk-release', ext:'aar')\n compile(name:'android-beacon-lib-release', ext:'aar')\n compile 'com.google.guava:guava:18.0'\n\t\t\n //More app dependencies...\n}", "language": "groovy" } ] } [/block] When you successfully configure Interactor call this function to start it: [block:code] { "codes": [ { "code": "Interactor.getInstance().startInteractor();", "language": "java" } ] } [/block] If you want to stop Interactor, you have to call this function: [block:code] { "codes": [ { "code": "Interactor.getInstance().stopInteractor();", "language": "java" } ] } [/block] [block:callout] { "type": "warning", "title": "Using Proximity together with other native libraries", "body": "If you're including other native libraries which also contain a build for arm64 you have to filter those first in your build.gradle:\nndkConfig.abiFilters \"armeabi-v7a\", \"x86\"" } [/block]
{"_id":"5770cba14607a30e001debcf","body":"To receive the notifications for the events created in the web platform you need to register an event listener. The com.lbs.interactor.events.Eventlistener interface has to be implemented.\n\nThe example snippet below shows the whole life cycle of an eventListener\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Create an EventListener\\nEventListener myEventListener = new EventListener() {\\n\\t@Override\\n\\tpublic void onEventTriggered(Event data) {\\n\\t\\t// Consume the Event\\n\\t}\\n};\\n\\n// Register the eventListener to the Interactor\\nInteractor.getInstance().registerEventListener(myEventListener);\\n\\n// Remove the eventListener from the Interactor, use the same Object you have registered.\\nInteractor.getInstance().removeEventListener(myEventListener);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nUse **registerEventListener** to register your eventListener to the Interactor. You can register multiple eventListener Objects, if you have the need to feed the events to different parts of your apps.\n\nUse **removeEventListener** to remove a specific eventListener from the Interactor. You will have to use the exact object reverence as you used while registering.\n\nIf the beacon comes in range and meets the criteria specified in the web platform, each registered listener is invoked. \n\nThe event object contains information specified in the platform.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@Override\\n    public void onEventTriggered(Event data) {\\n        Event.EventType type = data.getType();\\n        String name = data.getName();\\n        String description = data.getDescription();\\n        List<EventContent> contents = data.getEventContents();\\n        for(EventContent content:contents){\\n            //Url|Text|Image\\n            EventContent.EventDataType dataType = content.getType();\\n            //For text translations, the key for the language\\n            String key = content.getKey();\\n            //for images this is the absolute path to the image\\n            String value = content.getValue();\\n        }\\n        long zoneId = data.getZone().getZoneID();\\n        ZoneSize zoneSize = data.getZone().getZoneSize();\\n    }\\n\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","isReference":false,"slug":"android-event-notifications-1","githubsync":"","hidden":false,"version":"5770cba14607a30e001debc2","project":"56d4304373dcd20b00fb854e","title":"Android Event Notifications","type":"basic","__v":0,"api":{"url":"","settings":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"auth":"required","params":[]},"category":"5770cba14607a30e001debc5","excerpt":"","parentDoc":null,"updates":[],"user":"54e5a4a0d3ab670d00f3af54","createdAt":"2016-06-27T06:28:46.594Z","link_external":false,"link_url":"","order":1,"sync_unique":"","childrenPages":[]}

Android Event Notifications


To receive the notifications for the events created in the web platform you need to register an event listener. The com.lbs.interactor.events.Eventlistener interface has to be implemented. The example snippet below shows the whole life cycle of an eventListener [block:code] { "codes": [ { "code": "// Create an EventListener\nEventListener myEventListener = new EventListener() {\n\t@Override\n\tpublic void onEventTriggered(Event data) {\n\t\t// Consume the Event\n\t}\n};\n\n// Register the eventListener to the Interactor\nInteractor.getInstance().registerEventListener(myEventListener);\n\n// Remove the eventListener from the Interactor, use the same Object you have registered.\nInteractor.getInstance().removeEventListener(myEventListener);", "language": "java" } ] } [/block] Use **registerEventListener** to register your eventListener to the Interactor. You can register multiple eventListener Objects, if you have the need to feed the events to different parts of your apps. Use **removeEventListener** to remove a specific eventListener from the Interactor. You will have to use the exact object reverence as you used while registering. If the beacon comes in range and meets the criteria specified in the web platform, each registered listener is invoked. The event object contains information specified in the platform. [block:code] { "codes": [ { "code": "@Override\n public void onEventTriggered(Event data) {\n Event.EventType type = data.getType();\n String name = data.getName();\n String description = data.getDescription();\n List<EventContent> contents = data.getEventContents();\n for(EventContent content:contents){\n //Url|Text|Image\n EventContent.EventDataType dataType = content.getType();\n //For text translations, the key for the language\n String key = content.getKey();\n //for images this is the absolute path to the image\n String value = content.getValue();\n }\n long zoneId = data.getZone().getZoneID();\n ZoneSize zoneSize = data.getZone().getZoneSize();\n }\n", "language": "java" } ] } [/block]
To receive the notifications for the events created in the web platform you need to register an event listener. The com.lbs.interactor.events.Eventlistener interface has to be implemented. The example snippet below shows the whole life cycle of an eventListener [block:code] { "codes": [ { "code": "// Create an EventListener\nEventListener myEventListener = new EventListener() {\n\t@Override\n\tpublic void onEventTriggered(Event data) {\n\t\t// Consume the Event\n\t}\n};\n\n// Register the eventListener to the Interactor\nInteractor.getInstance().registerEventListener(myEventListener);\n\n// Remove the eventListener from the Interactor, use the same Object you have registered.\nInteractor.getInstance().removeEventListener(myEventListener);", "language": "java" } ] } [/block] Use **registerEventListener** to register your eventListener to the Interactor. You can register multiple eventListener Objects, if you have the need to feed the events to different parts of your apps. Use **removeEventListener** to remove a specific eventListener from the Interactor. You will have to use the exact object reverence as you used while registering. If the beacon comes in range and meets the criteria specified in the web platform, each registered listener is invoked. The event object contains information specified in the platform. [block:code] { "codes": [ { "code": "@Override\n public void onEventTriggered(Event data) {\n Event.EventType type = data.getType();\n String name = data.getName();\n String description = data.getDescription();\n List<EventContent> contents = data.getEventContents();\n for(EventContent content:contents){\n //Url|Text|Image\n EventContent.EventDataType dataType = content.getType();\n //For text translations, the key for the language\n String key = content.getKey();\n //for images this is the absolute path to the image\n String value = content.getValue();\n }\n long zoneId = data.getZone().getZoneID();\n ZoneSize zoneSize = data.getZone().getZoneSize();\n }\n", "language": "java" } ] } [/block]
{"_id":"5770cba14607a30e001debd0","excerpt":"","githubsync":"","isReference":false,"link_external":false,"link_url":"","parentDoc":null,"project":"56d4304373dcd20b00fb854e","__v":0,"type":"basic","api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"hidden":false,"slug":"beacon-api","updates":[],"category":"5770cba14607a30e001debc5","createdAt":"2016-02-29T14:30:11.459Z","order":2,"sync_unique":"","title":"Beacon API","user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","body":"There are two ways to register a listener for a beacons. A background notification can be registered in the application class.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"interactor.registerBackgroundListener(beacon, new BackgroundListener() {\\n            @Override\\n            public void onBeaconSeen(Beacon beacon) {\\n                Log.d(TAG, \\\"onBeaconSeen \\\" + beacon.toString());\\n                Intent intent = new Intent(that, BackgroundActivity.class);\\n                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\\n                that.startActivity(intent);\\n            }\\n        });\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nIf the app is in the background, the app is started and the callback gets invoked. After the first registration this need to be done every time in the onCreate of the application, the SDK does not persist any state for notifications.\nIn addition a foreground callback can be registered on the instance of the interactor.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@Override\\nprotected void onResume() {\\n     \\tsuper.onResume();\\n      MyApplication.getInteractor(this).registerBeaconListener(new Beacon(\\\"UUID\\\", 13234, 23432), this);\\n\\n  }\\n\\n @Override\\n protected void onPause() {\\n       \\tsuper.onPause();\\n        MyApplication.getInteractor(this).removeBeaconListener(this);\\n  }\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nIf a beacon is seen, the listener gets invoked. \nthe listener gives a **BeaconEvent** which contains beacon information, beacon distance. RSSI value, beacon range (beacon range can be based on distance)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@Override\\npublic void onBeaconSeen(BeaconEvent beaconevent) {\\n  \\n String uuid = beaconEvent.getBeacon().getUuid();\\n int major = beaconEvent.getBeacon().getMajor();\\n int minor = beaconEvent.getBeacon().getMinor;\\n double distance = beaconEvent.getBeaconDistance(); \\n int Rssi = beaconEvent.getRSSIValue() \\n BeaconEvent.Range range = beaconEvent.getRange();\\n  ....\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nBeacon range can be: \n- immediate (when user is closer than 1m to the beacon)\n- near          (when user is between 1 and 10 meters away from the beacon)\n- far             (when user is more than 10 meters away from the beacon)\n- unkown     (unknown range from the beacon)  \n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Version 1.8.0\",\n  \"body\": \"Beware that the above explanation is only valid starting from version 1.8.0.\"\n}\n[/block]\nYou can get the list of all beacons by calling *getAllBeacons()*, this is used to get all beacons in your inventory, **this method must be called after being sure that the interactor was successfully started.**\n\nThis method throws an exception in case the interactor is *not* running !\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"List<Beacon> beaconList = Interactor.getInstance().getAllBeacons();\\n\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","childrenPages":[]}

Beacon API


There are two ways to register a listener for a beacons. A background notification can be registered in the application class. [block:code] { "codes": [ { "code": "interactor.registerBackgroundListener(beacon, new BackgroundListener() {\n @Override\n public void onBeaconSeen(Beacon beacon) {\n Log.d(TAG, \"onBeaconSeen \" + beacon.toString());\n Intent intent = new Intent(that, BackgroundActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n that.startActivity(intent);\n }\n });", "language": "java" } ] } [/block] If the app is in the background, the app is started and the callback gets invoked. After the first registration this need to be done every time in the onCreate of the application, the SDK does not persist any state for notifications. In addition a foreground callback can be registered on the instance of the interactor. [block:code] { "codes": [ { "code": "@Override\nprotected void onResume() {\n \tsuper.onResume();\n MyApplication.getInteractor(this).registerBeaconListener(new Beacon(\"UUID\", 13234, 23432), this);\n\n }\n\n @Override\n protected void onPause() {\n \tsuper.onPause();\n MyApplication.getInteractor(this).removeBeaconListener(this);\n }", "language": "java" } ] } [/block] If a beacon is seen, the listener gets invoked. the listener gives a **BeaconEvent** which contains beacon information, beacon distance. RSSI value, beacon range (beacon range can be based on distance) [block:code] { "codes": [ { "code": "@Override\npublic void onBeaconSeen(BeaconEvent beaconevent) {\n \n String uuid = beaconEvent.getBeacon().getUuid();\n int major = beaconEvent.getBeacon().getMajor();\n int minor = beaconEvent.getBeacon().getMinor;\n double distance = beaconEvent.getBeaconDistance(); \n int Rssi = beaconEvent.getRSSIValue() \n BeaconEvent.Range range = beaconEvent.getRange();\n ....\n}", "language": "java" } ] } [/block] Beacon range can be: - immediate (when user is closer than 1m to the beacon) - near (when user is between 1 and 10 meters away from the beacon) - far (when user is more than 10 meters away from the beacon) - unkown (unknown range from the beacon) [block:callout] { "type": "warning", "title": "Version 1.8.0", "body": "Beware that the above explanation is only valid starting from version 1.8.0." } [/block] You can get the list of all beacons by calling *getAllBeacons()*, this is used to get all beacons in your inventory, **this method must be called after being sure that the interactor was successfully started.** This method throws an exception in case the interactor is *not* running ! [block:code] { "codes": [ { "code": "List<Beacon> beaconList = Interactor.getInstance().getAllBeacons();\n", "language": "java" } ] } [/block]
There are two ways to register a listener for a beacons. A background notification can be registered in the application class. [block:code] { "codes": [ { "code": "interactor.registerBackgroundListener(beacon, new BackgroundListener() {\n @Override\n public void onBeaconSeen(Beacon beacon) {\n Log.d(TAG, \"onBeaconSeen \" + beacon.toString());\n Intent intent = new Intent(that, BackgroundActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n that.startActivity(intent);\n }\n });", "language": "java" } ] } [/block] If the app is in the background, the app is started and the callback gets invoked. After the first registration this need to be done every time in the onCreate of the application, the SDK does not persist any state for notifications. In addition a foreground callback can be registered on the instance of the interactor. [block:code] { "codes": [ { "code": "@Override\nprotected void onResume() {\n \tsuper.onResume();\n MyApplication.getInteractor(this).registerBeaconListener(new Beacon(\"UUID\", 13234, 23432), this);\n\n }\n\n @Override\n protected void onPause() {\n \tsuper.onPause();\n MyApplication.getInteractor(this).removeBeaconListener(this);\n }", "language": "java" } ] } [/block] If a beacon is seen, the listener gets invoked. the listener gives a **BeaconEvent** which contains beacon information, beacon distance. RSSI value, beacon range (beacon range can be based on distance) [block:code] { "codes": [ { "code": "@Override\npublic void onBeaconSeen(BeaconEvent beaconevent) {\n \n String uuid = beaconEvent.getBeacon().getUuid();\n int major = beaconEvent.getBeacon().getMajor();\n int minor = beaconEvent.getBeacon().getMinor;\n double distance = beaconEvent.getBeaconDistance(); \n int Rssi = beaconEvent.getRSSIValue() \n BeaconEvent.Range range = beaconEvent.getRange();\n ....\n}", "language": "java" } ] } [/block] Beacon range can be: - immediate (when user is closer than 1m to the beacon) - near (when user is between 1 and 10 meters away from the beacon) - far (when user is more than 10 meters away from the beacon) - unkown (unknown range from the beacon) [block:callout] { "type": "warning", "title": "Version 1.8.0", "body": "Beware that the above explanation is only valid starting from version 1.8.0." } [/block] You can get the list of all beacons by calling *getAllBeacons()*, this is used to get all beacons in your inventory, **this method must be called after being sure that the interactor was successfully started.** This method throws an exception in case the interactor is *not* running ! [block:code] { "codes": [ { "code": "List<Beacon> beaconList = Interactor.getInstance().getAllBeacons();\n", "language": "java" } ] } [/block]
{"_id":"5770cba14607a30e001debca","title":"Getting started with iOS","version":"5770cba14607a30e001debc2","category":"5770cba14607a30e001debc6","hidden":false,"order":0,"parentDoc":null,"updates":[],"user":"54e5a4a0d3ab670d00f3af54","createdAt":"2016-02-29T14:32:46.474Z","githubsync":"","project":"56d4304373dcd20b00fb854e","sync_unique":"","isReference":false,"link_external":false,"link_url":"","slug":"getting-started-with-ios","__v":0,"api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"body":"Start by downloading the Interactor SDK -->  [HERE](doc:ios)\n\nAdd the SDK and the following system frameworks to your project:\n- CoreBluetooth\n- CoreLocation\n- SystemConfiguration\n- libc++.dylib\n\n\nIn order to use the SDK, you need an Account in the [Proximity Web Platform](https://proximity.indoo.rs). There, under \"Accounts & Users\" --> \"Account Details\" you can find your API Key.\n \nIn order to use Interactor you first have to configure it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] configureWithApiKey:@\\\"YOUR-API-KEY\\\"];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nIf more configuration is needed, the LBSConfig should be used.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"LBSConfig * config = [[LBSConfig alloc]init];\\nconfig.server = @\\\"https://proximity.indoo.rs\\\";\\nconfig.apiKey = @\\\"YOUR-API-KEY\\\";\\nconfig.logging = NO;\\n[[Interactor sharedInteractor] configureWithConfig:config];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nFirst call the configuration function - then start the Interactor with:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] startInteractor];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nYou can stop the Interactor at any time by calling\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] stopInteractor];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nAt any point you can check if Interactor is running by calling next method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] isRunning];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"isRunning  method is deprecated since 1.13.0 version\",\n  \"body\": \"Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.\"\n}\n[/block]\nIf you want to check if interactor is running, do it by calling:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] getInteractorState];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nWhen Interactor is running it will be in LBSInteractorStateStarted state. All available states are listed in \"Interactor.h\" file.\n\nTo receive changes of Interactor states you need to register an Interactor state listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] registerInteractorStateListener:self];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nThe instance of the Interactor state listener has to implement the InteractorStateListener Protocol.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)interactorStateChanged:(LBSInteractorState)state\\n{\\n\\t\\tswitch (state) {\\n        case LBSInteractorStateStarting:\\n            NSLog(@\\\"LBSInteractorStateStarting\\\");\\n            break;\\n        case LBSInteractorStateLoadingData:\\n            NSLog(@\\\"LBSInteractorStateLoadingData\\\");\\n            break;\\n        case LBSInteractorStateRunning:\\n            NSLog(@\\\"LBSInteractorStateRunning\\\");\\n            break;\\n        case LBSInteractorStateStopping:\\n            NSLog(@\\\"LBSInteractorStateStopping\\\");\\n            break;\\n        case LBSInteractorStateStopped:\\n            NSLog(@\\\"LBSInteractorStateStopped\\\");\\n            break;\\n        default:\\n            break;\\n    }\\n}\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nEach time Interactor changes its state, this listener will be fired.\n\nTo be able to work in the background, the SDK needs to use the iOS location manager. To enable this, you have to enter the NSLocation usage to your InfoPList.strings. You can chose to use NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription. By using NSLocationWhenInUseUsageDescription, the beacon position information and notifications will work **only **when the application is in the foreground.\n\n\nBy default Interactor checks for Bluetooth access. If you want to handle this within your app, set the following configuration flag to NO.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"config.checkBluetoothAccess = NO;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"config.checkLocationAccess\",\n  \"body\": \"Starting from Interactor version 1.13.0, this property has been completely removed and replaced with config.locationAccess.\"\n}\n[/block]\nBy default Interactor checks for Location service access for Always usage. If you want to change this within your app, set the following flag to any other Location service access parameter.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"config.locationAccess = LBSLocationAccessAlways;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nAvailable options for location access are:\n    - LBSLocationAccessAlways (scanning for beacons in foreground and in the background)\n    - LBSLocationAccessWhenInUse (scanning for beacons only in foreground)\n    - LBSLocationAccessNever (scanning for beacons is not available)\n\n\nIf you are not interested in getting all beacon updates on the web front-end as soon as you have them visible within the app, you can set reduceServerTraffic property to true. This way your app will still work as it was before, but beacon information will be uploaded to the server only once per seen beacon per day.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"config.reduceServerTraffic = YES;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nAt any point you can check which Interactor version are you using by calling method below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"NSString *version = [Interactor versionInfo];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]","excerpt":"","type":"basic","childrenPages":[]}

Getting started with iOS


Start by downloading the Interactor SDK --> [HERE](doc:ios) Add the SDK and the following system frameworks to your project: - CoreBluetooth - CoreLocation - SystemConfiguration - libc++.dylib In order to use the SDK, you need an Account in the [Proximity Web Platform](https://proximity.indoo.rs). There, under "Accounts & Users" --> "Account Details" you can find your API Key. In order to use Interactor you first have to configure it: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] configureWithApiKey:@\"YOUR-API-KEY\"];", "language": "objectivec" } ] } [/block] If more configuration is needed, the LBSConfig should be used. [block:code] { "codes": [ { "code": "LBSConfig * config = [[LBSConfig alloc]init];\nconfig.server = @\"https://proximity.indoo.rs\";\nconfig.apiKey = @\"YOUR-API-KEY\";\nconfig.logging = NO;\n[[Interactor sharedInteractor] configureWithConfig:config];", "language": "objectivec" } ] } [/block] First call the configuration function - then start the Interactor with: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] startInteractor];", "language": "objectivec" } ] } [/block] You can stop the Interactor at any time by calling [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] stopInteractor];", "language": "objectivec" } ] } [/block] At any point you can check if Interactor is running by calling next method: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] isRunning];", "language": "objectivec" } ] } [/block] [block:callout] { "type": "warning", "title": "isRunning method is deprecated since 1.13.0 version", "body": "Instead of this method please use getInteractorState method which gives you more details about the current Interactor state." } [/block] If you want to check if interactor is running, do it by calling: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] getInteractorState];", "language": "objectivec" } ] } [/block] When Interactor is running it will be in LBSInteractorStateStarted state. All available states are listed in "Interactor.h" file. To receive changes of Interactor states you need to register an Interactor state listener. [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] registerInteractorStateListener:self];", "language": "objectivec" } ] } [/block] The instance of the Interactor state listener has to implement the InteractorStateListener Protocol. [block:code] { "codes": [ { "code": "- (void)interactorStateChanged:(LBSInteractorState)state\n{\n\t\tswitch (state) {\n case LBSInteractorStateStarting:\n NSLog(@\"LBSInteractorStateStarting\");\n break;\n case LBSInteractorStateLoadingData:\n NSLog(@\"LBSInteractorStateLoadingData\");\n break;\n case LBSInteractorStateRunning:\n NSLog(@\"LBSInteractorStateRunning\");\n break;\n case LBSInteractorStateStopping:\n NSLog(@\"LBSInteractorStateStopping\");\n break;\n case LBSInteractorStateStopped:\n NSLog(@\"LBSInteractorStateStopped\");\n break;\n default:\n break;\n }\n}", "language": "objectivec" } ] } [/block] Each time Interactor changes its state, this listener will be fired. To be able to work in the background, the SDK needs to use the iOS location manager. To enable this, you have to enter the NSLocation usage to your InfoPList.strings. You can chose to use NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription. By using NSLocationWhenInUseUsageDescription, the beacon position information and notifications will work **only **when the application is in the foreground. By default Interactor checks for Bluetooth access. If you want to handle this within your app, set the following configuration flag to NO. [block:code] { "codes": [ { "code": "config.checkBluetoothAccess = NO;", "language": "objectivec" } ] } [/block] [block:callout] { "type": "danger", "title": "config.checkLocationAccess", "body": "Starting from Interactor version 1.13.0, this property has been completely removed and replaced with config.locationAccess." } [/block] By default Interactor checks for Location service access for Always usage. If you want to change this within your app, set the following flag to any other Location service access parameter. [block:code] { "codes": [ { "code": "config.locationAccess = LBSLocationAccessAlways;", "language": "objectivec" } ] } [/block] Available options for location access are: - LBSLocationAccessAlways (scanning for beacons in foreground and in the background) - LBSLocationAccessWhenInUse (scanning for beacons only in foreground) - LBSLocationAccessNever (scanning for beacons is not available) If you are not interested in getting all beacon updates on the web front-end as soon as you have them visible within the app, you can set reduceServerTraffic property to true. This way your app will still work as it was before, but beacon information will be uploaded to the server only once per seen beacon per day. [block:code] { "codes": [ { "code": "config.reduceServerTraffic = YES;", "language": "objectivec" } ] } [/block] At any point you can check which Interactor version are you using by calling method below. [block:code] { "codes": [ { "code": "NSString *version = [Interactor versionInfo];", "language": "objectivec" } ] } [/block]
Start by downloading the Interactor SDK --> [HERE](doc:ios) Add the SDK and the following system frameworks to your project: - CoreBluetooth - CoreLocation - SystemConfiguration - libc++.dylib In order to use the SDK, you need an Account in the [Proximity Web Platform](https://proximity.indoo.rs). There, under "Accounts & Users" --> "Account Details" you can find your API Key. In order to use Interactor you first have to configure it: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] configureWithApiKey:@\"YOUR-API-KEY\"];", "language": "objectivec" } ] } [/block] If more configuration is needed, the LBSConfig should be used. [block:code] { "codes": [ { "code": "LBSConfig * config = [[LBSConfig alloc]init];\nconfig.server = @\"https://proximity.indoo.rs\";\nconfig.apiKey = @\"YOUR-API-KEY\";\nconfig.logging = NO;\n[[Interactor sharedInteractor] configureWithConfig:config];", "language": "objectivec" } ] } [/block] First call the configuration function - then start the Interactor with: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] startInteractor];", "language": "objectivec" } ] } [/block] You can stop the Interactor at any time by calling [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] stopInteractor];", "language": "objectivec" } ] } [/block] At any point you can check if Interactor is running by calling next method: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] isRunning];", "language": "objectivec" } ] } [/block] [block:callout] { "type": "warning", "title": "isRunning method is deprecated since 1.13.0 version", "body": "Instead of this method please use getInteractorState method which gives you more details about the current Interactor state." } [/block] If you want to check if interactor is running, do it by calling: [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] getInteractorState];", "language": "objectivec" } ] } [/block] When Interactor is running it will be in LBSInteractorStateStarted state. All available states are listed in "Interactor.h" file. To receive changes of Interactor states you need to register an Interactor state listener. [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] registerInteractorStateListener:self];", "language": "objectivec" } ] } [/block] The instance of the Interactor state listener has to implement the InteractorStateListener Protocol. [block:code] { "codes": [ { "code": "- (void)interactorStateChanged:(LBSInteractorState)state\n{\n\t\tswitch (state) {\n case LBSInteractorStateStarting:\n NSLog(@\"LBSInteractorStateStarting\");\n break;\n case LBSInteractorStateLoadingData:\n NSLog(@\"LBSInteractorStateLoadingData\");\n break;\n case LBSInteractorStateRunning:\n NSLog(@\"LBSInteractorStateRunning\");\n break;\n case LBSInteractorStateStopping:\n NSLog(@\"LBSInteractorStateStopping\");\n break;\n case LBSInteractorStateStopped:\n NSLog(@\"LBSInteractorStateStopped\");\n break;\n default:\n break;\n }\n}", "language": "objectivec" } ] } [/block] Each time Interactor changes its state, this listener will be fired. To be able to work in the background, the SDK needs to use the iOS location manager. To enable this, you have to enter the NSLocation usage to your InfoPList.strings. You can chose to use NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription. By using NSLocationWhenInUseUsageDescription, the beacon position information and notifications will work **only **when the application is in the foreground. By default Interactor checks for Bluetooth access. If you want to handle this within your app, set the following configuration flag to NO. [block:code] { "codes": [ { "code": "config.checkBluetoothAccess = NO;", "language": "objectivec" } ] } [/block] [block:callout] { "type": "danger", "title": "config.checkLocationAccess", "body": "Starting from Interactor version 1.13.0, this property has been completely removed and replaced with config.locationAccess." } [/block] By default Interactor checks for Location service access for Always usage. If you want to change this within your app, set the following flag to any other Location service access parameter. [block:code] { "codes": [ { "code": "config.locationAccess = LBSLocationAccessAlways;", "language": "objectivec" } ] } [/block] Available options for location access are: - LBSLocationAccessAlways (scanning for beacons in foreground and in the background) - LBSLocationAccessWhenInUse (scanning for beacons only in foreground) - LBSLocationAccessNever (scanning for beacons is not available) If you are not interested in getting all beacon updates on the web front-end as soon as you have them visible within the app, you can set reduceServerTraffic property to true. This way your app will still work as it was before, but beacon information will be uploaded to the server only once per seen beacon per day. [block:code] { "codes": [ { "code": "config.reduceServerTraffic = YES;", "language": "objectivec" } ] } [/block] At any point you can check which Interactor version are you using by calling method below. [block:code] { "codes": [ { "code": "NSString *version = [Interactor versionInfo];", "language": "objectivec" } ] } [/block]
{"_id":"5770cba14607a30e001debcb","project":"56d4304373dcd20b00fb854e","updates":[],"excerpt":"","link_url":"","order":1,"type":"basic","githubsync":"","hidden":false,"slug":"ios-event-notifications","__v":0,"api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]}},"createdAt":"2016-02-29T14:32:55.994Z","isReference":false,"link_external":false,"parentDoc":null,"sync_unique":"","title":"iOS Event Notifications","body":"To receive the notifications for the events created in the platform you need to register an event listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] registerEventListener:self];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nThe instance of the event listener has to implement the EventListener Protocol.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void)eventTriggered:(LBSEvent *)event {\\n  \\n    NSString *eventName = event.name;\\n    NSString *eventDescription = event.eventDescription;\\n    LBSEventType eventType = event.type;\\n    NSNumber *zoneID = event.zone.zoneId;\\n    LBSZoneSize zoneSize = event.zone.zoneSize;\\n    \\n    for (LBSEventContent *eventContent in selectedEvent.content) {\\n        LBSEventContentType contentType = eventContent.type;\\n        NSString *contentValue = eventContent.value;\\n        NSString *contentKey = eventContent.key;\\n    }\\n }\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nIf the beacon comes in range and meets the criteria specified, each listener is invoked.\nThe event object contains the informations specified in the platform.","category":"5770cba14607a30e001debc6","user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","childrenPages":[]}

iOS Event Notifications


To receive the notifications for the events created in the platform you need to register an event listener. [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] registerEventListener:self];", "language": "objectivec" } ] } [/block] The instance of the event listener has to implement the EventListener Protocol. [block:code] { "codes": [ { "code": "-(void)eventTriggered:(LBSEvent *)event {\n \n NSString *eventName = event.name;\n NSString *eventDescription = event.eventDescription;\n LBSEventType eventType = event.type;\n NSNumber *zoneID = event.zone.zoneId;\n LBSZoneSize zoneSize = event.zone.zoneSize;\n \n for (LBSEventContent *eventContent in selectedEvent.content) {\n LBSEventContentType contentType = eventContent.type;\n NSString *contentValue = eventContent.value;\n NSString *contentKey = eventContent.key;\n }\n }", "language": "objectivec" } ] } [/block] If the beacon comes in range and meets the criteria specified, each listener is invoked. The event object contains the informations specified in the platform.
To receive the notifications for the events created in the platform you need to register an event listener. [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] registerEventListener:self];", "language": "objectivec" } ] } [/block] The instance of the event listener has to implement the EventListener Protocol. [block:code] { "codes": [ { "code": "-(void)eventTriggered:(LBSEvent *)event {\n \n NSString *eventName = event.name;\n NSString *eventDescription = event.eventDescription;\n LBSEventType eventType = event.type;\n NSNumber *zoneID = event.zone.zoneId;\n LBSZoneSize zoneSize = event.zone.zoneSize;\n \n for (LBSEventContent *eventContent in selectedEvent.content) {\n LBSEventContentType contentType = eventContent.type;\n NSString *contentValue = eventContent.value;\n NSString *contentKey = eventContent.key;\n }\n }", "language": "objectivec" } ] } [/block] If the beacon comes in range and meets the criteria specified, each listener is invoked. The event object contains the informations specified in the platform.
{"_id":"5770cba14607a30e001debcc","version":"5770cba14607a30e001debc2","category":"5770cba14607a30e001debc6","createdAt":"2016-02-29T14:33:22.762Z","excerpt":"","link_url":"","parentDoc":null,"order":2,"type":"basic","updates":[],"user":"54e5a4a0d3ab670d00f3af54","__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","isReference":false,"sync_unique":"","title":"Beacon API","body":"In addition to the event listeners, the SDK provides a simple method to listen for beacons.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Interactor sharedInteractor] registerBeaconListener:self forBeacon:[LBSBeacon initWithWithUUID: uuid major:62458 minor:58406]];\\n\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nThe listener has to implement the protocol BeaconListener\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"New Beacon event format from 1.8.0 verson\",\n  \"body\": \"In version 1.8.0 we changed the BeaconListener protocol. New listener function contains more detailed information about the beacon.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void)didRangeRegion:(LBSBeaconEvent *)event{\\n    LBSBeacon *beacon = event.beacon;\\n    CLLocationAccuracy distance = event.distance;\\n    NSInteger rssi = event.rssi;\\n    CLProximity range = event.range;\\n }\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nIf the app is in the background, the app is started and the listener gets invoked. After the first registration this need to be done every time in the didFinishLaunchingWithOptions, the sdk does not persist any state for listeners.\niOS has the restriction that only a maximum of 20 Beacons can be registered for background monitoring. That platform of course allows more than that so the developer has to handle it.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"NSMutableSet * beacons = [[Interactor sharedInteractor] getAllBeacons];\\nfor (LBSBeacon * beacon in beacons) {\\n    [[Interactor sharedInteractor] registerBeaconListener:nil forBeacon: beacon];\\n}\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]","hidden":false,"link_external":false,"project":"56d4304373dcd20b00fb854e","slug":"beacon-api-1","childrenPages":[]}

Beacon API


In addition to the event listeners, the SDK provides a simple method to listen for beacons. [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] registerBeaconListener:self forBeacon:[LBSBeacon initWithWithUUID: uuid major:62458 minor:58406]];\n", "language": "objectivec" } ] } [/block] The listener has to implement the protocol BeaconListener [block:callout] { "type": "warning", "title": "New Beacon event format from 1.8.0 verson", "body": "In version 1.8.0 we changed the BeaconListener protocol. New listener function contains more detailed information about the beacon." } [/block] [block:code] { "codes": [ { "code": "-(void)didRangeRegion:(LBSBeaconEvent *)event{\n LBSBeacon *beacon = event.beacon;\n CLLocationAccuracy distance = event.distance;\n NSInteger rssi = event.rssi;\n CLProximity range = event.range;\n }", "language": "objectivec" } ] } [/block] If the app is in the background, the app is started and the listener gets invoked. After the first registration this need to be done every time in the didFinishLaunchingWithOptions, the sdk does not persist any state for listeners. iOS has the restriction that only a maximum of 20 Beacons can be registered for background monitoring. That platform of course allows more than that so the developer has to handle it. [block:code] { "codes": [ { "code": "NSMutableSet * beacons = [[Interactor sharedInteractor] getAllBeacons];\nfor (LBSBeacon * beacon in beacons) {\n [[Interactor sharedInteractor] registerBeaconListener:nil forBeacon: beacon];\n}", "language": "objectivec" } ] } [/block]
In addition to the event listeners, the SDK provides a simple method to listen for beacons. [block:code] { "codes": [ { "code": "[[Interactor sharedInteractor] registerBeaconListener:self forBeacon:[LBSBeacon initWithWithUUID: uuid major:62458 minor:58406]];\n", "language": "objectivec" } ] } [/block] The listener has to implement the protocol BeaconListener [block:callout] { "type": "warning", "title": "New Beacon event format from 1.8.0 verson", "body": "In version 1.8.0 we changed the BeaconListener protocol. New listener function contains more detailed information about the beacon." } [/block] [block:code] { "codes": [ { "code": "-(void)didRangeRegion:(LBSBeaconEvent *)event{\n LBSBeacon *beacon = event.beacon;\n CLLocationAccuracy distance = event.distance;\n NSInteger rssi = event.rssi;\n CLProximity range = event.range;\n }", "language": "objectivec" } ] } [/block] If the app is in the background, the app is started and the listener gets invoked. After the first registration this need to be done every time in the didFinishLaunchingWithOptions, the sdk does not persist any state for listeners. iOS has the restriction that only a maximum of 20 Beacons can be registered for background monitoring. That platform of course allows more than that so the developer has to handle it. [block:code] { "codes": [ { "code": "NSMutableSet * beacons = [[Interactor sharedInteractor] getAllBeacons];\nfor (LBSBeacon * beacon in beacons) {\n [[Interactor sharedInteractor] registerBeaconListener:nil forBeacon: beacon];\n}", "language": "objectivec" } ] } [/block]
{"_id":"5770cba14607a30e001debe7","body":"Start by downloading the Cordova plugin -->  [HERE](doc:downloads-cordova-1)\n\nDocumentation on how to prepare Cordova environment, create your first project and include plugin into it can be found [HERE](https://cordova.apache.org/#getstarted)\n\nIn order to use the plugin, you need an Account in the [Proximity Web Platform](https://proximity.indoo.rs). There, under \"Accounts & Users\" --> \"Account Details\" you can find your API Key.\n\nYou can also check out our sample app, showing you how to use our plugin [HERE](https://bitbucket.org/interactdev/interactor-ionic-test-app-public)\n\nIn order to use Interactor you first have to configure it\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var configOptions = {\\n    apiKey: \\\"YOUR-API-KEY\\\",                    \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t//mandatory\\n    server: \\\"https://proximity.indoo.rs\\\",  \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t//optional\\n    logging: false,                            \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t//optional\\n    checkBluetoothAccess: true,\\t\\t\\t\\t\\t\\t\\t\\t \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t//optional, iOS only\\n    locationAccess: Interactor.LocationAccess.LocationAccessAlways,\\t\\t\\t\\t//optional, iOS only\\n    reduceServerTraffic: false,               \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t//optional\\n    backgroundScanPauseDuration: 60000         \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t//optional, android only\\n}\\n\\nInteractor.configureInteractor(configOptions, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**apikey** : your api key for interactor.\n\n**server** : the url to interactor server.\n\n**logging** : if you want to see logs or not. \n \n**checkBluetoothAccess** : You have to display a permission, so user can see and approve bluetooth access for the app. By default the plugin asks for bluetooth permission. \n\n**locationAccess** : You have to display a permission, so user can see and approve location access for the app. Location access can have 3 different values and therefore there are 3 values provided by the plugin:\n        - LocationAccessAlways (scanning for beacons in foreground and in the background)\n        - LocationAccessWhenInUse (scanning for beacons only in foreground)\n        - LocationAccessNever (scanning for beacons is not available)\n   By default the plugin uses LocationAccessAlways. Use the \"LocationAccessWhenInUse\" option to tell the SDK it should only scan for beacons when the app is in the foreground.\n\n**backgroundScanInterval** :  this is deprecated and no longer used\n\n**foregroundScanInterval** :  this is deprecated and no longer used \n\n**backgroundScanPauseDuration** : Sets the duration of pause in milliseconds between LE scans  **in background**. The duration of the pause by default is set to **60 seconds**  to save battery consumption on the mobile device. **This option is supported on Android platform only**. Do not set below 60000 ms, or certain android devices will cause problems.\n\n**reduceServerTraffic** : when enabled the SDK sends beacon status data to the server only once per seen beacon per day. If you are not consuming beacon events in a custom back-end, we recommend enabling this feature.\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"Starting version 1.13.0 these configuration parameters are deprecated and the value set from them is ignored.\\nThe parameter backgroundScanPauseDuration is used instead of the *backgroundScanInterval*\",\n  \"title\": \"foregroundScanInterval and backgroundScanInterval\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"From version 1.9.0 enableEventNotification parameter is removed, and notifications are enabled by default only in the background. If you want to calibrate notifications take a look at configureNotification method.\",\n  \"title\": \"enableEventNotifications\"\n}\n[/block]\nTo start the Interactor with:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.startInteractor(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Configuring Interactor\",\n  \"body\": \"Once Interactor is configured, it can't be reconfigured with new parameters. If Interactor is started, changing configuration parameters is not possible.\"\n}\n[/block]\nYou can stop the Interactor at any time by calling\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.stopInteractor(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nRestart Interactor by calling the start method again.\nYou can also check if interactor is running at any point.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.interactorRunning(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nRunning status is received as parameter of successCallback function.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.\",\n  \"title\": \"interactorRunning deprecated from 1.13.0 plugin version\"\n}\n[/block]\nIf you want to check if Interactor is running, do it by calling:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getInteractorState(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nWhen Interactor is running it will be in InteractorStateStarted state. All available states are listed in \"Interactor.js\" file.\n\nTo receive changes of Interactor states you need to register an Interactor state listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.registerInteractorStateListener(app.stateListener,app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nInteractor state will be received as parameter of eventListenerCallback function.\n\nAfter successful registration for Interactor states, you can at any point remove state listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.removeInteractorStateListener(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nAt any point you can check which Interactor version are you using by calling method below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getVersionInfo(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nVersion info is received as parameter of successCallback function and it looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"cordovaInteractorPluginVersion\\\": \\\"1.10.1\\\",\\n\\t  \\\"interactorSDKVersion\\\": \\\"1.10.0.87\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Syncronise data function removed in 1.11.0\",\n  \"body\": \"Synchronisation with the server is now done automatically in the background, and therefore this function is removed from the public API.\"\n}\n[/block]","hidden":false,"title":"Getting started with Cordova Interactor plugin","isReference":false,"order":0,"project":"56d4304373dcd20b00fb854e","slug":"getting-started-with-cordova-interactor-plugin","__v":0,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":""},"createdAt":"2016-02-29T14:34:59.415Z","sync_unique":"","updates":[],"category":"5770cba14607a30e001debc7","githubsync":"","link_external":false,"link_url":"","version":"5770cba14607a30e001debc2","excerpt":"","parentDoc":null,"type":"basic","user":"54e5a4a0d3ab670d00f3af54","childrenPages":[]}

Getting started with Cordova Interactor plugin


Start by downloading the Cordova plugin --> [HERE](doc:downloads-cordova-1) Documentation on how to prepare Cordova environment, create your first project and include plugin into it can be found [HERE](https://cordova.apache.org/#getstarted) In order to use the plugin, you need an Account in the [Proximity Web Platform](https://proximity.indoo.rs). There, under "Accounts & Users" --> "Account Details" you can find your API Key. You can also check out our sample app, showing you how to use our plugin [HERE](https://bitbucket.org/interactdev/interactor-ionic-test-app-public) In order to use Interactor you first have to configure it [block:code] { "codes": [ { "code": "var configOptions = {\n apiKey: \"YOUR-API-KEY\", \t\t\t\t\t\t\t\t\t\t\t\t\t\t//mandatory\n server: \"https://proximity.indoo.rs\", \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional\n logging: false, \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional\n checkBluetoothAccess: true,\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional, iOS only\n locationAccess: Interactor.LocationAccess.LocationAccessAlways,\t\t\t\t//optional, iOS only\n reduceServerTraffic: false, \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional\n backgroundScanPauseDuration: 60000 \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional, android only\n}\n\nInteractor.configureInteractor(configOptions, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] **apikey** : your api key for interactor. **server** : the url to interactor server. **logging** : if you want to see logs or not. **checkBluetoothAccess** : You have to display a permission, so user can see and approve bluetooth access for the app. By default the plugin asks for bluetooth permission. **locationAccess** : You have to display a permission, so user can see and approve location access for the app. Location access can have 3 different values and therefore there are 3 values provided by the plugin: - LocationAccessAlways (scanning for beacons in foreground and in the background) - LocationAccessWhenInUse (scanning for beacons only in foreground) - LocationAccessNever (scanning for beacons is not available) By default the plugin uses LocationAccessAlways. Use the "LocationAccessWhenInUse" option to tell the SDK it should only scan for beacons when the app is in the foreground. **backgroundScanInterval** : this is deprecated and no longer used **foregroundScanInterval** : this is deprecated and no longer used **backgroundScanPauseDuration** : Sets the duration of pause in milliseconds between LE scans **in background**. The duration of the pause by default is set to **60 seconds** to save battery consumption on the mobile device. **This option is supported on Android platform only**. Do not set below 60000 ms, or certain android devices will cause problems. **reduceServerTraffic** : when enabled the SDK sends beacon status data to the server only once per seen beacon per day. If you are not consuming beacon events in a custom back-end, we recommend enabling this feature. [block:callout] { "type": "danger", "body": "Starting version 1.13.0 these configuration parameters are deprecated and the value set from them is ignored.\nThe parameter backgroundScanPauseDuration is used instead of the *backgroundScanInterval*", "title": "foregroundScanInterval and backgroundScanInterval" } [/block] [block:callout] { "type": "warning", "body": "From version 1.9.0 enableEventNotification parameter is removed, and notifications are enabled by default only in the background. If you want to calibrate notifications take a look at configureNotification method.", "title": "enableEventNotifications" } [/block] To start the Interactor with: [block:code] { "codes": [ { "code": "Interactor.startInteractor(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] [block:callout] { "type": "warning", "title": "Configuring Interactor", "body": "Once Interactor is configured, it can't be reconfigured with new parameters. If Interactor is started, changing configuration parameters is not possible." } [/block] You can stop the Interactor at any time by calling [block:code] { "codes": [ { "code": "Interactor.stopInteractor(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Restart Interactor by calling the start method again. You can also check if interactor is running at any point. [block:code] { "codes": [ { "code": "Interactor.interactorRunning(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Running status is received as parameter of successCallback function. [block:callout] { "type": "warning", "body": "Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.", "title": "interactorRunning deprecated from 1.13.0 plugin version" } [/block] If you want to check if Interactor is running, do it by calling: [block:code] { "codes": [ { "code": "Interactor.getInteractorState(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] When Interactor is running it will be in InteractorStateStarted state. All available states are listed in "Interactor.js" file. To receive changes of Interactor states you need to register an Interactor state listener. [block:code] { "codes": [ { "code": "Interactor.registerInteractorStateListener(app.stateListener,app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Interactor state will be received as parameter of eventListenerCallback function. After successful registration for Interactor states, you can at any point remove state listener. [block:code] { "codes": [ { "code": "Interactor.removeInteractorStateListener(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] At any point you can check which Interactor version are you using by calling method below. [block:code] { "codes": [ { "code": "Interactor.getVersionInfo(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Version info is received as parameter of successCallback function and it looks like this: [block:code] { "codes": [ { "code": "{\n \"cordovaInteractorPluginVersion\": \"1.10.1\",\n\t \"interactorSDKVersion\": \"1.10.0.87\"\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Syncronise data function removed in 1.11.0", "body": "Synchronisation with the server is now done automatically in the background, and therefore this function is removed from the public API." } [/block]
Start by downloading the Cordova plugin --> [HERE](doc:downloads-cordova-1) Documentation on how to prepare Cordova environment, create your first project and include plugin into it can be found [HERE](https://cordova.apache.org/#getstarted) In order to use the plugin, you need an Account in the [Proximity Web Platform](https://proximity.indoo.rs). There, under "Accounts & Users" --> "Account Details" you can find your API Key. You can also check out our sample app, showing you how to use our plugin [HERE](https://bitbucket.org/interactdev/interactor-ionic-test-app-public) In order to use Interactor you first have to configure it [block:code] { "codes": [ { "code": "var configOptions = {\n apiKey: \"YOUR-API-KEY\", \t\t\t\t\t\t\t\t\t\t\t\t\t\t//mandatory\n server: \"https://proximity.indoo.rs\", \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional\n logging: false, \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional\n checkBluetoothAccess: true,\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional, iOS only\n locationAccess: Interactor.LocationAccess.LocationAccessAlways,\t\t\t\t//optional, iOS only\n reduceServerTraffic: false, \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional\n backgroundScanPauseDuration: 60000 \t\t\t\t\t\t\t\t\t\t\t\t\t\t//optional, android only\n}\n\nInteractor.configureInteractor(configOptions, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] **apikey** : your api key for interactor. **server** : the url to interactor server. **logging** : if you want to see logs or not. **checkBluetoothAccess** : You have to display a permission, so user can see and approve bluetooth access for the app. By default the plugin asks for bluetooth permission. **locationAccess** : You have to display a permission, so user can see and approve location access for the app. Location access can have 3 different values and therefore there are 3 values provided by the plugin: - LocationAccessAlways (scanning for beacons in foreground and in the background) - LocationAccessWhenInUse (scanning for beacons only in foreground) - LocationAccessNever (scanning for beacons is not available) By default the plugin uses LocationAccessAlways. Use the "LocationAccessWhenInUse" option to tell the SDK it should only scan for beacons when the app is in the foreground. **backgroundScanInterval** : this is deprecated and no longer used **foregroundScanInterval** : this is deprecated and no longer used **backgroundScanPauseDuration** : Sets the duration of pause in milliseconds between LE scans **in background**. The duration of the pause by default is set to **60 seconds** to save battery consumption on the mobile device. **This option is supported on Android platform only**. Do not set below 60000 ms, or certain android devices will cause problems. **reduceServerTraffic** : when enabled the SDK sends beacon status data to the server only once per seen beacon per day. If you are not consuming beacon events in a custom back-end, we recommend enabling this feature. [block:callout] { "type": "danger", "body": "Starting version 1.13.0 these configuration parameters are deprecated and the value set from them is ignored.\nThe parameter backgroundScanPauseDuration is used instead of the *backgroundScanInterval*", "title": "foregroundScanInterval and backgroundScanInterval" } [/block] [block:callout] { "type": "warning", "body": "From version 1.9.0 enableEventNotification parameter is removed, and notifications are enabled by default only in the background. If you want to calibrate notifications take a look at configureNotification method.", "title": "enableEventNotifications" } [/block] To start the Interactor with: [block:code] { "codes": [ { "code": "Interactor.startInteractor(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] [block:callout] { "type": "warning", "title": "Configuring Interactor", "body": "Once Interactor is configured, it can't be reconfigured with new parameters. If Interactor is started, changing configuration parameters is not possible." } [/block] You can stop the Interactor at any time by calling [block:code] { "codes": [ { "code": "Interactor.stopInteractor(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Restart Interactor by calling the start method again. You can also check if interactor is running at any point. [block:code] { "codes": [ { "code": "Interactor.interactorRunning(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Running status is received as parameter of successCallback function. [block:callout] { "type": "warning", "body": "Instead of this method please use getInteractorState method which gives you more details about the current Interactor state.", "title": "interactorRunning deprecated from 1.13.0 plugin version" } [/block] If you want to check if Interactor is running, do it by calling: [block:code] { "codes": [ { "code": "Interactor.getInteractorState(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] When Interactor is running it will be in InteractorStateStarted state. All available states are listed in "Interactor.js" file. To receive changes of Interactor states you need to register an Interactor state listener. [block:code] { "codes": [ { "code": "Interactor.registerInteractorStateListener(app.stateListener,app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Interactor state will be received as parameter of eventListenerCallback function. After successful registration for Interactor states, you can at any point remove state listener. [block:code] { "codes": [ { "code": "Interactor.removeInteractorStateListener(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] At any point you can check which Interactor version are you using by calling method below. [block:code] { "codes": [ { "code": "Interactor.getVersionInfo(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Version info is received as parameter of successCallback function and it looks like this: [block:code] { "codes": [ { "code": "{\n \"cordovaInteractorPluginVersion\": \"1.10.1\",\n\t \"interactorSDKVersion\": \"1.10.0.87\"\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Syncronise data function removed in 1.11.0", "body": "Synchronisation with the server is now done automatically in the background, and therefore this function is removed from the public API." } [/block]
{"_id":"5770cba14607a30e001debe8","hidden":false,"link_url":"","type":"basic","version":"5770cba14607a30e001debc2","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"category":"5770cba14607a30e001debc7","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"How to get event information?\"\n}\n[/block]\nTo receive notifications for events created in the platform you need to register an event listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.registerEventListener(app.eventListenerCallback, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nEvent data will be received as parameter of eventListenerCallback function.\nHere are few example events received as JSON objects:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" {\\n   \\\"type\\\":\\\"ZONE_ENTRY\\\",\\n   \\\"name\\\":\\\"Test text event\\\",\\n   \\\"description\\\":\\\"Description\\\",\\n   \\\"content\\\":\\n   [\\n     {\\n       \\\"key\\\":\\\"IT\\\",\\n       \\\"value\\\":\\\"Ciao!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     },{\\n       \\\"key\\\":\\\"EN\\\",\\n       \\\"value\\\":\\\"Hello!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     },{\\n       \\\"key\\\":\\\"FR\\\",\\n       \\\"value\\\":\\\"Bonjour!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     },{\\n       \\\"key\\\":\\\"DE\\\",\\n       \\\"value\\\":\\\"Hallo!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     }\\n   ],\\n   \\\"zone\\\": {\\n        \\\"id\\\":123,\\n        \\\"size\\\":\\\"MEDIUM\\\"\\n   }\\n }\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Typo in event data for field \\\"decryption\\\" fixed on iOS\",\n  \"body\": \"In 1.9.0 version, typo for a field description is fixed.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" {\\n   \\\"type\\\":\\\"ZONE_EXIT\\\",\\n   \\\"name\\\":\\\"Image Event\\\",\\n   \\\"decription\\\":\\\"\\\",\\n   \\\"content\\\":\\n   [\\n     {\\n \\t\\t\\t \\\"key\\\":\\\"NOKEY\\\",\\n       \\\"value\\\":\\\"/my/image/path/ImageName.jpg\\\",\\n       \\\"type\\\":\\\"IMAGE\\\"\\n     }\\n   ],\\n   \\\"zone\\\": {\\n        \\\"id\\\":1234,\\n        \\\"size\\\":\\\"SMALL\\\"\\n   }\\n }\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nAvailable event types are: ZONE_ENTRY, ZONE_EXIT and UNKNOWN.\nAvailable content types are: TEXT, IMAGE, URL and UNKNOWN.\nAvailable zone sizes are: LARGE, MEDIUM, SMALL, UNKNOWN.\n\nAfter successful registration for events, you can at any point remove event listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.removeEventListener(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"How to display local notifications when new event is received?\"\n}\n[/block]\nInteractor plugin fully support local notifications. Notifications are also configurable, meaning you can change weather you want to receive them and in which app state, do you want additional functionalities, etc. To configure local notifications you need to call following method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var configNotification = {\\n    receiveDuring: Interactor.NotificationStates.BACKGROUND, //optional\\n    vibrate: Interactor.NotificationStates.BACKGROUND,       //optional\\n    sound: Interactor.NotificationStates.BACKGROUND,         //optional\\n    stackText: false,                                  //optional, Android only\\n    iconName: 'icon',                                  //optional, Android only\\n    iconColor: '#6666FF',                              //optional, Android only\\n  \\tenableBadge: false,                                //optional, iOS only\\n    clearBadge: true,                                  //optional, iOS only\\n    stackTextTitle: 'Stacked Title'                    //optional, Android only\\n};\\n\\nInteractor.configureNotification(notificationCinfig, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nConfigNotification object contain all available configuration parameters with their default values. Values can be changed during the runtime, by calling **configureNotification** function as show in the example above.\n\n**receiveDuring** - App state during which the Plugin should trigger a notification when an Event is received. **Default** state is background only. \n\n**vibrate** - App state during which a received Notification will trigger the default notification vibration (respects phone’s vibrate settings like disabled, etc.).  **Default** state is background only.\n\n\n**sound** - App state during which a received Notification will play the default notification ringtone (respects phone’s audio settings like silent, etc.). **Default** state is background only.\n\nFor ***receiveDuring, sound and vibrate*** you can set the values base on this enum: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.NotificationStates = {\\n  BACKGROUND: 0,\\n  FOREGROUND: 1,\\n  BOTH: 2,\\n  NONE: 3\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**stackText** - (Android) Whether the notifications should be shown as separate notifications or stacked together when a new one is received. **Default** value is **false**. See also stackTextTitle if you want to add a title to the stacked notifications.\n\n**iconName** - (Android) The name of a drawable resource to use as the small-icon. The name should not include the extension. **Default**  icon name is Cordova app icon. If you change the icon make sure to put in **Drawable Resource folder for Android**.\n\n**iconColor** - (Android 5.0+) Color of the circle on which the icon is displayed. **Default** color is platform color.\n\n**enableBadge** - (iOS) Show a Badge on the App icon to indicate that a notification has been received.\n\n**clearBadge** - (iOS) If true: Remove Badge when app is opened.\n\n**stackTextTitle** - (Android) Presented title for stacked notifications. By default there is no title. We provided some recommended format for title and it looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" stackTextTitle: 'You have # events'\\n\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSpecial character # will be replaced with a number of stacked notification so title text will look like this if you have 5 stacked messages:\nYou have 5 messages.\n\n\nIf you wish to receive information about clicked notification inside your app, you will need to register notification listener. Data received inside eventListenerCallback contains event information mentioned above.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.registerNotificationListener(app.eventListenerCallback, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nTo remove the previously registered notification listener, the following call can be used.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.removeNotificationListener(app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe **NotificationListener**  returns a JSON object containing event array. \nHere is an example of the **notificationListener** callback: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\\"notifications\\\" : [{\\n   \\\"id\\\":\\\"EVENT_ID\\\"\\n   \\\"type\\\":\\\"ZONE_ENTRY\\\",\\n   \\\"name\\\":\\\"Test text event\\\",\\n   \\\"description\\\":\\\"\\\",\\n   \\\"content\\\":\\n   [\\n     {\\n       \\\"key\\\":\\\"IT\\\",\\n       \\\"value\\\":\\\"Ciao!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     },{\\n       \\\"key\\\":\\\"EN\\\",\\n       \\\"value\\\":\\\"Hello!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     },{\\n       \\\"key\\\":\\\"FR\\\",\\n       \\\"value\\\":\\\"Bonjour!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     },{\\n       \\\"key\\\":\\\"DE\\\",\\n       \\\"value\\\":\\\"Hallo!\\\",\\n       \\\"type\\\":\\\"TEXT\\\"\\n     }\\n   ]\\n }]}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"**NotificationListener**  callback\",\n  \"body\": \"Starting with version 1.9.0 the notification listener callback returns a list of events instead of only one event object.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Note that if you want to use notifications in the background you have to register the **NotificationListener** each time javascript code is started (it is recommended to call it within your onDeviceReady function).\\n\\n*** For android *** : The eventListenerCallback is called when app is in background after pressing 'home button', whereas the **Notificationlistener** is always called when the user taps on the notification.\\n\\nPlease note the difference as cordova JavaScript is killed when you press back button or in other words it is killed when activity is killed. So in this case the **NotificationListener** is fired when a notification arrives and is pressed.\\n\\nWhen home button is pressed the activity is not destroyed and the cordova JavaScript is still alive so eventListenerCallback is still alive and when you press on the notification the app is  foregrounded, in this case you receive the eventListenerCallback and the notificationListenerCallback.\",\n  \"title\": \"NotificationListener and EventListener in background\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Local Notification filtering\"\n}\n[/block]\nIf you want to filter which event that you want to display as a local notification, and which ones you would like to ignore, you will need to do the following:\n1. Create criteria on which event filtering is based (User data).\n2. Create a class which decides based on criteria if notification should be shown or not.\n3. Provide plugin with criteria and class information.\n\n**Criteria** is data that can be set from JavaScript and it is a string object.This is an example of criteria:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var userData = '{\\\"blacklist\\\" : [\\\"eventName1\\\",\\\"eventName2\\\"]}';\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe most important part of filtering notifications is \"platform specific\" code which needs to be implemented in order to parse provided criteria information. Since this part is different depending on the platform we will show you how to do it on both Android and iOS.\n\n**iOS**\n1. Create new CocoaClass file that is a subclass of NSObject.\n2. Inside .h file conform to NotificationFilter protocol, found in \"NotificationFilter.h\" class.\n3. Inside .m file override the implementation of filterEvent:withData: method from NotificationFilter protocol. Inside this method you can decide based on criteria weather to display local notification or not.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// ExtendedNotificationFilter.h\\n#import <Foundation/Foundation.h>\\n#import \\\"NotificationFilter.h\\\"\\n\\n@interface ExtendedNotificationFilter : NSObject <NotificationFilter>\\n@end\",\n      \"language\": \"text\",\n      \"name\": \"ExtendedNotificationFilter.h\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// ExtendedNotificationFilter.m\\n#import \\\"ExtendedNotificationFilter.h\\\"\\n\\n@implementation ExtendedNotificationFilter\\n\\n- (BOOL)filterEvent:(LBSEvent *)event withData:(NSString *)userData\\n{\\n    //This is an example code for the provided userData.\\n    NSError *err = nil;\\n    NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[userData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];\\n    \\n    NSArray *blacklist = [jsonObject valueForKey:@\\\"blacklist\\\"];\\n    if ([blacklist containsObject:event.name]) {\\n        return NO;\\n    }\\n    return YES;\\n}\\n\\n@end\",\n      \"language\": \"objectivec\",\n      \"name\": \"ExtendedNotificationFilter.m\"\n    }\n  ]\n}\n[/block]\nAfter defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to filter events:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.setNotificationFilterIOS('ExtendedNotificationFilter', userData, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n    * 'ExtendedNotificationFilter' - Class name of a file which is used for custom notification filtering.\n    * userData - String value used as criteria.\n\n\n\n**Android**\n1. Create a Java class that implements the com.lbs.interactor.NotificationFilter interface (the file should be located within the platforms/android/src folder of your Cordova App)\n2. Implement the filter method. Inside this method you can decide based on criteria weather to display local notification or not.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"package io.cordova.cordovaAppName;\\n\\n\\nimport android.util.Log;\\n\\nimport com.lbs.interactor.NotificationFilter;\\nimport com.lbs.interactor.events.Event;\\nimport com.lbs.interactor.events.EventContent;\\n\\nimport org.json.JSONArray;\\nimport org.json.JSONException;\\nimport org.json.JSONObject;\\n\\nimport java.util.ArrayList;\\nimport java.util.List;\\n\\n/**\\n * Implements the NotificationFilter.\\n *\\n * The userData is parsed as JSON and the result is cached in a field.\\n */\\npublic class ExtendedNotificationFilter implements NotificationFilter {\\n  \\n    private static final String TAG = ExtendedNotificationFilter.class.getSimpleName();\\n\\n    private List<String> blacklist = null;\\n\\n    /**\\n     * There has to be a default constructor\\n     */\\n    public ExtendedNotificationFilter() {\\n    }\\n\\n    @Override\\n    public boolean filter(Event event, String userData) {\\n        if (blacklist == null) {\\n            try {\\n                JSONObject json = new JSONObject(userData);\\n                JSONArray blacklistJSON = json.getJSONArray(\\\"blacklist\\\");\\n                blacklist = new ArrayList<String>();\\n                for (int i = 0; i < blacklistJSON.length(); i++) {\\n                    blacklist.add(blacklistJSON.getString(0));\\n                }\\n                Log.i(TAG, \\\"Blacklist: \\\" + blacklist);\\n            } catch (JSONException e) {\\n                Log.e(TAG, \\\"Error parsing userData\\\", e);\\n                return false;\\n            }\\n        }\\n\\n        if (blacklist.contains(event.getName())) {\\n            Log.i(TAG, \\\"Filtered event \\\" + event.getName() + \\\" because it is on the blacklist\\\");\\n            return false;\\n        }\\n\\n        return true;\\n    }\\n}\\n\",\n      \"language\": \"java\",\n      \"name\": \"platforms/android/src/io/cordova/cordovaAppname/ExtendedNotificationFilter.java\"\n    }\n  ]\n}\n[/block]\nAfter defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to filter events:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.setNotificationFilterAndroid('io.cordova.cordovaAppName.ExtendedNotificationFilter', userData, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n    * 'io.cordova.cordovaAppName.ExtendedNotificationFilter' - Full package path of a file which is used for custom notification filtering.\n    * userData - String value used as criteria.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Modify Local Notification content\"\n}\n[/block]\nIf you want your local notification to display different content than the event name and event description, you can use Local Notification modification feature. To enable modifications you will need to do the following:\n1. Create criteria on which notification content modification is based (User data).\n2. Create a class which decides based on criteria which content should be presented.\n3. Provide plugin with criteria and class information.\n\n**Criteria** is data that can be set from JavaScript and it is a string object.This is an example of criteria:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var userData = '{\\\"language\\\" : \\\"en\\\"}';\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe most important part of notification modifying is \"platform specific\" code which needs to be implemented in order to parse provided criteria information. Since this part is different depending on the platform we will show you how to do it on both Android and iOS.\n\n**iOS**\n1. Create new CocoaClass file that is a subclass of NSObject.\n2. Inside .h file conform to NotificationModifier protocol, found in \"NotificationModifier.h\" class.\n3. Inside .m file override the implementation of modifyNotification:withData:forEvent: method from NotificationModifier protocol. Inside this method you can decide based on criteria weather to modify local notification content or not.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// ExtendedNotificationModifier.h\\n#import <Foundation/Foundation.h>\\n#import \\\"NotificationModifier.h\\\"\\n\\n@interface ExtendedNotificationModifier : NSObject <NotificationModifier>\\n@end\",\n      \"language\": \"objectivec\",\n      \"name\": \"ExtendedNotificationModifier.h\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// ExtendedNotificationModifier.m\\n#import \\\"ExtendedNotificationModifier.h\\\"\\n\\n@implementation ExtendedNotificationModifier\\n\\n- (Notification *)modifyNotification:(Notification *)notification withData:(NSString *)userData forEvent:(LBSEvent *)event\\n{\\n    //This is an example code for the provided userData.\\n    NSError *err = nil;\\n    NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[userData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];\\n    \\n    NSString *language = [jsonObject valueForKey:@\\\"language\\\"];\\n    \\n    for (LBSEventContent *eventContent in event.content) {\\n        if (eventContent.type == TEXT) {\\n            if ([eventContent.key caseInsensitiveCompare:language]) {\\n                notification.notificationDescription = eventContent.value;\\n                break;\\n            }\\n        }\\n    }\\n    return notification;\\n}\\n\\n@end\",\n      \"language\": \"objectivec\",\n      \"name\": \"ExtendedNotificationModifier.m\"\n    }\n  ]\n}\n[/block]\nAfter defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to modify notification content:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.setNotificationModifierIOS('ExtendedNotificationModifier', userData, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n    * 'ExtendedNotificationModifier' - Class name of a file which is used for modifying notification content.\n    * userData - String value used as criteria.\n\n\n\n**Android**\n1. Create a Java class that implements the com.lbs.interactor.NotificationModifer interface (the file should be located within the platforms/android/src folder of your Cordova App)\n2. Implement the modify method. Inside this method you can decide based on criteria weather to display local notification or not.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"package io.cordova.cordovaAppName;\\n\\n\\nimport android.util.Log;\\n\\nimport com.lbs.interactor.NotificationModifier;\\nimport com.lbs.interactor.events.Event;\\nimport com.lbs.interactor.events.EventContent;\\n\\nimport org.json.JSONArray;\\nimport org.json.JSONException;\\nimport org.json.JSONObject;\\n\\n/**\\n * Implements the NotificationModifier.\\n *\\n * The userData is parsed as JSON and the result is cached in a field.\\n */\\npublic class ExtendedNotificationModifier implements NotificationModifier {\\n  \\n    private static final String TAG = ExtendedNotificationModifier.class.getSimpleName();\\n\\n    private String language = null;\\n\\n    /**\\n     * There has to be a default constructor\\n     */\\n    public ExtendedNotificationModifier() {\\n    }\\n\\n    @Override\\n    public void modify(Notification notification, Event event, String userData) {\\n        if (language == null) {\\n            try {\\n                JSONObject json = new JSONObject(userData);\\n                language = json.getString(\\\"language\\\");\\n                Log.i(TAG, \\\"Use language: \\\" + language);\\n            } catch (JSONException e) {\\n                Log.e(TAG, \\\"Error parsing userData\\\", e);\\n                return;\\n            }\\n        }\\n\\n        // Fill the description with the Text of the selected language\\n        for (EventContent eventContent : event.getEventContents()) {\\n            if (eventContent.getType() == EventContent.EventDataType.TEXT) {\\n                if (eventContent.getKey().equalsIgnoreCase(language)) {\\n                    notification.setDescription(eventContent.getValue());\\n                }\\n            }\\n        }\\n    }\\n}\\n\",\n      \"language\": \"java\",\n      \"name\": \"platforms/android/src/io/cordova/cordovaAppname/ExtendedNotificationModifier.java\"\n    }\n  ]\n}\n[/block]\nAfter defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to modify notification content:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.setNotificationModifierAndroid('io.cordova.cordovaAppName.ExtendedNotificationModifier', userData, app.successCallback, app.errorCallback);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n    * 'io.cordova.cordovaAppName.ExtendedNotificationModifier' - Full package path of a file which is used for modifying notification content.\n    * userData - String value used as criteria.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Event type - custom\"\n}\n[/block]\nWith version 1.10.0, we've enabled support for the event type Custom. The content of the event can be any valid JSON which can be used to do event filtering and provide versatile event content. Below is an example of a multi language event that contains different texts and images for each language. The example has a condition property which would be used in an notification filter and would in this case only be displayed to women between 30 and 40 years of age.\n\n*Note: You still have to implement the notification filter yourself.* \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"conditions\\\":\\n\\t{\\n\\t\\t\\\"gender\\\": \\\"female\\\",\\n\\t\\t\\\"age\\\": \\n    { \\n      \\\"lower\\\": \\\"30\\\", \\n      \\\"upper\\\" \\\"40\\\" \\n    }\\n\\t},\\n\\t\\\"english\\\":\\n\\t{\\n\\t\\t\\\"title\\\": \\\"English title\\\",\\n\\t\\t\\\"description\\\": \\\"English description\\\",\\n\\t\\t\\\"image\\\": \\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgURCAINxAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAABQElEQVRoge3av0sCYQDG8edCI2wQWyJp7MegODjcGDR4rTk0ZkOIQ7SU/iM1Cok5R7jaFNTi0FA4SENrOrTVWoN5CVIivN71vDyf6T3u4N4vd7wHd+cULjc+YbG5sCcwa5HhoL7fDXMeRh00Nv2x9VdQgewUyE6B7BTIToHsFMhOgewUyM76wMjkQya7uDvG7Uvr1/3ryy7KXgMLJk42JSOBQLgRf9EtalYflas95DJF3DxW0f94BQAcbXfhrs7mjAEHDlw/nOHUa2MtAbQ656jdu1j63jbNWOBzr43SyPvIUfnsCXZTJX97J33ox3jJLTSf6nh7B/CfA6dZZJLxn1gkVhCLLpqaxhjrFxkFsrM+MJBVNDYf9x8LQXOGH0D1+YyUAtkpkJ0C2SmQnQLZKZCdAtkpkJ0C2Vkf6Oive3JfMao7NwI+z0IAAAAASUVORK5CYII=\\\"\\n\\t},\\n\\t\\\"italian\\\":\\n\\t{\\n\\t\\t\\\"title\\\": \\\"Italian title\\\",\\n\\t\\t\\\"description\\\": \\\"Italian description\\\",\\n\\t\\t\\\"image\\\": \\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgU4SrCVqAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAAA/UlEQVRoge3arQ9BURzG8eeaYLKhKkwRdUXwFyjIJmuiTdMEEYWkmSmqCbrNpmBmNlNMI3mZTcE59tw9n3Ru+p3v7tluONfJt6MXuJjn3xswzXtbtHLzf+7jpwqd2H3t+jeoQHYKZKdAdgpkp0B2CmSnQHYKZKfAj62HKPaSWBwez9OVsWlvWXqDO5QnNTujXuiIfmu5b6HUzWB32qIxjqE6yuFseugT44GRQAGN7ABBfxil1ByVdAc+00Of6IiyUyA7Bf7S5ti0OQ6AtcAg4qEE+rO69e+gc7sA1fUZKQWyUyA7BbJTIDsFslMgOwWyUyA7BbJzfaCjv+7JXQGUri8apZNkvAAAAABJRU5ErkJggg==\\\"\\t\\n\\t},\\n\\t\\\"german\\\":\\n\\t{\\n\\t\\t\\\"title\\\": \\\"German title\\\",\\n\\t\\t\\\"description\\\": \\\"German description\\\",\\n\\t\\t\\\"image\\\": \\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgUkXrHJ5wAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAACAUlEQVRoge2aQUhUQRiAv41FbF1oFywzLQzSDRUEib1IQUibBw8dgk7lwYPIticFL3oqiM7iwYtS7yQIduhQdgjTLnsQBFdaC/KwShb0DFxdRKiD66stTYqZlX/5P3gwzHuPfz7mn/kfzPPde9rwnRLmxHEPwDb+/caTu+njHIdRupyI1y75GVRB6aigdFRQOiooHRWUjgpKRwWlo4LSKXlB/9GPHM3YXIKZj9MH3otfTxOtNRHl/zAiCFBfFaU/5lD+a6e7QPzlFZLn27nf9thUqH/CboqGWxi5+pBU5jUfXKuRDsX+Gqy5Rl2ojhdLAwXd06lhupyIdz1LjVoJbyxFDyfA6Yoq1rJr5IBy9uSmFh2GOtNcCpNP5W4AbjX1GI1elF20NtyAu/mJHACfefVukpvN3Xty4KXybHqSDcOxi18mVufZ3N2m+dxvMxWoJrfjspwxG64IKQoZd5lw8Ky3w27tfOPB88hf3zFFEQS3+JJdJxS86AkGyk7RF0v+TFGL2E/R1TesbKzQ0ZivgzWtBP0n+Zq1HhmwLeguEJ8dLNxQOMONy7cZfxstqI1jcwl6J6LG66WxFH2/nqTH+XNdHfSpFmtKABSsw8qKCzy6kyRkakB5fPsHoHp8JhQVlI4KSkcFpaOC0lFB6aigdFRQOiooHRWUTskL+vSve+H8AOlye9qCZBkbAAAAAElFTkSuQmCC\\\"\\t\\n\\t},\\n\\t\\\"french\\\":\\n\\t{\\n\\t\\t\\\"title\\\": \\\"French title\\\",\\n\\t\\t\\\"description\\\": \\\"French description\\\",\\n\\t\\t\\\"image\\\": \\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgYGoPzbwAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAABIUlEQVRoge3aoWsCUQDH8Z/DIBhmGBM2Z9MVs2UWy/4AzU4YgkFsVvEPMJoswuafoEmTYLJqOQzm2SwGiyZFRZnCexy/x++TDu64d1/euxeOC3z9Jrdw2IPfD2BbcH/wU/D8fA6jit33w7HzM6hAdgpkp0B2CmSnQHYKZKdAdgpk53xg8P9L7tMZVzFaDK6er2Q9pGOmR73OeCAAJKJp1D67CNm4+Z20RO1YotErIfX2gf60g6dwHPXcEBELI/kUCKw3K3jLGdoFz+pS9nWJpl4z1t9TKzM4/5ugfPTxde98B315LNsY/oR2UXYKZOd8oPFN5jvTuuGqZzTzI9NDX+T8DCqQnQLZKZCdAtkpkJ0C2SmQnQLZKZCd84EB/XVPbge6RyldFOD+9AAAAABJRU5ErkJggg==\\\"\\t\\n\\t}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","isReference":false,"parentDoc":null,"title":"Event Notifications","user":"54e5a4a0d3ab670d00f3af54","__v":0,"slug":"event-notifications","createdAt":"2016-02-29T14:35:14.062Z","project":"56d4304373dcd20b00fb854e","link_external":false,"order":1,"sync_unique":"","updates":[],"excerpt":"","githubsync":"","childrenPages":[]}

Event Notifications


[block:api-header] { "type": "basic", "title": "How to get event information?" } [/block] To receive notifications for events created in the platform you need to register an event listener. [block:code] { "codes": [ { "code": "Interactor.registerEventListener(app.eventListenerCallback, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Event data will be received as parameter of eventListenerCallback function. Here are few example events received as JSON objects: [block:code] { "codes": [ { "code": " {\n \"type\":\"ZONE_ENTRY\",\n \"name\":\"Test text event\",\n \"description\":\"Description\",\n \"content\":\n [\n {\n \"key\":\"IT\",\n \"value\":\"Ciao!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"EN\",\n \"value\":\"Hello!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"FR\",\n \"value\":\"Bonjour!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"DE\",\n \"value\":\"Hallo!\",\n \"type\":\"TEXT\"\n }\n ],\n \"zone\": {\n \"id\":123,\n \"size\":\"MEDIUM\"\n }\n }", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Typo in event data for field \"decryption\" fixed on iOS", "body": "In 1.9.0 version, typo for a field description is fixed." } [/block] [block:code] { "codes": [ { "code": " {\n \"type\":\"ZONE_EXIT\",\n \"name\":\"Image Event\",\n \"decription\":\"\",\n \"content\":\n [\n {\n \t\t\t \"key\":\"NOKEY\",\n \"value\":\"/my/image/path/ImageName.jpg\",\n \"type\":\"IMAGE\"\n }\n ],\n \"zone\": {\n \"id\":1234,\n \"size\":\"SMALL\"\n }\n }", "language": "json" } ] } [/block] Available event types are: ZONE_ENTRY, ZONE_EXIT and UNKNOWN. Available content types are: TEXT, IMAGE, URL and UNKNOWN. Available zone sizes are: LARGE, MEDIUM, SMALL, UNKNOWN. After successful registration for events, you can at any point remove event listener. [block:code] { "codes": [ { "code": "Interactor.removeEventListener(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "How to display local notifications when new event is received?" } [/block] Interactor plugin fully support local notifications. Notifications are also configurable, meaning you can change weather you want to receive them and in which app state, do you want additional functionalities, etc. To configure local notifications you need to call following method: [block:code] { "codes": [ { "code": "var configNotification = {\n receiveDuring: Interactor.NotificationStates.BACKGROUND, //optional\n vibrate: Interactor.NotificationStates.BACKGROUND, //optional\n sound: Interactor.NotificationStates.BACKGROUND, //optional\n stackText: false, //optional, Android only\n iconName: 'icon', //optional, Android only\n iconColor: '#6666FF', //optional, Android only\n \tenableBadge: false, //optional, iOS only\n clearBadge: true, //optional, iOS only\n stackTextTitle: 'Stacked Title' //optional, Android only\n};\n\nInteractor.configureNotification(notificationCinfig, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] ConfigNotification object contain all available configuration parameters with their default values. Values can be changed during the runtime, by calling **configureNotification** function as show in the example above. **receiveDuring** - App state during which the Plugin should trigger a notification when an Event is received. **Default** state is background only. **vibrate** - App state during which a received Notification will trigger the default notification vibration (respects phone’s vibrate settings like disabled, etc.). **Default** state is background only. **sound** - App state during which a received Notification will play the default notification ringtone (respects phone’s audio settings like silent, etc.). **Default** state is background only. For ***receiveDuring, sound and vibrate*** you can set the values base on this enum: [block:code] { "codes": [ { "code": "Interactor.NotificationStates = {\n BACKGROUND: 0,\n FOREGROUND: 1,\n BOTH: 2,\n NONE: 3\n}", "language": "json" } ] } [/block] **stackText** - (Android) Whether the notifications should be shown as separate notifications or stacked together when a new one is received. **Default** value is **false**. See also stackTextTitle if you want to add a title to the stacked notifications. **iconName** - (Android) The name of a drawable resource to use as the small-icon. The name should not include the extension. **Default** icon name is Cordova app icon. If you change the icon make sure to put in **Drawable Resource folder for Android**. **iconColor** - (Android 5.0+) Color of the circle on which the icon is displayed. **Default** color is platform color. **enableBadge** - (iOS) Show a Badge on the App icon to indicate that a notification has been received. **clearBadge** - (iOS) If true: Remove Badge when app is opened. **stackTextTitle** - (Android) Presented title for stacked notifications. By default there is no title. We provided some recommended format for title and it looks like this: [block:code] { "codes": [ { "code": " stackTextTitle: 'You have # events'\n", "language": "json" } ] } [/block] Special character # will be replaced with a number of stacked notification so title text will look like this if you have 5 stacked messages: You have 5 messages. If you wish to receive information about clicked notification inside your app, you will need to register notification listener. Data received inside eventListenerCallback contains event information mentioned above. [block:code] { "codes": [ { "code": "Interactor.registerNotificationListener(app.eventListenerCallback, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] To remove the previously registered notification listener, the following call can be used. [block:code] { "codes": [ { "code": "Interactor.removeNotificationListener(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] The **NotificationListener** returns a JSON object containing event array. Here is an example of the **notificationListener** callback: [block:code] { "codes": [ { "code": "{\"notifications\" : [{\n \"id\":\"EVENT_ID\"\n \"type\":\"ZONE_ENTRY\",\n \"name\":\"Test text event\",\n \"description\":\"\",\n \"content\":\n [\n {\n \"key\":\"IT\",\n \"value\":\"Ciao!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"EN\",\n \"value\":\"Hello!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"FR\",\n \"value\":\"Bonjour!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"DE\",\n \"value\":\"Hallo!\",\n \"type\":\"TEXT\"\n }\n ]\n }]}", "language": "json" } ] } [/block] [block:callout] { "type": "danger", "title": "**NotificationListener** callback", "body": "Starting with version 1.9.0 the notification listener callback returns a list of events instead of only one event object." } [/block] [block:callout] { "type": "info", "body": "Note that if you want to use notifications in the background you have to register the **NotificationListener** each time javascript code is started (it is recommended to call it within your onDeviceReady function).\n\n*** For android *** : The eventListenerCallback is called when app is in background after pressing 'home button', whereas the **Notificationlistener** is always called when the user taps on the notification.\n\nPlease note the difference as cordova JavaScript is killed when you press back button or in other words it is killed when activity is killed. So in this case the **NotificationListener** is fired when a notification arrives and is pressed.\n\nWhen home button is pressed the activity is not destroyed and the cordova JavaScript is still alive so eventListenerCallback is still alive and when you press on the notification the app is foregrounded, in this case you receive the eventListenerCallback and the notificationListenerCallback.", "title": "NotificationListener and EventListener in background" } [/block] [block:api-header] { "type": "basic", "title": "Local Notification filtering" } [/block] If you want to filter which event that you want to display as a local notification, and which ones you would like to ignore, you will need to do the following: 1. Create criteria on which event filtering is based (User data). 2. Create a class which decides based on criteria if notification should be shown or not. 3. Provide plugin with criteria and class information. **Criteria** is data that can be set from JavaScript and it is a string object.This is an example of criteria: [block:code] { "codes": [ { "code": "var userData = '{\"blacklist\" : [\"eventName1\",\"eventName2\"]}';", "language": "javascript" } ] } [/block] The most important part of filtering notifications is "platform specific" code which needs to be implemented in order to parse provided criteria information. Since this part is different depending on the platform we will show you how to do it on both Android and iOS. **iOS** 1. Create new CocoaClass file that is a subclass of NSObject. 2. Inside .h file conform to NotificationFilter protocol, found in "NotificationFilter.h" class. 3. Inside .m file override the implementation of filterEvent:withData: method from NotificationFilter protocol. Inside this method you can decide based on criteria weather to display local notification or not. [block:code] { "codes": [ { "code": "// ExtendedNotificationFilter.h\n#import <Foundation/Foundation.h>\n#import \"NotificationFilter.h\"\n\n@interface ExtendedNotificationFilter : NSObject <NotificationFilter>\n@end", "language": "text", "name": "ExtendedNotificationFilter.h" } ] } [/block] [block:code] { "codes": [ { "code": "// ExtendedNotificationFilter.m\n#import \"ExtendedNotificationFilter.h\"\n\n@implementation ExtendedNotificationFilter\n\n- (BOOL)filterEvent:(LBSEvent *)event withData:(NSString *)userData\n{\n //This is an example code for the provided userData.\n NSError *err = nil;\n NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[userData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];\n \n NSArray *blacklist = [jsonObject valueForKey:@\"blacklist\"];\n if ([blacklist containsObject:event.name]) {\n return NO;\n }\n return YES;\n}\n\n@end", "language": "objectivec", "name": "ExtendedNotificationFilter.m" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to filter events: [block:code] { "codes": [ { "code": "Interactor.setNotificationFilterIOS('ExtendedNotificationFilter', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'ExtendedNotificationFilter' - Class name of a file which is used for custom notification filtering. * userData - String value used as criteria. **Android** 1. Create a Java class that implements the com.lbs.interactor.NotificationFilter interface (the file should be located within the platforms/android/src folder of your Cordova App) 2. Implement the filter method. Inside this method you can decide based on criteria weather to display local notification or not. [block:code] { "codes": [ { "code": "package io.cordova.cordovaAppName;\n\n\nimport android.util.Log;\n\nimport com.lbs.interactor.NotificationFilter;\nimport com.lbs.interactor.events.Event;\nimport com.lbs.interactor.events.EventContent;\n\nimport org.json.JSONArray;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Implements the NotificationFilter.\n *\n * The userData is parsed as JSON and the result is cached in a field.\n */\npublic class ExtendedNotificationFilter implements NotificationFilter {\n \n private static final String TAG = ExtendedNotificationFilter.class.getSimpleName();\n\n private List<String> blacklist = null;\n\n /**\n * There has to be a default constructor\n */\n public ExtendedNotificationFilter() {\n }\n\n @Override\n public boolean filter(Event event, String userData) {\n if (blacklist == null) {\n try {\n JSONObject json = new JSONObject(userData);\n JSONArray blacklistJSON = json.getJSONArray(\"blacklist\");\n blacklist = new ArrayList<String>();\n for (int i = 0; i < blacklistJSON.length(); i++) {\n blacklist.add(blacklistJSON.getString(0));\n }\n Log.i(TAG, \"Blacklist: \" + blacklist);\n } catch (JSONException e) {\n Log.e(TAG, \"Error parsing userData\", e);\n return false;\n }\n }\n\n if (blacklist.contains(event.getName())) {\n Log.i(TAG, \"Filtered event \" + event.getName() + \" because it is on the blacklist\");\n return false;\n }\n\n return true;\n }\n}\n", "language": "java", "name": "platforms/android/src/io/cordova/cordovaAppname/ExtendedNotificationFilter.java" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to filter events: [block:code] { "codes": [ { "code": "Interactor.setNotificationFilterAndroid('io.cordova.cordovaAppName.ExtendedNotificationFilter', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'io.cordova.cordovaAppName.ExtendedNotificationFilter' - Full package path of a file which is used for custom notification filtering. * userData - String value used as criteria. [block:api-header] { "type": "basic", "title": "Modify Local Notification content" } [/block] If you want your local notification to display different content than the event name and event description, you can use Local Notification modification feature. To enable modifications you will need to do the following: 1. Create criteria on which notification content modification is based (User data). 2. Create a class which decides based on criteria which content should be presented. 3. Provide plugin with criteria and class information. **Criteria** is data that can be set from JavaScript and it is a string object.This is an example of criteria: [block:code] { "codes": [ { "code": "var userData = '{\"language\" : \"en\"}';", "language": "javascript" } ] } [/block] The most important part of notification modifying is "platform specific" code which needs to be implemented in order to parse provided criteria information. Since this part is different depending on the platform we will show you how to do it on both Android and iOS. **iOS** 1. Create new CocoaClass file that is a subclass of NSObject. 2. Inside .h file conform to NotificationModifier protocol, found in "NotificationModifier.h" class. 3. Inside .m file override the implementation of modifyNotification:withData:forEvent: method from NotificationModifier protocol. Inside this method you can decide based on criteria weather to modify local notification content or not. [block:code] { "codes": [ { "code": "// ExtendedNotificationModifier.h\n#import <Foundation/Foundation.h>\n#import \"NotificationModifier.h\"\n\n@interface ExtendedNotificationModifier : NSObject <NotificationModifier>\n@end", "language": "objectivec", "name": "ExtendedNotificationModifier.h" } ] } [/block] [block:code] { "codes": [ { "code": "// ExtendedNotificationModifier.m\n#import \"ExtendedNotificationModifier.h\"\n\n@implementation ExtendedNotificationModifier\n\n- (Notification *)modifyNotification:(Notification *)notification withData:(NSString *)userData forEvent:(LBSEvent *)event\n{\n //This is an example code for the provided userData.\n NSError *err = nil;\n NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[userData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];\n \n NSString *language = [jsonObject valueForKey:@\"language\"];\n \n for (LBSEventContent *eventContent in event.content) {\n if (eventContent.type == TEXT) {\n if ([eventContent.key caseInsensitiveCompare:language]) {\n notification.notificationDescription = eventContent.value;\n break;\n }\n }\n }\n return notification;\n}\n\n@end", "language": "objectivec", "name": "ExtendedNotificationModifier.m" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to modify notification content: [block:code] { "codes": [ { "code": "Interactor.setNotificationModifierIOS('ExtendedNotificationModifier', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'ExtendedNotificationModifier' - Class name of a file which is used for modifying notification content. * userData - String value used as criteria. **Android** 1. Create a Java class that implements the com.lbs.interactor.NotificationModifer interface (the file should be located within the platforms/android/src folder of your Cordova App) 2. Implement the modify method. Inside this method you can decide based on criteria weather to display local notification or not. [block:code] { "codes": [ { "code": "package io.cordova.cordovaAppName;\n\n\nimport android.util.Log;\n\nimport com.lbs.interactor.NotificationModifier;\nimport com.lbs.interactor.events.Event;\nimport com.lbs.interactor.events.EventContent;\n\nimport org.json.JSONArray;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\n/**\n * Implements the NotificationModifier.\n *\n * The userData is parsed as JSON and the result is cached in a field.\n */\npublic class ExtendedNotificationModifier implements NotificationModifier {\n \n private static final String TAG = ExtendedNotificationModifier.class.getSimpleName();\n\n private String language = null;\n\n /**\n * There has to be a default constructor\n */\n public ExtendedNotificationModifier() {\n }\n\n @Override\n public void modify(Notification notification, Event event, String userData) {\n if (language == null) {\n try {\n JSONObject json = new JSONObject(userData);\n language = json.getString(\"language\");\n Log.i(TAG, \"Use language: \" + language);\n } catch (JSONException e) {\n Log.e(TAG, \"Error parsing userData\", e);\n return;\n }\n }\n\n // Fill the description with the Text of the selected language\n for (EventContent eventContent : event.getEventContents()) {\n if (eventContent.getType() == EventContent.EventDataType.TEXT) {\n if (eventContent.getKey().equalsIgnoreCase(language)) {\n notification.setDescription(eventContent.getValue());\n }\n }\n }\n }\n}\n", "language": "java", "name": "platforms/android/src/io/cordova/cordovaAppname/ExtendedNotificationModifier.java" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to modify notification content: [block:code] { "codes": [ { "code": "Interactor.setNotificationModifierAndroid('io.cordova.cordovaAppName.ExtendedNotificationModifier', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'io.cordova.cordovaAppName.ExtendedNotificationModifier' - Full package path of a file which is used for modifying notification content. * userData - String value used as criteria. [block:api-header] { "type": "basic", "title": "Event type - custom" } [/block] With version 1.10.0, we've enabled support for the event type Custom. The content of the event can be any valid JSON which can be used to do event filtering and provide versatile event content. Below is an example of a multi language event that contains different texts and images for each language. The example has a condition property which would be used in an notification filter and would in this case only be displayed to women between 30 and 40 years of age. *Note: You still have to implement the notification filter yourself.* [block:code] { "codes": [ { "code": "{\n\t\"conditions\":\n\t{\n\t\t\"gender\": \"female\",\n\t\t\"age\": \n { \n \"lower\": \"30\", \n \"upper\" \"40\" \n }\n\t},\n\t\"english\":\n\t{\n\t\t\"title\": \"English title\",\n\t\t\"description\": \"English description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgURCAINxAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAABQElEQVRoge3av0sCYQDG8edCI2wQWyJp7MegODjcGDR4rTk0ZkOIQ7SU/iM1Cok5R7jaFNTi0FA4SENrOrTVWoN5CVIivN71vDyf6T3u4N4vd7wHd+cULjc+YbG5sCcwa5HhoL7fDXMeRh00Nv2x9VdQgewUyE6B7BTIToHsFMhOgewUyM76wMjkQya7uDvG7Uvr1/3ryy7KXgMLJk42JSOBQLgRf9EtalYflas95DJF3DxW0f94BQAcbXfhrs7mjAEHDlw/nOHUa2MtAbQ656jdu1j63jbNWOBzr43SyPvIUfnsCXZTJX97J33ox3jJLTSf6nh7B/CfA6dZZJLxn1gkVhCLLpqaxhjrFxkFsrM+MJBVNDYf9x8LQXOGH0D1+YyUAtkpkJ0C2SmQnQLZKZCdAtkpkJ0C2Vkf6Oive3JfMao7NwI+z0IAAAAASUVORK5CYII=\"\n\t},\n\t\"italian\":\n\t{\n\t\t\"title\": \"Italian title\",\n\t\t\"description\": \"Italian description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgU4SrCVqAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAAA/UlEQVRoge3arQ9BURzG8eeaYLKhKkwRdUXwFyjIJmuiTdMEEYWkmSmqCbrNpmBmNlNMI3mZTcE59tw9n3Ru+p3v7tluONfJt6MXuJjn3xswzXtbtHLzf+7jpwqd2H3t+jeoQHYKZKdAdgpkp0B2CmSnQHYKZKfAj62HKPaSWBwez9OVsWlvWXqDO5QnNTujXuiIfmu5b6HUzWB32qIxjqE6yuFseugT44GRQAGN7ABBfxil1ByVdAc+00Of6IiyUyA7Bf7S5ti0OQ6AtcAg4qEE+rO69e+gc7sA1fUZKQWyUyA7BbJTIDsFslMgOwWyUyA7BbJzfaCjv+7JXQGUri8apZNkvAAAAABJRU5ErkJggg==\"\t\n\t},\n\t\"german\":\n\t{\n\t\t\"title\": \"German title\",\n\t\t\"description\": \"German description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgUkXrHJ5wAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAACAUlEQVRoge2aQUhUQRiAv41FbF1oFywzLQzSDRUEib1IQUibBw8dgk7lwYPIticFL3oqiM7iwYtS7yQIduhQdgjTLnsQBFdaC/KwShb0DFxdRKiD66stTYqZlX/5P3gwzHuPfz7mn/kfzPPde9rwnRLmxHEPwDb+/caTu+njHIdRupyI1y75GVRB6aigdFRQOiooHRWUjgpKRwWlo4LSKXlB/9GPHM3YXIKZj9MH3otfTxOtNRHl/zAiCFBfFaU/5lD+a6e7QPzlFZLn27nf9thUqH/CboqGWxi5+pBU5jUfXKuRDsX+Gqy5Rl2ojhdLAwXd06lhupyIdz1LjVoJbyxFDyfA6Yoq1rJr5IBy9uSmFh2GOtNcCpNP5W4AbjX1GI1elF20NtyAu/mJHACfefVukpvN3Xty4KXybHqSDcOxi18mVufZ3N2m+dxvMxWoJrfjspwxG64IKQoZd5lw8Ky3w27tfOPB88hf3zFFEQS3+JJdJxS86AkGyk7RF0v+TFGL2E/R1TesbKzQ0ZivgzWtBP0n+Zq1HhmwLeguEJ8dLNxQOMONy7cZfxstqI1jcwl6J6LG66WxFH2/nqTH+XNdHfSpFmtKABSsw8qKCzy6kyRkakB5fPsHoHp8JhQVlI4KSkcFpaOC0lFB6aigdFRQOiooHRWUTskL+vSve+H8AOlye9qCZBkbAAAAAElFTkSuQmCC\"\t\n\t},\n\t\"french\":\n\t{\n\t\t\"title\": \"French title\",\n\t\t\"description\": \"French description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgYGoPzbwAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAABIUlEQVRoge3aoWsCUQDH8Z/DIBhmGBM2Z9MVs2UWy/4AzU4YgkFsVvEPMJoswuafoEmTYLJqOQzm2SwGiyZFRZnCexy/x++TDu64d1/euxeOC3z9Jrdw2IPfD2BbcH/wU/D8fA6jit33w7HzM6hAdgpkp0B2CmSnQHYKZKdAdgpk53xg8P9L7tMZVzFaDK6er2Q9pGOmR73OeCAAJKJp1D67CNm4+Z20RO1YotErIfX2gf60g6dwHPXcEBELI/kUCKw3K3jLGdoFz+pS9nWJpl4z1t9TKzM4/5ugfPTxde98B315LNsY/oR2UXYKZOd8oPFN5jvTuuGqZzTzI9NDX+T8DCqQnQLZKZCdAtkpkJ0C2SmQnQLZKZCd84EB/XVPbge6RyldFOD+9AAAAABJRU5ErkJggg==\"\t\n\t}\n}", "language": "json" } ] } [/block]
[block:api-header] { "type": "basic", "title": "How to get event information?" } [/block] To receive notifications for events created in the platform you need to register an event listener. [block:code] { "codes": [ { "code": "Interactor.registerEventListener(app.eventListenerCallback, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] Event data will be received as parameter of eventListenerCallback function. Here are few example events received as JSON objects: [block:code] { "codes": [ { "code": " {\n \"type\":\"ZONE_ENTRY\",\n \"name\":\"Test text event\",\n \"description\":\"Description\",\n \"content\":\n [\n {\n \"key\":\"IT\",\n \"value\":\"Ciao!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"EN\",\n \"value\":\"Hello!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"FR\",\n \"value\":\"Bonjour!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"DE\",\n \"value\":\"Hallo!\",\n \"type\":\"TEXT\"\n }\n ],\n \"zone\": {\n \"id\":123,\n \"size\":\"MEDIUM\"\n }\n }", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Typo in event data for field \"decryption\" fixed on iOS", "body": "In 1.9.0 version, typo for a field description is fixed." } [/block] [block:code] { "codes": [ { "code": " {\n \"type\":\"ZONE_EXIT\",\n \"name\":\"Image Event\",\n \"decription\":\"\",\n \"content\":\n [\n {\n \t\t\t \"key\":\"NOKEY\",\n \"value\":\"/my/image/path/ImageName.jpg\",\n \"type\":\"IMAGE\"\n }\n ],\n \"zone\": {\n \"id\":1234,\n \"size\":\"SMALL\"\n }\n }", "language": "json" } ] } [/block] Available event types are: ZONE_ENTRY, ZONE_EXIT and UNKNOWN. Available content types are: TEXT, IMAGE, URL and UNKNOWN. Available zone sizes are: LARGE, MEDIUM, SMALL, UNKNOWN. After successful registration for events, you can at any point remove event listener. [block:code] { "codes": [ { "code": "Interactor.removeEventListener(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "How to display local notifications when new event is received?" } [/block] Interactor plugin fully support local notifications. Notifications are also configurable, meaning you can change weather you want to receive them and in which app state, do you want additional functionalities, etc. To configure local notifications you need to call following method: [block:code] { "codes": [ { "code": "var configNotification = {\n receiveDuring: Interactor.NotificationStates.BACKGROUND, //optional\n vibrate: Interactor.NotificationStates.BACKGROUND, //optional\n sound: Interactor.NotificationStates.BACKGROUND, //optional\n stackText: false, //optional, Android only\n iconName: 'icon', //optional, Android only\n iconColor: '#6666FF', //optional, Android only\n \tenableBadge: false, //optional, iOS only\n clearBadge: true, //optional, iOS only\n stackTextTitle: 'Stacked Title' //optional, Android only\n};\n\nInteractor.configureNotification(notificationCinfig, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] ConfigNotification object contain all available configuration parameters with their default values. Values can be changed during the runtime, by calling **configureNotification** function as show in the example above. **receiveDuring** - App state during which the Plugin should trigger a notification when an Event is received. **Default** state is background only. **vibrate** - App state during which a received Notification will trigger the default notification vibration (respects phone’s vibrate settings like disabled, etc.). **Default** state is background only. **sound** - App state during which a received Notification will play the default notification ringtone (respects phone’s audio settings like silent, etc.). **Default** state is background only. For ***receiveDuring, sound and vibrate*** you can set the values base on this enum: [block:code] { "codes": [ { "code": "Interactor.NotificationStates = {\n BACKGROUND: 0,\n FOREGROUND: 1,\n BOTH: 2,\n NONE: 3\n}", "language": "json" } ] } [/block] **stackText** - (Android) Whether the notifications should be shown as separate notifications or stacked together when a new one is received. **Default** value is **false**. See also stackTextTitle if you want to add a title to the stacked notifications. **iconName** - (Android) The name of a drawable resource to use as the small-icon. The name should not include the extension. **Default** icon name is Cordova app icon. If you change the icon make sure to put in **Drawable Resource folder for Android**. **iconColor** - (Android 5.0+) Color of the circle on which the icon is displayed. **Default** color is platform color. **enableBadge** - (iOS) Show a Badge on the App icon to indicate that a notification has been received. **clearBadge** - (iOS) If true: Remove Badge when app is opened. **stackTextTitle** - (Android) Presented title for stacked notifications. By default there is no title. We provided some recommended format for title and it looks like this: [block:code] { "codes": [ { "code": " stackTextTitle: 'You have # events'\n", "language": "json" } ] } [/block] Special character # will be replaced with a number of stacked notification so title text will look like this if you have 5 stacked messages: You have 5 messages. If you wish to receive information about clicked notification inside your app, you will need to register notification listener. Data received inside eventListenerCallback contains event information mentioned above. [block:code] { "codes": [ { "code": "Interactor.registerNotificationListener(app.eventListenerCallback, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] To remove the previously registered notification listener, the following call can be used. [block:code] { "codes": [ { "code": "Interactor.removeNotificationListener(app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] The **NotificationListener** returns a JSON object containing event array. Here is an example of the **notificationListener** callback: [block:code] { "codes": [ { "code": "{\"notifications\" : [{\n \"id\":\"EVENT_ID\"\n \"type\":\"ZONE_ENTRY\",\n \"name\":\"Test text event\",\n \"description\":\"\",\n \"content\":\n [\n {\n \"key\":\"IT\",\n \"value\":\"Ciao!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"EN\",\n \"value\":\"Hello!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"FR\",\n \"value\":\"Bonjour!\",\n \"type\":\"TEXT\"\n },{\n \"key\":\"DE\",\n \"value\":\"Hallo!\",\n \"type\":\"TEXT\"\n }\n ]\n }]}", "language": "json" } ] } [/block] [block:callout] { "type": "danger", "title": "**NotificationListener** callback", "body": "Starting with version 1.9.0 the notification listener callback returns a list of events instead of only one event object." } [/block] [block:callout] { "type": "info", "body": "Note that if you want to use notifications in the background you have to register the **NotificationListener** each time javascript code is started (it is recommended to call it within your onDeviceReady function).\n\n*** For android *** : The eventListenerCallback is called when app is in background after pressing 'home button', whereas the **Notificationlistener** is always called when the user taps on the notification.\n\nPlease note the difference as cordova JavaScript is killed when you press back button or in other words it is killed when activity is killed. So in this case the **NotificationListener** is fired when a notification arrives and is pressed.\n\nWhen home button is pressed the activity is not destroyed and the cordova JavaScript is still alive so eventListenerCallback is still alive and when you press on the notification the app is foregrounded, in this case you receive the eventListenerCallback and the notificationListenerCallback.", "title": "NotificationListener and EventListener in background" } [/block] [block:api-header] { "type": "basic", "title": "Local Notification filtering" } [/block] If you want to filter which event that you want to display as a local notification, and which ones you would like to ignore, you will need to do the following: 1. Create criteria on which event filtering is based (User data). 2. Create a class which decides based on criteria if notification should be shown or not. 3. Provide plugin with criteria and class information. **Criteria** is data that can be set from JavaScript and it is a string object.This is an example of criteria: [block:code] { "codes": [ { "code": "var userData = '{\"blacklist\" : [\"eventName1\",\"eventName2\"]}';", "language": "javascript" } ] } [/block] The most important part of filtering notifications is "platform specific" code which needs to be implemented in order to parse provided criteria information. Since this part is different depending on the platform we will show you how to do it on both Android and iOS. **iOS** 1. Create new CocoaClass file that is a subclass of NSObject. 2. Inside .h file conform to NotificationFilter protocol, found in "NotificationFilter.h" class. 3. Inside .m file override the implementation of filterEvent:withData: method from NotificationFilter protocol. Inside this method you can decide based on criteria weather to display local notification or not. [block:code] { "codes": [ { "code": "// ExtendedNotificationFilter.h\n#import <Foundation/Foundation.h>\n#import \"NotificationFilter.h\"\n\n@interface ExtendedNotificationFilter : NSObject <NotificationFilter>\n@end", "language": "text", "name": "ExtendedNotificationFilter.h" } ] } [/block] [block:code] { "codes": [ { "code": "// ExtendedNotificationFilter.m\n#import \"ExtendedNotificationFilter.h\"\n\n@implementation ExtendedNotificationFilter\n\n- (BOOL)filterEvent:(LBSEvent *)event withData:(NSString *)userData\n{\n //This is an example code for the provided userData.\n NSError *err = nil;\n NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[userData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];\n \n NSArray *blacklist = [jsonObject valueForKey:@\"blacklist\"];\n if ([blacklist containsObject:event.name]) {\n return NO;\n }\n return YES;\n}\n\n@end", "language": "objectivec", "name": "ExtendedNotificationFilter.m" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to filter events: [block:code] { "codes": [ { "code": "Interactor.setNotificationFilterIOS('ExtendedNotificationFilter', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'ExtendedNotificationFilter' - Class name of a file which is used for custom notification filtering. * userData - String value used as criteria. **Android** 1. Create a Java class that implements the com.lbs.interactor.NotificationFilter interface (the file should be located within the platforms/android/src folder of your Cordova App) 2. Implement the filter method. Inside this method you can decide based on criteria weather to display local notification or not. [block:code] { "codes": [ { "code": "package io.cordova.cordovaAppName;\n\n\nimport android.util.Log;\n\nimport com.lbs.interactor.NotificationFilter;\nimport com.lbs.interactor.events.Event;\nimport com.lbs.interactor.events.EventContent;\n\nimport org.json.JSONArray;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Implements the NotificationFilter.\n *\n * The userData is parsed as JSON and the result is cached in a field.\n */\npublic class ExtendedNotificationFilter implements NotificationFilter {\n \n private static final String TAG = ExtendedNotificationFilter.class.getSimpleName();\n\n private List<String> blacklist = null;\n\n /**\n * There has to be a default constructor\n */\n public ExtendedNotificationFilter() {\n }\n\n @Override\n public boolean filter(Event event, String userData) {\n if (blacklist == null) {\n try {\n JSONObject json = new JSONObject(userData);\n JSONArray blacklistJSON = json.getJSONArray(\"blacklist\");\n blacklist = new ArrayList<String>();\n for (int i = 0; i < blacklistJSON.length(); i++) {\n blacklist.add(blacklistJSON.getString(0));\n }\n Log.i(TAG, \"Blacklist: \" + blacklist);\n } catch (JSONException e) {\n Log.e(TAG, \"Error parsing userData\", e);\n return false;\n }\n }\n\n if (blacklist.contains(event.getName())) {\n Log.i(TAG, \"Filtered event \" + event.getName() + \" because it is on the blacklist\");\n return false;\n }\n\n return true;\n }\n}\n", "language": "java", "name": "platforms/android/src/io/cordova/cordovaAppname/ExtendedNotificationFilter.java" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to filter events: [block:code] { "codes": [ { "code": "Interactor.setNotificationFilterAndroid('io.cordova.cordovaAppName.ExtendedNotificationFilter', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'io.cordova.cordovaAppName.ExtendedNotificationFilter' - Full package path of a file which is used for custom notification filtering. * userData - String value used as criteria. [block:api-header] { "type": "basic", "title": "Modify Local Notification content" } [/block] If you want your local notification to display different content than the event name and event description, you can use Local Notification modification feature. To enable modifications you will need to do the following: 1. Create criteria on which notification content modification is based (User data). 2. Create a class which decides based on criteria which content should be presented. 3. Provide plugin with criteria and class information. **Criteria** is data that can be set from JavaScript and it is a string object.This is an example of criteria: [block:code] { "codes": [ { "code": "var userData = '{\"language\" : \"en\"}';", "language": "javascript" } ] } [/block] The most important part of notification modifying is "platform specific" code which needs to be implemented in order to parse provided criteria information. Since this part is different depending on the platform we will show you how to do it on both Android and iOS. **iOS** 1. Create new CocoaClass file that is a subclass of NSObject. 2. Inside .h file conform to NotificationModifier protocol, found in "NotificationModifier.h" class. 3. Inside .m file override the implementation of modifyNotification:withData:forEvent: method from NotificationModifier protocol. Inside this method you can decide based on criteria weather to modify local notification content or not. [block:code] { "codes": [ { "code": "// ExtendedNotificationModifier.h\n#import <Foundation/Foundation.h>\n#import \"NotificationModifier.h\"\n\n@interface ExtendedNotificationModifier : NSObject <NotificationModifier>\n@end", "language": "objectivec", "name": "ExtendedNotificationModifier.h" } ] } [/block] [block:code] { "codes": [ { "code": "// ExtendedNotificationModifier.m\n#import \"ExtendedNotificationModifier.h\"\n\n@implementation ExtendedNotificationModifier\n\n- (Notification *)modifyNotification:(Notification *)notification withData:(NSString *)userData forEvent:(LBSEvent *)event\n{\n //This is an example code for the provided userData.\n NSError *err = nil;\n NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[userData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];\n \n NSString *language = [jsonObject valueForKey:@\"language\"];\n \n for (LBSEventContent *eventContent in event.content) {\n if (eventContent.type == TEXT) {\n if ([eventContent.key caseInsensitiveCompare:language]) {\n notification.notificationDescription = eventContent.value;\n break;\n }\n }\n }\n return notification;\n}\n\n@end", "language": "objectivec", "name": "ExtendedNotificationModifier.m" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to modify notification content: [block:code] { "codes": [ { "code": "Interactor.setNotificationModifierIOS('ExtendedNotificationModifier', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'ExtendedNotificationModifier' - Class name of a file which is used for modifying notification content. * userData - String value used as criteria. **Android** 1. Create a Java class that implements the com.lbs.interactor.NotificationModifer interface (the file should be located within the platforms/android/src folder of your Cordova App) 2. Implement the modify method. Inside this method you can decide based on criteria weather to display local notification or not. [block:code] { "codes": [ { "code": "package io.cordova.cordovaAppName;\n\n\nimport android.util.Log;\n\nimport com.lbs.interactor.NotificationModifier;\nimport com.lbs.interactor.events.Event;\nimport com.lbs.interactor.events.EventContent;\n\nimport org.json.JSONArray;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\n/**\n * Implements the NotificationModifier.\n *\n * The userData is parsed as JSON and the result is cached in a field.\n */\npublic class ExtendedNotificationModifier implements NotificationModifier {\n \n private static final String TAG = ExtendedNotificationModifier.class.getSimpleName();\n\n private String language = null;\n\n /**\n * There has to be a default constructor\n */\n public ExtendedNotificationModifier() {\n }\n\n @Override\n public void modify(Notification notification, Event event, String userData) {\n if (language == null) {\n try {\n JSONObject json = new JSONObject(userData);\n language = json.getString(\"language\");\n Log.i(TAG, \"Use language: \" + language);\n } catch (JSONException e) {\n Log.e(TAG, \"Error parsing userData\", e);\n return;\n }\n }\n\n // Fill the description with the Text of the selected language\n for (EventContent eventContent : event.getEventContents()) {\n if (eventContent.getType() == EventContent.EventDataType.TEXT) {\n if (eventContent.getKey().equalsIgnoreCase(language)) {\n notification.setDescription(eventContent.getValue());\n }\n }\n }\n }\n}\n", "language": "java", "name": "platforms/android/src/io/cordova/cordovaAppname/ExtendedNotificationModifier.java" } ] } [/block] After defining criteria and creating platform specific code, you can call this method to tell the plugin that you want to modify notification content: [block:code] { "codes": [ { "code": "Interactor.setNotificationModifierAndroid('io.cordova.cordovaAppName.ExtendedNotificationModifier', userData, app.successCallback, app.errorCallback);", "language": "javascript" } ] } [/block] * 'io.cordova.cordovaAppName.ExtendedNotificationModifier' - Full package path of a file which is used for modifying notification content. * userData - String value used as criteria. [block:api-header] { "type": "basic", "title": "Event type - custom" } [/block] With version 1.10.0, we've enabled support for the event type Custom. The content of the event can be any valid JSON which can be used to do event filtering and provide versatile event content. Below is an example of a multi language event that contains different texts and images for each language. The example has a condition property which would be used in an notification filter and would in this case only be displayed to women between 30 and 40 years of age. *Note: You still have to implement the notification filter yourself.* [block:code] { "codes": [ { "code": "{\n\t\"conditions\":\n\t{\n\t\t\"gender\": \"female\",\n\t\t\"age\": \n { \n \"lower\": \"30\", \n \"upper\" \"40\" \n }\n\t},\n\t\"english\":\n\t{\n\t\t\"title\": \"English title\",\n\t\t\"description\": \"English description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgURCAINxAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAABQElEQVRoge3av0sCYQDG8edCI2wQWyJp7MegODjcGDR4rTk0ZkOIQ7SU/iM1Cok5R7jaFNTi0FA4SENrOrTVWoN5CVIivN71vDyf6T3u4N4vd7wHd+cULjc+YbG5sCcwa5HhoL7fDXMeRh00Nv2x9VdQgewUyE6B7BTIToHsFMhOgewUyM76wMjkQya7uDvG7Uvr1/3ryy7KXgMLJk42JSOBQLgRf9EtalYflas95DJF3DxW0f94BQAcbXfhrs7mjAEHDlw/nOHUa2MtAbQ656jdu1j63jbNWOBzr43SyPvIUfnsCXZTJX97J33ox3jJLTSf6nh7B/CfA6dZZJLxn1gkVhCLLpqaxhjrFxkFsrM+MJBVNDYf9x8LQXOGH0D1+YyUAtkpkJ0C2SmQnQLZKZCdAtkpkJ0C2Vkf6Oive3JfMao7NwI+z0IAAAAASUVORK5CYII=\"\n\t},\n\t\"italian\":\n\t{\n\t\t\"title\": \"Italian title\",\n\t\t\"description\": \"Italian description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgU4SrCVqAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAAA/UlEQVRoge3arQ9BURzG8eeaYLKhKkwRdUXwFyjIJmuiTdMEEYWkmSmqCbrNpmBmNlNMI3mZTcE59tw9n3Ru+p3v7tluONfJt6MXuJjn3xswzXtbtHLzf+7jpwqd2H3t+jeoQHYKZKdAdgpkp0B2CmSnQHYKZKfAj62HKPaSWBwez9OVsWlvWXqDO5QnNTujXuiIfmu5b6HUzWB32qIxjqE6yuFseugT44GRQAGN7ABBfxil1ByVdAc+00Of6IiyUyA7Bf7S5ti0OQ6AtcAg4qEE+rO69e+gc7sA1fUZKQWyUyA7BbJTIDsFslMgOwWyUyA7BbJzfaCjv+7JXQGUri8apZNkvAAAAABJRU5ErkJggg==\"\t\n\t},\n\t\"german\":\n\t{\n\t\t\"title\": \"German title\",\n\t\t\"description\": \"German description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgUkXrHJ5wAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAACAUlEQVRoge2aQUhUQRiAv41FbF1oFywzLQzSDRUEib1IQUibBw8dgk7lwYPIticFL3oqiM7iwYtS7yQIduhQdgjTLnsQBFdaC/KwShb0DFxdRKiD66stTYqZlX/5P3gwzHuPfz7mn/kfzPPde9rwnRLmxHEPwDb+/caTu+njHIdRupyI1y75GVRB6aigdFRQOiooHRWUjgpKRwWlo4LSKXlB/9GPHM3YXIKZj9MH3otfTxOtNRHl/zAiCFBfFaU/5lD+a6e7QPzlFZLn27nf9thUqH/CboqGWxi5+pBU5jUfXKuRDsX+Gqy5Rl2ojhdLAwXd06lhupyIdz1LjVoJbyxFDyfA6Yoq1rJr5IBy9uSmFh2GOtNcCpNP5W4AbjX1GI1elF20NtyAu/mJHACfefVukpvN3Xty4KXybHqSDcOxi18mVufZ3N2m+dxvMxWoJrfjspwxG64IKQoZd5lw8Ky3w27tfOPB88hf3zFFEQS3+JJdJxS86AkGyk7RF0v+TFGL2E/R1TesbKzQ0ZivgzWtBP0n+Zq1HhmwLeguEJ8dLNxQOMONy7cZfxstqI1jcwl6J6LG66WxFH2/nqTH+XNdHfSpFmtKABSsw8qKCzy6kyRkakB5fPsHoHp8JhQVlI4KSkcFpaOC0lFB6aigdFRQOiooHRWUTskL+vSve+H8AOlye9qCZBkbAAAAAElFTkSuQmCC\"\t\n\t},\n\t\"french\":\n\t{\n\t\t\"title\": \"French title\",\n\t\t\"description\": \"French description\",\n\t\t\"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4AMECgYGoPzbwAAAAAd0RVh0QXV0aG9yAKmuzEgAAAAMdEVYdERlc2NyaXB0aW9uABMJISMAAAAKdEVYdENvcHlyaWdodACsD8w6AAAADnRFWHRDcmVhdGlvbiB0aW1lADX3DwkAAAAJdEVYdFNvZnR3YXJlAF1w/zoAAAALdEVYdERpc2NsYWltZXIAt8C0jwAAAAh0RVh0V2FybmluZwDAG+aHAAAAB3RFWHRTb3VyY2UA9f+D6wAAAAh0RVh0Q29tbWVudAD2zJa/AAAABnRFWHRUaXRsZQCo7tInAAABIUlEQVRoge3aoWsCUQDH8Z/DIBhmGBM2Z9MVs2UWy/4AzU4YgkFsVvEPMJoswuafoEmTYLJqOQzm2SwGiyZFRZnCexy/x++TDu64d1/euxeOC3z9Jrdw2IPfD2BbcH/wU/D8fA6jit33w7HzM6hAdgpkp0B2CmSnQHYKZKdAdgpk53xg8P9L7tMZVzFaDK6er2Q9pGOmR73OeCAAJKJp1D67CNm4+Z20RO1YotErIfX2gf60g6dwHPXcEBELI/kUCKw3K3jLGdoFz+pS9nWJpl4z1t9TKzM4/5ugfPTxde98B315LNsY/oR2UXYKZOd8oPFN5jvTuuGqZzTzI9NDX+T8DCqQnQLZKZCdAtkpkJ0C2SmQnQLZKZCd84EB/XVPbge6RyldFOD+9AAAAABJRU5ErkJggg==\"\t\n\t}\n}", "language": "json" } ] } [/block]
{"_id":"5770cba14607a30e001debe9","category":"5770cba14607a30e001debc7","excerpt":"","githubsync":"","title":"Beacon Events","user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","__v":0,"createdAt":"2016-02-29T14:35:33.734Z","hidden":false,"isReference":false,"link_external":false,"order":2,"parentDoc":null,"link_url":"","slug":"beacon-events","sync_unique":"","type":"basic","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"body":"In addition to the event listeners, plugin provides a simple method to listen for beacons.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var beacon = {\\n    uuid: \\\"BEACON_UUID\\\",   //mandatory\\n    major: 1234,           //mandatory\\n    minor: 12345           //mandatory\\n}\\n\\nInteractor.registerBeaconListener(beacon, app.listenerCallback, app.successCallback, app.errorCallback];\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nEvent data will be received as parameter of listenerCallback function. Here is the example event:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"beacon\\\":\\n  {\\n    \\\"uuid\\\":\\\"uuidString\\\",\\n    \\\"major\\\":12344,\\n    \\\"minor\\\":1234\\n  }, \\n  \\\"distance\\\":12, \\n  \\\"RSSI\\\":-34, \\n  \\\"range\\\":\\\"NEAR\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Changes for version 1.8.0\",\n  \"body\": \"Beware that from version 1.8.0 beacon listener callback content has changed.\"\n}\n[/block]\nThe values for range property are:\n- IMMEDIATE (when user is closer than 1m to the beacon)\n- NEAR           (when user is between 1 and 10 meters away from the beacon)\n- FAR              (when user is more than 10 meters away from the beacon)\n- UNKNOWN  (unknown range from the beacon)\n\nAfter successful registration for beacon events, you can at any point remove beacon listener.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var beacon = {\\n    uuid: \\\"BEACON_UUID\\\",   //mandatory\\n    major: 1234,           //mandatory\\n    minor: 12345           //mandatory\\n}\\n\\nInteractor.removeBeaconListener(beacon, app.successCallback, app.errorCallback];\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nInformation about list of beacons in the area can be found by calling next method\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Interactor.getAllBeacons(app.successCallback, app.errorCallback];\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nBeacon list will be received as parameter of successCallback function.\nthis method returns a JsonArray of beacons.  \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"uuid\\\":\\\"uuidString1\\\",\\n    \\\"major\\\":1234,\\n    \\\"minor\\\":1234\\n  }, \\n  {\\n    \\\"uuid\\\":\\\"uuidString2\\\",\\n    \\\"major\\\":12345,\\n    \\\"minor\\\":12345\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Calling \\\"getAllBeacons\\\"\",\n  \"body\": \"This method will return correct beacon list only if interactor is running. If Interactor is not stardet first, this method will return an empty array.\"\n}\n[/block]","project":"56d4304373dcd20b00fb854e","updates":[],"childrenPages":[]}

Beacon Events


In addition to the event listeners, plugin provides a simple method to listen for beacons. [block:code] { "codes": [ { "code": "var beacon = {\n uuid: \"BEACON_UUID\", //mandatory\n major: 1234, //mandatory\n minor: 12345 //mandatory\n}\n\nInteractor.registerBeaconListener(beacon, app.listenerCallback, app.successCallback, app.errorCallback];", "language": "javascript" } ] } [/block] Event data will be received as parameter of listenerCallback function. Here is the example event: [block:code] { "codes": [ { "code": "{\n \"beacon\":\n {\n \"uuid\":\"uuidString\",\n \"major\":12344,\n \"minor\":1234\n }, \n \"distance\":12, \n \"RSSI\":-34, \n \"range\":\"NEAR\"\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Changes for version 1.8.0", "body": "Beware that from version 1.8.0 beacon listener callback content has changed." } [/block] The values for range property are: - IMMEDIATE (when user is closer than 1m to the beacon) - NEAR (when user is between 1 and 10 meters away from the beacon) - FAR (when user is more than 10 meters away from the beacon) - UNKNOWN (unknown range from the beacon) After successful registration for beacon events, you can at any point remove beacon listener. [block:code] { "codes": [ { "code": "var beacon = {\n uuid: \"BEACON_UUID\", //mandatory\n major: 1234, //mandatory\n minor: 12345 //mandatory\n}\n\nInteractor.removeBeaconListener(beacon, app.successCallback, app.errorCallback];", "language": "javascript" } ] } [/block] Information about list of beacons in the area can be found by calling next method [block:code] { "codes": [ { "code": "Interactor.getAllBeacons(app.successCallback, app.errorCallback];", "language": "javascript" } ] } [/block] Beacon list will be received as parameter of successCallback function. this method returns a JsonArray of beacons. [block:code] { "codes": [ { "code": "[\n {\n \"uuid\":\"uuidString1\",\n \"major\":1234,\n \"minor\":1234\n }, \n {\n \"uuid\":\"uuidString2\",\n \"major\":12345,\n \"minor\":12345\n }\n]", "language": "json" } ] } [/block] [block:callout] { "type": "danger", "title": "Calling \"getAllBeacons\"", "body": "This method will return correct beacon list only if interactor is running. If Interactor is not stardet first, this method will return an empty array." } [/block]
In addition to the event listeners, plugin provides a simple method to listen for beacons. [block:code] { "codes": [ { "code": "var beacon = {\n uuid: \"BEACON_UUID\", //mandatory\n major: 1234, //mandatory\n minor: 12345 //mandatory\n}\n\nInteractor.registerBeaconListener(beacon, app.listenerCallback, app.successCallback, app.errorCallback];", "language": "javascript" } ] } [/block] Event data will be received as parameter of listenerCallback function. Here is the example event: [block:code] { "codes": [ { "code": "{\n \"beacon\":\n {\n \"uuid\":\"uuidString\",\n \"major\":12344,\n \"minor\":1234\n }, \n \"distance\":12, \n \"RSSI\":-34, \n \"range\":\"NEAR\"\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Changes for version 1.8.0", "body": "Beware that from version 1.8.0 beacon listener callback content has changed." } [/block] The values for range property are: - IMMEDIATE (when user is closer than 1m to the beacon) - NEAR (when user is between 1 and 10 meters away from the beacon) - FAR (when user is more than 10 meters away from the beacon) - UNKNOWN (unknown range from the beacon) After successful registration for beacon events, you can at any point remove beacon listener. [block:code] { "codes": [ { "code": "var beacon = {\n uuid: \"BEACON_UUID\", //mandatory\n major: 1234, //mandatory\n minor: 12345 //mandatory\n}\n\nInteractor.removeBeaconListener(beacon, app.successCallback, app.errorCallback];", "language": "javascript" } ] } [/block] Information about list of beacons in the area can be found by calling next method [block:code] { "codes": [ { "code": "Interactor.getAllBeacons(app.successCallback, app.errorCallback];", "language": "javascript" } ] } [/block] Beacon list will be received as parameter of successCallback function. this method returns a JsonArray of beacons. [block:code] { "codes": [ { "code": "[\n {\n \"uuid\":\"uuidString1\",\n \"major\":1234,\n \"minor\":1234\n }, \n {\n \"uuid\":\"uuidString2\",\n \"major\":12345,\n \"minor\":12345\n }\n]", "language": "json" } ] } [/block] [block:callout] { "type": "danger", "title": "Calling \"getAllBeacons\"", "body": "This method will return correct beacon list only if interactor is running. If Interactor is not stardet first, this method will return an empty array." } [/block]
{"_id":"5770cba14607a30e001debea","link_url":"","body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Platform specific methods\",\n  \"body\": \"synchroniseData method is implemented only in **IOS** \\n\\nsynchronizeData in android happens automatically when app is brought to foreground !\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Major Cordova app freeze issue on iOS platforms prior to 4.1.0\",\n  \"body\": \"https://issues.apache.org/jira/browse/CB-10530\\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\\ncordova platform rm ios\\ncordova platform add ios@4.1.0\"\n}\n[/block]","category":"5770cba14607a30e001debc7","isReference":false,"version":"5770cba14607a30e001debc2","slug":"platform-guides","sync_unique":"","updates":[],"link_external":false,"order":3,"parentDoc":null,"project":"56d4304373dcd20b00fb854e","type":"basic","__v":0,"api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required"},"githubsync":"","user":"54e5a4a0d3ab670d00f3af54","hidden":false,"title":"Platform Guides","createdAt":"2016-02-29T14:35:44.633Z","excerpt":"","childrenPages":[]}

Platform Guides


[block:callout] { "type": "danger", "title": "Platform specific methods", "body": "synchroniseData method is implemented only in **IOS** \n\nsynchronizeData in android happens automatically when app is brought to foreground !" } [/block] [block:callout] { "type": "warning", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0" } [/block]
[block:callout] { "type": "danger", "title": "Platform specific methods", "body": "synchroniseData method is implemented only in **IOS** \n\nsynchronizeData in android happens automatically when app is brought to foreground !" } [/block] [block:callout] { "type": "warning", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0" } [/block]
{"_id":"5770cba14607a30e001debd1","link_external":false,"parentDoc":null,"project":"56d4304373dcd20b00fb854e","type":"basic","body":"[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Version\",\n    \"h-1\": \"Download link\",\n    \"h-2\": \"Download link\",\n    \"0-0\": \"1.14.0\",\n    \"0-1\": \"[iOS SDK](http://interactor-dev.s3.amazonaws.com/interactor-ios-1.14.0.111.zip)\",\n    \"0-2\": \"[iOS SDK](https://interactor-dev.s3.amazonaws.com/interactor-ios.zip)\",\n    \"1-0\": \"Proximity Sample App\",\n    \"1-1\": \"[iOS App](https://itunes.apple.com/us/app/indoo.rs-proximity/id1110278945?mt=8)\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]","excerpt":"","isReference":false,"updates":[],"version":"5770cba14607a30e001debc2","__v":3,"hidden":false,"title":"Downloads - iOS","slug":"downloads-ios","user":"54e5a4a0d3ab670d00f3af54","api":{"params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"","auth":"required"},"category":"5770cba14607a30e001debc8","githubsync":"","order":0,"createdAt":"2016-02-29T14:36:32.709Z","link_url":"","sync_unique":"","childrenPages":[]}

Downloads - iOS


[block:parameters] { "data": { "h-0": "Version", "h-1": "Download link", "h-2": "Download link", "0-0": "1.14.0", "0-1": "[iOS SDK](http://interactor-dev.s3.amazonaws.com/interactor-ios-1.14.0.111.zip)", "0-2": "[iOS SDK](https://interactor-dev.s3.amazonaws.com/interactor-ios.zip)", "1-0": "Proximity Sample App", "1-1": "[iOS App](https://itunes.apple.com/us/app/indoo.rs-proximity/id1110278945?mt=8)" }, "cols": 2, "rows": 2 } [/block]
[block:parameters] { "data": { "h-0": "Version", "h-1": "Download link", "h-2": "Download link", "0-0": "1.14.0", "0-1": "[iOS SDK](http://interactor-dev.s3.amazonaws.com/interactor-ios-1.14.0.111.zip)", "0-2": "[iOS SDK](https://interactor-dev.s3.amazonaws.com/interactor-ios.zip)", "1-0": "Proximity Sample App", "1-1": "[iOS App](https://itunes.apple.com/us/app/indoo.rs-proximity/id1110278945?mt=8)" }, "cols": 2, "rows": 2 } [/block]
{"_id":"5770cba14607a30e001debd2","__v":3,"api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"excerpt":"","link_external":false,"project":"56d4304373dcd20b00fb854e","version":"5770cba14607a30e001debc2","createdAt":"2016-02-29T14:36:56.169Z","githubsync":"","link_url":"","parentDoc":null,"updates":[],"user":"54e5a4a0d3ab670d00f3af54","body":"[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Version\",\n    \"h-1\": \"Download link\",\n    \"h-2\": \"Download link\",\n    \"0-0\": \"1.14.0\",\n    \"0-1\": \"[Android SDK](http://interactor-dev.s3.amazonaws.com/interactor-android-1.14.0.320.zip)\",\n    \"0-2\": \"[Android SDK](https://interactor-dev.s3.amazonaws.com/interactor-android.zip)\",\n    \"1-0\": \"Proximity Sample App\",\n    \"1-1\": \"[Android App](https://play.google.com/store/apps/details?id=com.lbs.proximity)\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]","hidden":false,"order":1,"slug":"downloads-android","sync_unique":"","type":"basic","category":"5770cba14607a30e001debc8","isReference":false,"title":"Downloads - Android","childrenPages":[]}

Downloads - Android


[block:parameters] { "data": { "h-0": "Version", "h-1": "Download link", "h-2": "Download link", "0-0": "1.14.0", "0-1": "[Android SDK](http://interactor-dev.s3.amazonaws.com/interactor-android-1.14.0.320.zip)", "0-2": "[Android SDK](https://interactor-dev.s3.amazonaws.com/interactor-android.zip)", "1-0": "Proximity Sample App", "1-1": "[Android App](https://play.google.com/store/apps/details?id=com.lbs.proximity)" }, "cols": 2, "rows": 2 } [/block]
[block:parameters] { "data": { "h-0": "Version", "h-1": "Download link", "h-2": "Download link", "0-0": "1.14.0", "0-1": "[Android SDK](http://interactor-dev.s3.amazonaws.com/interactor-android-1.14.0.320.zip)", "0-2": "[Android SDK](https://interactor-dev.s3.amazonaws.com/interactor-android.zip)", "1-0": "Proximity Sample App", "1-1": "[Android App](https://play.google.com/store/apps/details?id=com.lbs.proximity)" }, "cols": 2, "rows": 2 } [/block]
{"_id":"5770cba14607a30e001debd3","project":"56d4304373dcd20b00fb854e","title":"Downloads - Cordova","updates":[],"link_external":false,"link_url":"","order":2,"parentDoc":null,"__v":1,"body":"[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Version\",\n    \"h-1\": \"Download link\",\n    \"h-2\": \"Download link\",\n    \"0-0\": \"1.14.0\",\n    \"0-1\": \"[Cordova SDK](https://bitbucket.org/interactdev/cordova-interactor-plugin-public)\",\n    \"0-2\": \"[Android SDK](https://interactor-dev.s3.amazonaws.com/interactor-android.zip)\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]","isReference":false,"slug":"downloads-cordova","version":"5770cba14607a30e001debc2","api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"code":"{}","language":"json","status":400,"name":""}]},"settings":"","url":"","auth":"required","params":[]},"hidden":false,"type":"basic","sync_unique":"","user":"54e5a4a0d3ab670d00f3af54","category":"5770cba14607a30e001debc8","createdAt":"2016-03-14T15:58:59.329Z","excerpt":"","githubsync":"","childrenPages":[]}

Downloads - Cordova


[block:parameters] { "data": { "h-0": "Version", "h-1": "Download link", "h-2": "Download link", "0-0": "1.14.0", "0-1": "[Cordova SDK](https://bitbucket.org/interactdev/cordova-interactor-plugin-public)", "0-2": "[Android SDK](https://interactor-dev.s3.amazonaws.com/interactor-android.zip)" }, "cols": 2, "rows": 1 } [/block]
[block:parameters] { "data": { "h-0": "Version", "h-1": "Download link", "h-2": "Download link", "0-0": "1.14.0", "0-1": "[Cordova SDK](https://bitbucket.org/interactdev/cordova-interactor-plugin-public)", "0-2": "[Android SDK](https://interactor-dev.s3.amazonaws.com/interactor-android.zip)" }, "cols": 2, "rows": 1 } [/block]
{"_id":"5770cba14607a30e001debcd","order":0,"project":"56d4304373dcd20b00fb854e","slug":"1130","title":"1.13.0","category":"5770cba14607a30e001debc9","hidden":false,"link_url":"","githubsync":"","api":{"params":[],"url":"","results":{"codes":[{"status":200,"name":"","code":"{}","language":"json"},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required"},"body":"- You can now register for life cycle callbacks so you know exactly when to update UI accordingly\n- We've loosened the location permission for both Android and iOS:\n \t- **API Change** On iOS you can now set location permission to \"on app usage” (previously you could only select always or never)\n \t- Android SDK is now passive consumer of the location\n- iOS SDK now supports bitcode\n- Bug fixes and stability improvements\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"https://issues.apache.org/jira/browse/CB-10530\\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\\ncordova platform rm ios\\ncordova platform add ios@4.1.0\",\n  \"title\": \"Major Cordova app freeze issue on iOS platforms prior to 4.1.0\"\n}\n[/block]","excerpt":"","parentDoc":null,"type":"basic","updates":[],"__v":0,"createdAt":"2016-06-27T06:26:35.331Z","isReference":false,"user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","link_external":false,"sync_unique":"","childrenPages":[]}

1.13.0


- You can now register for life cycle callbacks so you know exactly when to update UI accordingly - We've loosened the location permission for both Android and iOS: - **API Change** On iOS you can now set location permission to "on app usage” (previously you could only select always or never) - Android SDK is now passive consumer of the location - iOS SDK now supports bitcode - Bug fixes and stability improvements [block:callout] { "type": "warning", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0" } [/block]
- You can now register for life cycle callbacks so you know exactly when to update UI accordingly - We've loosened the location permission for both Android and iOS: - **API Change** On iOS you can now set location permission to "on app usage” (previously you could only select always or never) - Android SDK is now passive consumer of the location - iOS SDK now supports bitcode - Bug fixes and stability improvements [block:callout] { "type": "warning", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0" } [/block]
{"_id":"5770cba14607a30e001debeb","hidden":false,"isReference":false,"excerpt":"","githubsync":"","category":"5770cba14607a30e001debc9","createdAt":"2016-02-29T11:57:59.791Z","link_external":false,"project":"56d4304373dcd20b00fb854e","slug":"191","user":"54e5a4a0d3ab670d00f3af54","api":{"params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required"},"body":"# SDK\n\n- Fixed a bug which caused the SDK to crash when a zone is unassigned from a beacon.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Major Cordova app freeze issue on iOS platforms prior to 4.1.0\",\n  \"body\": \"https://issues.apache.org/jira/browse/CB-10530\\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\\ncordova platform rm ios\\ncordova platform add ios@4.1.0\"\n}\n[/block]","order":1,"parentDoc":null,"sync_unique":"","updates":[],"__v":0,"type":"basic","version":"5770cba14607a30e001debc2","link_url":"","title":"1.12.1","childrenPages":[]}

1.12.1


# SDK - Fixed a bug which caused the SDK to crash when a zone is unassigned from a beacon. [block:callout] { "type": "warning", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0" } [/block]
# SDK - Fixed a bug which caused the SDK to crash when a zone is unassigned from a beacon. [block:callout] { "type": "warning", "title": "Major Cordova app freeze issue on iOS platforms prior to 4.1.0", "body": "https://issues.apache.org/jira/browse/CB-10530\nTo fix this issue and to ensure proper working of Interactor plugin and your app, run this code from your console:\ncordova platform rm ios\ncordova platform add ios@4.1.0" } [/block]
{"_id":"5770cba14607a30e001debec","githubsync":"","hidden":false,"project":"56d4304373dcd20b00fb854e","slug":"1120","title":"1.12.0","__v":0,"api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"","updates":[],"link_url":"","order":2,"type":"basic","version":"5770cba14607a30e001debc2","isReference":false,"link_external":false,"body":"# SDK\n- Fixed an important timezone issue which caused events to be enabled only in gmt timezone.\n- The cordova plugin now uses a background thread for iOS, so nothing blocks the UI thread.\n- The events delivered by the SDK to the app now include Zone details, so you know which beacon has triggered the event.\n- The Interactor is now backwards compatible with iOS 8.0\n - You can now reduce the amount of data which is sent to the server if you don't need constant beacon status updates on web front end.","category":"5770cba14607a30e001debc9","parentDoc":null,"createdAt":"2016-04-18T06:22:50.795Z","sync_unique":"","user":"54e5a4a0d3ab670d00f3af54","childrenPages":[]}

1.12.0


# SDK - Fixed an important timezone issue which caused events to be enabled only in gmt timezone. - The cordova plugin now uses a background thread for iOS, so nothing blocks the UI thread. - The events delivered by the SDK to the app now include Zone details, so you know which beacon has triggered the event. - The Interactor is now backwards compatible with iOS 8.0 - You can now reduce the amount of data which is sent to the server if you don't need constant beacon status updates on web front end.
# SDK - Fixed an important timezone issue which caused events to be enabled only in gmt timezone. - The cordova plugin now uses a background thread for iOS, so nothing blocks the UI thread. - The events delivered by the SDK to the app now include Zone details, so you know which beacon has triggered the event. - The Interactor is now backwards compatible with iOS 8.0 - You can now reduce the amount of data which is sent to the server if you don't need constant beacon status updates on web front end.
{"_id":"5770cba14607a30e001debed","parentDoc":null,"type":"basic","updates":[],"excerpt":"","githubsync":"","isReference":false,"link_url":"","api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required"},"project":"56d4304373dcd20b00fb854e","title":"1.11.0","user":"54e5a4a0d3ab670d00f3af54","category":"5770cba14607a30e001debc9","link_external":false,"slug":"1110","sync_unique":"","order":3,"version":"5770cba14607a30e001debc2","__v":0,"body":"# SDK\n - The SDK throws now an error if you try to configure an already configured or running Interactor\n\n## Cordova\n - We've improved our versioning. All components include now a proper version number. \nRemoved the synchroniseData function from public API. The app synchronise now automatically when brought to the foreground, and periodically in the background.\n - The plugin throws now an error if you try to configure an already configured or running Interactor.\n - Fixed a bug which caused notifications to be no longer presented if the app is swiped away\n - Fixed a bug to align the return value of getAllBeacons function so that it matches on both platforms.","createdAt":"2016-04-18T06:22:41.013Z","hidden":false,"childrenPages":[]}

1.11.0


# SDK - The SDK throws now an error if you try to configure an already configured or running Interactor ## Cordova - We've improved our versioning. All components include now a proper version number. Removed the synchroniseData function from public API. The app synchronise now automatically when brought to the foreground, and periodically in the background. - The plugin throws now an error if you try to configure an already configured or running Interactor. - Fixed a bug which caused notifications to be no longer presented if the app is swiped away - Fixed a bug to align the return value of getAllBeacons function so that it matches on both platforms.
# SDK - The SDK throws now an error if you try to configure an already configured or running Interactor ## Cordova - We've improved our versioning. All components include now a proper version number. Removed the synchroniseData function from public API. The app synchronise now automatically when brought to the foreground, and periodically in the background. - The plugin throws now an error if you try to configure an already configured or running Interactor. - Fixed a bug which caused notifications to be no longer presented if the app is swiped away - Fixed a bug to align the return value of getAllBeacons function so that it matches on both platforms.
{"_id":"5770cba14607a30e001debee","isReference":false,"version":"5770cba14607a30e001debc2","title":"1.10.0","category":"5770cba14607a30e001debc9","hidden":false,"project":"56d4304373dcd20b00fb854e","slug":"1100","updates":[],"createdAt":"2016-04-18T06:22:30.934Z","excerpt":"","parentDoc":null,"sync_unique":"","link_external":false,"link_url":"","order":4,"type":"basic","__v":0,"api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"# SDK\n  * Added support for custom event types\n  * The unique app ID is now using a bigger range\n  * Fixed a bug which caused a crash on iOS when events contained % sign and logging was enabled\n  * Fixed a bug where the beacon Status was not published for certain beacons\n\n## Cordova\n  * Added support for custom event types\n  * Added a feature to filter local notification and/or modify their content\n  * Added field \"rssi\"  to the eventListener data object\n  * Fixed a bug where the very first notification is lost on iOS if the user is asked to allow notification at the same time","githubsync":"","user":"54e5a4a0d3ab670d00f3af54","childrenPages":[]}

1.10.0


# SDK * Added support for custom event types * The unique app ID is now using a bigger range * Fixed a bug which caused a crash on iOS when events contained % sign and logging was enabled * Fixed a bug where the beacon Status was not published for certain beacons ## Cordova * Added support for custom event types * Added a feature to filter local notification and/or modify their content * Added field "rssi" to the eventListener data object * Fixed a bug where the very first notification is lost on iOS if the user is asked to allow notification at the same time
# SDK * Added support for custom event types * The unique app ID is now using a bigger range * Fixed a bug which caused a crash on iOS when events contained % sign and logging was enabled * Fixed a bug where the beacon Status was not published for certain beacons ## Cordova * Added support for custom event types * Added a feature to filter local notification and/or modify their content * Added field "rssi" to the eventListener data object * Fixed a bug where the very first notification is lost on iOS if the user is asked to allow notification at the same time
{"_id":"5770cba14607a30e001debef","title":"1.9.1","type":"basic","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":""},"githubsync":"","hidden":false,"link_external":false,"order":5,"body":"## SDK\n  *  Fixed a bug on Android with not receiving events when an event had '%' in the title, description and/or content.","link_url":"","project":"56d4304373dcd20b00fb854e","sync_unique":"","user":"54e5a4a0d3ab670d00f3af54","createdAt":"2016-03-14T16:04:20.070Z","excerpt":"","version":"5770cba14607a30e001debc2","updates":[],"__v":0,"category":"5770cba14607a30e001debc9","isReference":false,"parentDoc":null,"slug":"191-1","childrenPages":[]}

1.9.1


## SDK * Fixed a bug on Android with not receiving events when an event had '%' in the title, description and/or content.
## SDK * Fixed a bug on Android with not receiving events when an event had '%' in the title, description and/or content.
{"_id":"5770cba14607a30e001debf0","project":"56d4304373dcd20b00fb854e","__v":0,"api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[]},"createdAt":"2016-02-29T14:38:03.465Z","excerpt":"","hidden":false,"parentDoc":null,"sync_unique":"","githubsync":"","order":6,"title":"1.9.0","body":"## SDK\n  *  Fixed a bug with receiving lots of notifications on specific phones in Android.\n  *  Os and device name are saved in zone events and beacon events in Elasticsearch.\n  *  Several bug fixes.\n\n## CORDOVA PLUGIN\n  *  Added the possibility to configure the notifications in Cordova.\n  *  Several bug fixes and improvements\n  *  The application name is now automatically added to the manifest for Android, so manual editing is no longer needed.\n  *  Cordova package name is now com.lbs instead of indoo.rs","isReference":false,"link_external":false,"slug":"190","category":"5770cba14607a30e001debc9","link_url":"","type":"basic","updates":[],"user":"54e5a4a0d3ab670d00f3af54","version":"5770cba14607a30e001debc2","childrenPages":[]}

1.9.0


## SDK * Fixed a bug with receiving lots of notifications on specific phones in Android. * Os and device name are saved in zone events and beacon events in Elasticsearch. * Several bug fixes. ## CORDOVA PLUGIN * Added the possibility to configure the notifications in Cordova. * Several bug fixes and improvements * The application name is now automatically added to the manifest for Android, so manual editing is no longer needed. * Cordova package name is now com.lbs instead of indoo.rs
## SDK * Fixed a bug with receiving lots of notifications on specific phones in Android. * Os and device name are saved in zone events and beacon events in Elasticsearch. * Several bug fixes. ## CORDOVA PLUGIN * Added the possibility to configure the notifications in Cordova. * Several bug fixes and improvements * The application name is now automatically added to the manifest for Android, so manual editing is no longer needed. * Cordova package name is now com.lbs instead of indoo.rs