{"__v":10,"_id":"55a93d4c02becf2d007aac4c","category":{"__v":11,"_id":"55a93098cf45e1390093f351","pages":["55a930bdcf45e1390093f353","55a932afc8bd450d000dd1d6","55a938ba4c661b3700cf4e1f","55a939b502becf2d007aac34","55a93a015d3abb0d0012f184","55a93b225d3abb0d0012f191","55a93c4002becf2d007aac43","55a93d4c02becf2d007aac4c","55a940485d3abb0d0012f1af","55a9409802becf2d007aac64","55a9410c5d3abb0d0012f1b4"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-17T16:43:04.054Z","from_sync":false,"order":4,"slug":"android-sdk-reference","title":"Android SDK Reference"},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","user":"559a618bdbcfd20d00710b38","version":{"__v":23,"_id":"559a61d2dbcfd20d00710b3c","project":"559a61d2dbcfd20d00710b39","createdAt":"2015-07-06T11:09:06.510Z","releaseDate":"2015-07-06T11:09:06.510Z","categories":["559a61d3dbcfd20d00710b3d","55a589ddaaf9cf1900114dd0","55a589e30f354f0d00fd0312","55a589ea80c8a30d00b323cc","55a589f6aaf9cf1900114dd1","55a58d4e80c8a30d00b323e6","55a8e7a227a17d21005251a2","55a93098cf45e1390093f351","55afb085f202b12100cd9e83","55afb22e902fd51700f5f8bf","55afb260902fd51700f5f8c2","55afb28ec8a85321007a5462","55afb294f202b12100cd9e95","55afb29b902fd51700f5f8c5","55afb2a1c8a85321007a5463","55afb2a7902fd51700f5f8c7","55afb2ad902fd51700f5f8c8","55afb2b5902fd51700f5f8ca","55b74b2131bccb190081bedc","55bb441b54f9640d006e6cf2","565711085cb2420d00d70071","5681681330018c0d006bf7ff","588f38b5923d610f00c72dad"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"Version 1.0","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-17T17:37:16.339Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"##Introduction\n\n- The *MOCA SDK* lets you effortlessly add Bluetooth beacon based proximity experiences to your Android app.\n- The SDK comes with a powerful proximity engine based on Complex Event Processing logic (see CEP).\n- MOCA defines some fundamental concepts:\n - Place, Zone, and Beacon\n - Trigger and Action\n - Visit\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/WLyeYphSEG6RZQzRWIvs_Da-proximity-experience.png\",\n        \"Da-proximity-experience.png\",\n        \"911\",\n        \"457\",\n        \"#3ba0da\",\n        \"\"\n      ],\n      \"caption\": \"MOCA Fundamental concepts\"\n    }\n  ]\n}\n[/block]\nTo start using** Beacon-based proximity experiences** in your Android app, you’ll need to enable proximity service.\n\n\n- Ensure proximity service is enabled in `AndroidManifest.xml file\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" <application …>\\n\\n\\t<meta-data android:name=”moca.PROXIMITY_SERVICE_ENABLED\\\" android:value=\\\"true\\\"/>\\n\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n- The MOCA.initializeSDK() call, will automatically start MOCA proximity engine and synchronize proximity campaigns defined in your MOCA cloud account.\n\n###Places\nRepresents a real-world location, such as a store, venue, museum, building, office and so on.\n- A place can be localized by a geo-fence (GPS location and radius in meters) \n- A place contains a collection of zones, where each zone defines semantics for an indoor location, such as Kids Clothes, Women Clothes, Entrance, Exit, Books, Videogames, etc.\n\n###Zone\nRepresents a indoor area or micro-location within the place with user-defined semantics. \n- Examples include Kids Clothes, Women Clothes, Entrance, Exit, Books, Videogames, etc.\n- A zone is defined by a range of one or more beacon sensors. \n\n###Beacon\nIt is a BLE, iBeacon-compatible proximity sensor.\n- Each beacon is identified by { Proximity UUID, Major and Minor } tuple.\n- MOCA SDK works with any iBeacon-compatible devices. \n - This includes MOCA Beacons \n - And beacons provided by other manufacturers such as Kontakt.io, Estimote, etc.\n- Beacons are assigned to Zones that define their micro-location semantics. \n- Each beacon must be registered in MOCA Management Console.\n\n###Campaigns \nCollections of proximity experiences that are delivered to a user within a specified time frame.\n\n###Experience \nDefines a proximity interaction with a user. \n- An experience is composed of a trigger condition and an action. \n- When proximity trigger conditions are met, the corresponding action is fired.\n\n###Trigger\nIt is a condition or a collection of conditions that must be met to fire an action associated with an experience. For example:\n- Enter place, \n- Exit place, \n- Enter zone, \n- Exit zone,\n- Enter beacon range with given proximity, \n- Exit beacon range,\n- Custom trigger (implemented as app-provided delegate callback)\n\n###Action\nDescribes an activity to be performed when experience trigger conditions are met. The SDK supports the following actions:\n- Show local push notification with a specific message\n- Play sound with a specific file name (included in app bundle)\n- Play video from URL\n- Show image from URL\n- Show HTML content from URL\n- Open custom URL\n- Show PassBook card\n- Custom action (implemented as app-provided delegate callback)","excerpt":"","slug":"proximity-api-1","type":"basic","title":"Proximity API"}
##Introduction - The *MOCA SDK* lets you effortlessly add Bluetooth beacon based proximity experiences to your Android app. - The SDK comes with a powerful proximity engine based on Complex Event Processing logic (see CEP). - MOCA defines some fundamental concepts: - Place, Zone, and Beacon - Trigger and Action - Visit [block:image] { "images": [ { "image": [ "https://files.readme.io/WLyeYphSEG6RZQzRWIvs_Da-proximity-experience.png", "Da-proximity-experience.png", "911", "457", "#3ba0da", "" ], "caption": "MOCA Fundamental concepts" } ] } [/block] To start using** Beacon-based proximity experiences** in your Android app, you’ll need to enable proximity service. - Ensure proximity service is enabled in `AndroidManifest.xml file [block:code] { "codes": [ { "code": " <application …>\n\n\t<meta-data android:name=”moca.PROXIMITY_SERVICE_ENABLED\" android:value=\"true\"/>\n", "language": "xml" } ] } [/block] - The MOCA.initializeSDK() call, will automatically start MOCA proximity engine and synchronize proximity campaigns defined in your MOCA cloud account. ###Places Represents a real-world location, such as a store, venue, museum, building, office and so on. - A place can be localized by a geo-fence (GPS location and radius in meters) - A place contains a collection of zones, where each zone defines semantics for an indoor location, such as Kids Clothes, Women Clothes, Entrance, Exit, Books, Videogames, etc. ###Zone Represents a indoor area or micro-location within the place with user-defined semantics. - Examples include Kids Clothes, Women Clothes, Entrance, Exit, Books, Videogames, etc. - A zone is defined by a range of one or more beacon sensors. ###Beacon It is a BLE, iBeacon-compatible proximity sensor. - Each beacon is identified by { Proximity UUID, Major and Minor } tuple. - MOCA SDK works with any iBeacon-compatible devices. - This includes MOCA Beacons - And beacons provided by other manufacturers such as Kontakt.io, Estimote, etc. - Beacons are assigned to Zones that define their micro-location semantics. - Each beacon must be registered in MOCA Management Console. ###Campaigns Collections of proximity experiences that are delivered to a user within a specified time frame. ###Experience Defines a proximity interaction with a user. - An experience is composed of a trigger condition and an action. - When proximity trigger conditions are met, the corresponding action is fired. ###Trigger It is a condition or a collection of conditions that must be met to fire an action associated with an experience. For example: - Enter place, - Exit place, - Enter zone, - Exit zone, - Enter beacon range with given proximity, - Exit beacon range, - Custom trigger (implemented as app-provided delegate callback) ###Action Describes an activity to be performed when experience trigger conditions are met. The SDK supports the following actions: - Show local push notification with a specific message - Play sound with a specific file name (included in app bundle) - Play video from URL - Show image from URL - Show HTML content from URL - Open custom URL - Show PassBook card - Custom action (implemented as app-provided delegate callback)