{"__v":3,"_id":"55a9102bc8bd450d000dd170","category":{"__v":12,"_id":"55a8e7a227a17d21005251a2","pages":["55a8feb327a17d2100525201","55a9021527a17d2100525208","55a9035927a17d210052520b","55a903cfcf45e1390093f29e","55a9049727a17d210052520f","55a9059a27a17d2100525217","55a9066527a17d210052521e","55a9075bcf45e1390093f2a9","55a9090927a17d2100525228","55a90b30c8bd450d000dd164","55a90c56cf45e1390093f2bf","55a9102bc8bd450d000dd170"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-17T11:31:46.263Z","from_sync":false,"order":2,"slug":"ios-sdk-reference","title":"iOS 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_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-17T14:24:43.591Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":12,"body":"Location service authorization\n- By default, MOCA tracks user location and proximity interactions\n- The geo-location is tracked with 100-meter precision. \n- This is performed by means of iOS CLLocationManager\n- The user must allow the location tracking for the app (iOS 8 UseAlways mode).\n- The geo-location minimizes battery usage by employing SignificantLocationChange tracking\n- When the permission is not granted, MOCA does not track user location.\n\nHow event tracking works\n- MOCA SDK uses SQLite database stored in a local file on your phone to store all locally tracked events.\n- Periodically, when your device is connected to Internet (via Edge, 3G, LTE or WiFi), \u000bthe SDK incrementally transfers the packs of events to the cloud.\n- The local database is freed only when the transfer is successful (Store-And-Forward)\n- By default, the event transfer is performed every 15 minutes, but this may change depending on existing network conditions.\n\nBackground modes \n- MOCA SDK requires you to declare Background Modes for your app.\n- Open Capabilities tab in your App project build settings and configure the following options. The minimal configuration is as follows:\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ohipoRJRjK5UpOWpEMV8_background-modes.png\",\n        \"background-modes.png\",\n        \"1020\",\n        \"352\",\n        \"#395b8c\",\n        \"\"\n      ],\n      \"caption\": \"Background Modes\"\n    }\n  ]\n}\n[/block]\n- The `Background Fetch` option is required to periodically fetch the proximity campaign data from the cloud.\n- The `Uses Bluetooth LE accessories` is used by MOCA in order to be informed about Bluetooth status in the background.\n\nOffline behavior\n- MOCA SDK downloads proximity campaigns data from the cloud asynchronously using \u000b*background fetch* mechanism. \n- The frequency is controlled by iOS and depends on the app usage pattern.\n- The downloaded data is persisted locally and on servers as a cache.\n- If the connection to Internet is not available, the cached data is used to run the campaigns.\n- This enables you to offer proximity experiences even if the Internet connection is saturated or not available.","excerpt":"","slug":"design-considerations","type":"basic","title":"Design considerations"}

Design considerations


Location service authorization - By default, MOCA tracks user location and proximity interactions - The geo-location is tracked with 100-meter precision. - This is performed by means of iOS CLLocationManager - The user must allow the location tracking for the app (iOS 8 UseAlways mode). - The geo-location minimizes battery usage by employing SignificantLocationChange tracking - When the permission is not granted, MOCA does not track user location. How event tracking works - MOCA SDK uses SQLite database stored in a local file on your phone to store all locally tracked events. - Periodically, when your device is connected to Internet (via Edge, 3G, LTE or WiFi), the SDK incrementally transfers the packs of events to the cloud. - The local database is freed only when the transfer is successful (Store-And-Forward) - By default, the event transfer is performed every 15 minutes, but this may change depending on existing network conditions. Background modes - MOCA SDK requires you to declare Background Modes for your app. - Open Capabilities tab in your App project build settings and configure the following options. The minimal configuration is as follows: [block:image] { "images": [ { "image": [ "https://files.readme.io/ohipoRJRjK5UpOWpEMV8_background-modes.png", "background-modes.png", "1020", "352", "#395b8c", "" ], "caption": "Background Modes" } ] } [/block] - The `Background Fetch` option is required to periodically fetch the proximity campaign data from the cloud. - The `Uses Bluetooth LE accessories` is used by MOCA in order to be informed about Bluetooth status in the background. Offline behavior - MOCA SDK downloads proximity campaigns data from the cloud asynchronously using *background fetch* mechanism. - The frequency is controlled by iOS and depends on the app usage pattern. - The downloaded data is persisted locally and on servers as a cache. - If the connection to Internet is not available, the cached data is used to run the campaigns. - This enables you to offer proximity experiences even if the Internet connection is saturated or not available.