{"id":1163,"date":"2014-07-19T13:23:42","date_gmt":"2014-07-19T06:23:42","guid":{"rendered":"http:\/\/blog.bebensiganteng.com\/?p=1163"},"modified":"2016-03-14T08:18:22","modified_gmt":"2016-03-14T08:18:22","slug":"ibeacon-ios8","status":"publish","type":"post","link":"https:\/\/rahmat-hidayat.com\/?p=1163","title":{"rendered":"The iBeacon Experiment"},"content":{"rendered":"<p>For the impatient check out the <a href=\"https:\/\/github.com\/bebensiganteng\/Core-Location-Experiments\" title=\"https:\/\/github.com\/bebensiganteng\/Core-Location-Experiments\" target=\"_blank\">source code<\/a> and might I warn you that I use iOS 8.0 APIs.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/i.imgur.com\/Y0gKy2N.jpg\" width=\"425\" height=\"318\" alt=\"Result\" class=\"alignnone\" \/><\/p>\n<p>I&#8217;ve been watching <a title=\"https:\/\/developer.apple.com\/videos\/wwdc\/2014\/\" href=\"https:\/\/developer.apple.com\/videos\/wwdc\/2014\/\" target=\"_blank\">WWDC 2014<\/a> lately and one of the most interesting talk was about <a title=\"https:\/\/developer.apple.com\/videos\/enterprise\/#42\" href=\"https:\/\/developer.apple.com\/videos\/enterprise\/#42\" target=\"_blank\">Indoor Positioning<\/a>, the potential is amazing .. or super-annoying :D, sort of like a heat-seeking pop-up ad that follows you around, and of course iOS8 offers a few ways to lessen the pain such as the &#8220;What&#8217;s near me&#8221; app store.<\/p>\n<p><iframe loading=\"lazy\" src=\"\/\/player.vimeo.com\/video\/101143392?title=0&amp;byline=0&amp;portrait=0\" width=\"425\" height=\"239\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe><\/p>\n<p>Although is not yet available but I thought it&#8217;ll be fun to at least have the basic function running, using CoreLocation is pretty <a title=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/userexperience\/Conceptual\/LocationAwarenessPG\/CoreLocation\/CoreLocation.html\" href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/userexperience\/Conceptual\/LocationAwarenessPG\/CoreLocation\/CoreLocation.html\" target=\"_blank\">straightforward<\/a>, the only caveat for iOS8 is;<\/p>\n<p>The\u00a0<i>NSLocationAlwaysUsageDescription<\/i> and\u00a0<i>NSLocationWhenInUseUsageDescription<\/i> are mandatory, you need to provide something that will make sense to the user.<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">\r\n&lt;key&gt;NSLocationAlwaysUsageDescription&lt;\/key&gt;\r\n&lt;string&gt;Please let me always stalk you&lt;\/string&gt;\r\n&lt;key&gt;NSLocationWhenInUseUsageDescription&lt;\/key&gt;\r\n&lt;string&gt;Please let me stalk you only when you use it&lt;\/string&gt;\r\n<\/pre>\n<p>and you need to request the authorization.<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">\r\n[locationManager requestAlwaysAuthorization];\r\n[locationManager requestWhenInUseAuthorization];\r\n<\/pre>\n<p>Other important parts are the battery usage and the user&#8217;s flow which surprisingly wasn&#8217;t described clearly at the guide, I&#8217;ve devised my own so hopefully it will enlighten a few.<\/p>\n<p> <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/i.imgur.com\/FoP3WKv.jpg\" width=\"425\" height=\"503\" alt=\"Result\" class=\"alignnone\" \/><\/p>\n<p>For beacon there are a slew of selections that you can choose from, from the fancy <a href=\"http:\/\/estimote.com\/\" title=\"http:\/\/estimote.com\/\" target=\"_blank\">Estimote<\/a> or if you .. ahem .. a poor developer like me you can make your own beacon or just use <a href=\"https:\/\/github.com\/mttrb\/BeaconOSX\" title=\"https:\/\/github.com\/mttrb\/BeaconOSX\" target=\"_blank\">this<\/a>.<\/p>\n<h5>Resources<\/h5>\n<p><a href=\"https:\/\/github.com\/bebensiganteng\/Core-Location-Experiments\" title=\"https:\/\/github.com\/bebensiganteng\/Core-Location-Experiments\" target=\"_blank\">https:\/\/github.com\/bebensiganteng\/Core-Location-Experiments<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the impatient check out the source code and might I warn you that I use iOS 8.0 APIs. I&#8217;ve been watching WWDC 2014 lately and one of the most interesting talk was about Indoor Positioning, the potential is amazing .. or super-annoying :D, sort of like a heat-seeking pop-up ad that follows you around, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,15,20,24,43,60],"tags":[70,79,88,104,108,122,150],"_links":{"self":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/1163"}],"collection":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1163"}],"version-history":[{"count":1,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/1163\/revisions"}],"predecessor-version":[{"id":1633,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/1163\/revisions\/1633"}],"wp:attachment":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}