{"_id":"59e70b9fe027ae002e7d2f1d","category":{"_id":"59e70b9ee027ae002e7d2ed5","version":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-01T13:29:31.291Z","from_sync":false,"order":2,"slug":"android-reference","title":"Android Reference"},"project":"5496d393f52a630b00519cdd","parentDoc":null,"user":"5496d353f52a630b00519cdc","version":{"_id":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":2,"createdAt":"2017-10-18T08:06:54.462Z","releaseDate":"2017-10-18T08:06:54.462Z","categories":["59e70b9ee027ae002e7d2ed3","59e70b9ee027ae002e7d2ed4","59e70b9ee027ae002e7d2ed5","59e70b9ee027ae002e7d2ed6","59e70b9ee027ae002e7d2ed7","59e70b9ee027ae002e7d2ed8","59e70b9ee027ae002e7d2ed9","59e70b9ee027ae002e7d2eda","59e70b9ee027ae002e7d2edb","59e70b9ee027ae002e7d2edc","59e70b9ee027ae002e7d2edd","59e70b9ee027ae002e7d2ede","59e70b9ee027ae002e7d2edf","5b8661ccdd19310003a3fa0b"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.10","version":"2.0.10"},"githubsync":"","__v":0,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-01T13:29:57.373Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Activate the SDK\",\n  \"body\": \"Please follow our [\\\"Android - Quick Start\\\" guide](doc:android) for SDK activation instructions.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Add Custom Data\"\n}\n[/block]\nIf known, it is highly recommended to set the user age, gender using the **setUserInfo** method and Placer's reserved keys: **gender**, **year_of_birth** . These data will be used to improve Placer's venue detection and profiling performance. \n\nYou may set your own key-value pairs with custom keys for your own usage. \n\nCustom data is available in your app's dashboard, REST API and batch export.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HashMap<String, String> placerParams = new HashMap<>();\\n\\nplacerParams.put(\\\"gender\\\", \\\"male\\\"); \\nplacerParams.put(\\\"year_of_birth\\\", \\\"1985\\\" );\\nplacerParams.put(\\\"CUSTOM_KEY_1\\\", \\\"CUSTOM_VALUE_1\\\" );\\n\\nPlacer.setUserInfo(placerParams);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nUse Placer.getUserInfo() to retrieve custom data.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set User ID\"\n}\n[/block]\nUse Placer.setUserId() to define a custom User ID and Placer.getUserId() to retrieve it. Example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import com.placer.client.Placer;\\npublic class SplashScreenActivity extends Activity {\\n\\t:::at:::Override\\n\\tprotected void onCreate(Bundle savedInstanceState) {\\n    \\tsuper.onCreate(savedInstanceState);\\n    \\tPlacer.activate(getApplicationContext());\\n        Placer.setUserId('YourUniqueCustomUserIDString');\\n    \\t// here comes the rest of your Activity code\\n\\t}\\n}\\n\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n*Note: User ID cannot be longer than 100 characters.*\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enable Flight Tracking\"\n}\n[/block]\nFlight tracking is used to track flights in real-time. Enable flight tracking by adding \"flight_detection =true\" to your placer.properties file.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"placer_application_key=YOUR_APP_KEY\\nflight_detection=true\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Disabling and Enabling the SDK\"\n}\n[/block]\nThe “isActive” function is used to determine if the SDK is currently active:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"  Boolean SDKActive= Placer.isActive(getApplicationContext());\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nActivating the SDK is done by calling the “activate” function:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\tPlacer.activate(getApplicationContext());\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nDeactivating the SDK is done by calling the “deactivate” function:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\tPlacer.deactivate(getApplicationContext());\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n##SDK Activation without the placer.properties file\nPlacer supports activating the SDK without the properties file. Simply call:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Placer.activateWithKey(getApplicationContext(),\\\"YOUR_APP_KEY\\\");\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enabling / Disabling Signals\"\n}\n[/block]\nPlacer’s profile quality is subject to the type and quantity of signals collected from the mobile device. Collecting more signals will result in a higher quality profile. \n\nBy default, location, Wi-Fi, and beacons monitors are **enabled**. geofences and 'installed apps' are **disabled** by default.\n\nTo change the default configuration, set the monitor name to *false* (disabled) or *true* (enabled) in the placer.properties file. \nFor example, to disable beacons and enable installed apps monitoring, add the following lines:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"monitor_beacons=false\\nmonitor_installed_apps=true\",\n      \"language\": \"text\",\n      \"name\": \"placer.properties\"\n    }\n  ]\n}\n[/block]\nThe following list contains the supported monitors and the permissions required for using them:\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"monitor_location\",\n    \"h-0\": \"Monitor Name\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Required Permissions\",\n    \"0-1\": \"Monitors GPS and Network location signals.\",\n    \"0-2\": \"Basic Permissions +\\nLocation Permissions (ACCESS_FINE_LOCATION)\",\n    \"1-0\": \"monitor_wifi_info\",\n    \"1-1\": \"Monitors Wi-Fi networks details, such as: BSSID, SSID and signal strength.\",\n    \"1-2\": \"Basic Permissions +\\nLocation Permissions\\n(ACCESS_WIFI_STATE)\",\n    \"2-0\": \"monitor_beacons\",\n    \"2-1\": \"Monitors beacons. Improves tracking in indoor locations.\",\n    \"2-2\": \"Basic Permissions +\\nLocation Permissions + \\nBeacons Permissions (BLUETOOTH_ADMIN / BLUETOOTH)\",\n    \"3-0\": \"monitor_installed_apps\",\n    \"3-1\": \"Monitors installed apps on the device.\",\n    \"3-2\": \"Basic Permissions + Privacy policy adjustments\",\n    \"h-3\": \"Default\",\n    \"0-3\": \"Enabled\",\n    \"1-3\": \"Enabled\",\n    \"2-3\": \"Enabled\",\n    \"3-3\": \"Disabled\",\n    \"4-0\": \"monitor_geofence\",\n    \"4-1\": \"Monitors geofences\",\n    \"4-2\": \"Basic Permissions + Location Permissions (ACCESS_FINE_LOCATION)\",\n    \"4-3\": \"Disabled\"\n  },\n  \"cols\": 4,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Limit the number of beacon slots used\"\n}\n[/block]\nBy default, Placer will use all beacon slots to generate an accurate user timeline. Update the value in **placer.properties** file if you would like to limit the number of slots Placer uses (e.g. to save slots for additional location logic/use cases).\nReplace '12' in the example below with the max number of slots Placer should use.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"max_beacons_filters = 12\",\n      \"language\": \"text\",\n      \"name\": \"placer.properties\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Limit the number of geofence slots used\"\n}\n[/block]\nBy default, Placer will use 50 geofences slots .  Update the value in **placer.properties** file if you would like to limit the number of slots Placer uses . Replace '25' in the example below with the max number of slots Placer should use. Please note that the maximum number of slots Placer support is 80\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"max_num_of_geofences = 25\",\n      \"language\": \"text\",\n      \"name\": \"placer.properties\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"customization-1","type":"basic","title":"Customization"}
[block:callout] { "type": "info", "title": "Activate the SDK", "body": "Please follow our [\"Android - Quick Start\" guide](doc:android) for SDK activation instructions." } [/block] [block:api-header] { "type": "basic", "title": "Add Custom Data" } [/block] If known, it is highly recommended to set the user age, gender using the **setUserInfo** method and Placer's reserved keys: **gender**, **year_of_birth** . These data will be used to improve Placer's venue detection and profiling performance. You may set your own key-value pairs with custom keys for your own usage. Custom data is available in your app's dashboard, REST API and batch export. [block:code] { "codes": [ { "code": "HashMap<String, String> placerParams = new HashMap<>();\n\nplacerParams.put(\"gender\", \"male\"); \nplacerParams.put(\"year_of_birth\", \"1985\" );\nplacerParams.put(\"CUSTOM_KEY_1\", \"CUSTOM_VALUE_1\" );\n\nPlacer.setUserInfo(placerParams);", "language": "java" } ] } [/block] Use Placer.getUserInfo() to retrieve custom data. [block:api-header] { "type": "basic", "title": "Set User ID" } [/block] Use Placer.setUserId() to define a custom User ID and Placer.getUserId() to retrieve it. Example: [block:code] { "codes": [ { "code": "import com.placer.client.Placer;\npublic class SplashScreenActivity extends Activity {\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n \tsuper.onCreate(savedInstanceState);\n \tPlacer.activate(getApplicationContext());\n Placer.setUserId('YourUniqueCustomUserIDString');\n \t// here comes the rest of your Activity code\n\t}\n}\n", "language": "java" } ] } [/block] *Note: User ID cannot be longer than 100 characters.* [block:api-header] { "type": "basic", "title": "Enable Flight Tracking" } [/block] Flight tracking is used to track flights in real-time. Enable flight tracking by adding "flight_detection =true" to your placer.properties file. [block:code] { "codes": [ { "code": "placer_application_key=YOUR_APP_KEY\nflight_detection=true", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Disabling and Enabling the SDK" } [/block] The “isActive” function is used to determine if the SDK is currently active: [block:code] { "codes": [ { "code": " Boolean SDKActive= Placer.isActive(getApplicationContext());", "language": "java" } ] } [/block] Activating the SDK is done by calling the “activate” function: [block:code] { "codes": [ { "code": "\tPlacer.activate(getApplicationContext());", "language": "java" } ] } [/block] Deactivating the SDK is done by calling the “deactivate” function: [block:code] { "codes": [ { "code": "\tPlacer.deactivate(getApplicationContext());", "language": "java" } ] } [/block] ##SDK Activation without the placer.properties file Placer supports activating the SDK without the properties file. Simply call: [block:code] { "codes": [ { "code": "Placer.activateWithKey(getApplicationContext(),\"YOUR_APP_KEY\");", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Enabling / Disabling Signals" } [/block] Placer’s profile quality is subject to the type and quantity of signals collected from the mobile device. Collecting more signals will result in a higher quality profile. By default, location, Wi-Fi, and beacons monitors are **enabled**. geofences and 'installed apps' are **disabled** by default. To change the default configuration, set the monitor name to *false* (disabled) or *true* (enabled) in the placer.properties file. For example, to disable beacons and enable installed apps monitoring, add the following lines: [block:code] { "codes": [ { "code": "monitor_beacons=false\nmonitor_installed_apps=true", "language": "text", "name": "placer.properties" } ] } [/block] The following list contains the supported monitors and the permissions required for using them: [block:parameters] { "data": { "0-0": "monitor_location", "h-0": "Monitor Name", "h-1": "Description", "h-2": "Required Permissions", "0-1": "Monitors GPS and Network location signals.", "0-2": "Basic Permissions +\nLocation Permissions (ACCESS_FINE_LOCATION)", "1-0": "monitor_wifi_info", "1-1": "Monitors Wi-Fi networks details, such as: BSSID, SSID and signal strength.", "1-2": "Basic Permissions +\nLocation Permissions\n(ACCESS_WIFI_STATE)", "2-0": "monitor_beacons", "2-1": "Monitors beacons. Improves tracking in indoor locations.", "2-2": "Basic Permissions +\nLocation Permissions + \nBeacons Permissions (BLUETOOTH_ADMIN / BLUETOOTH)", "3-0": "monitor_installed_apps", "3-1": "Monitors installed apps on the device.", "3-2": "Basic Permissions + Privacy policy adjustments", "h-3": "Default", "0-3": "Enabled", "1-3": "Enabled", "2-3": "Enabled", "3-3": "Disabled", "4-0": "monitor_geofence", "4-1": "Monitors geofences", "4-2": "Basic Permissions + Location Permissions (ACCESS_FINE_LOCATION)", "4-3": "Disabled" }, "cols": 4, "rows": 5 } [/block] [block:api-header] { "title": "Limit the number of beacon slots used" } [/block] By default, Placer will use all beacon slots to generate an accurate user timeline. Update the value in **placer.properties** file if you would like to limit the number of slots Placer uses (e.g. to save slots for additional location logic/use cases). Replace '12' in the example below with the max number of slots Placer should use. [block:code] { "codes": [ { "code": "max_beacons_filters = 12", "language": "text", "name": "placer.properties" } ] } [/block] [block:api-header] { "title": "Limit the number of geofence slots used" } [/block] By default, Placer will use 50 geofences slots . Update the value in **placer.properties** file if you would like to limit the number of slots Placer uses . Replace '25' in the example below with the max number of slots Placer should use. Please note that the maximum number of slots Placer support is 80 [block:code] { "codes": [ { "code": "max_num_of_geofences = 25", "language": "text", "name": "placer.properties" } ] } [/block]