<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_91) on Fri Nov 18 15:37:14 WIB 2016 -->
<title>CBServiceListener</title>
<meta name="date" content="2016-11-18">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="CBServiceListener";
        }
    }
    catch(err) {
    }
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../com/eyro/cubeacon/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/eyro/cubeacon/CBRegion.html" title="class in com.eyro.cubeacon"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../com/eyro/cubeacon/Cubeacon.html" title="class in com.eyro.cubeacon"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/eyro/cubeacon/CBServiceListener.html" target="_top">Frames</a></li>
<li><a href="CBServiceListener.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.eyro.cubeacon</div>
<h2 title="Interface CBServiceListener" class="title">Interface CBServiceListener</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">CBServiceListener</span></pre>
<div class="block">An interface for an Android <tt>Activity</tt> or <tt>Service</tt>
 that wants to interact with beacons.  The interface is used in conjunction
 with <tt>Cubeacon</tt> and provides a callback when the <tt>BeaconService</tt>
 is ready to use.  Until this callback is made, ranging and monitoring of beacons is not
 possible.
 <p>
 In the example below, an Activity implements the <tt>CBServiceListener</tt> interface, binds
 to the service, then when it gets the callback saying the service is ready, it starts ranging.
 <p>
 <pre><tt>
  public class RangingActivity extends Activity implements CBServiceListener {
      protected static final String TAG = RangingActivity.class.getSimpleName();
      private Cubeacon client = Cubeacon.getInstance();

       @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_ranging);

          client.connect(this);
      }

       @Override
      protected void onDestroy() {
          super.onDestroy();

          client.disconnect(this);
      }

       @Override
      public void onBeaconServiceConnect() {
          client.addRangingListener(new CBRangingListener() {
             @Override
            public void didRangeBeaconsInRegion(List<CBBeacon> beacons, CBRegion region) {
                 if (beacons.size() > 0) {
                      Log.i(TAG, "The first beacon I see is about "+beacons.get(0).getAccuracy()+" meters away.");
                 }
            }
          });

          try {
              client.startRangingBeaconsInRegion(new Region("com.eyro.cubeacon.region_ranging"));
          } catch (RemoteException e) {
              Log.e(TAG, "Error while starting to ranging beacons, cause : " + e);
          }
      }
  }
  </tt></pre></div>
<dl>
<dt><span class="simpleTagLabel">Version:</span></dt>
<dd>2.0.0</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Eyro Labs</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../com/eyro/cubeacon/Cubeacon.html" title="class in com.eyro.cubeacon"><code>Cubeacon</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/eyro/cubeacon/CBServiceListener.html#bindService-android.content.Intent-android.content.ServiceConnection-int-">bindService</a></span>(android.content.Intent&nbsp;intent,
           android.content.ServiceConnection&nbsp;connection,
           int&nbsp;mode)</code>
<div class="block">Called by the Cubeacon to bind your CBServiceListener to the BeaconService.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>android.content.Context</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/eyro/cubeacon/CBServiceListener.html#getApplicationContext--">getApplicationContext</a></span>()</code>
<div class="block">Called by the Cubeacon to get the context of your Service or Activity.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/eyro/cubeacon/CBServiceListener.html#onBeaconServiceConnect--">onBeaconServiceConnect</a></span>()</code>
<div class="block">Called when the beacon service is running and ready to accept your commands through the Cubeacon</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/eyro/cubeacon/CBServiceListener.html#unbindService-android.content.ServiceConnection-">unbindService</a></span>(android.content.ServiceConnection&nbsp;connection)</code>
<div class="block">Called by the Cubeacon to unbind your CBServiceListener to the BeaconService.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="onBeaconServiceConnect--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onBeaconServiceConnect</h4>
<pre>void&nbsp;onBeaconServiceConnect()</pre>
<div class="block">Called when the beacon service is running and ready to accept your commands through the Cubeacon</div>
</li>
</ul>
<a name="getApplicationContext--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getApplicationContext</h4>
<pre>android.content.Context&nbsp;getApplicationContext()</pre>
<div class="block">Called by the Cubeacon to get the context of your Service or Activity.
 This method is implemented by Service or Activity. You generally should not override it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the application context of your service or activity</dd>
</dl>
</li>
</ul>
<a name="unbindService-android.content.ServiceConnection-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unbindService</h4>
<pre>void&nbsp;unbindService(android.content.ServiceConnection&nbsp;connection)</pre>
<div class="block">Called by the Cubeacon to unbind your CBServiceListener to the BeaconService.
 This method is implemented by Service or Activity, and You generally should not override it.</div>
</li>
</ul>
<a name="bindService-android.content.Intent-android.content.ServiceConnection-int-">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>bindService</h4>
<pre>boolean&nbsp;bindService(android.content.Intent&nbsp;intent,
                    android.content.ServiceConnection&nbsp;connection,
                    int&nbsp;mode)</pre>
<div class="block">Called by the Cubeacon to bind your CBServiceListener to the BeaconService.
 This method is implemented by Service or Activity, and You generally should not override it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><tt>true</tt> if successfully bound to the service</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.SecurityException</code> - If it do not have permission to bind to the given service</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../com/eyro/cubeacon/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/eyro/cubeacon/CBRegion.html" title="class in com.eyro.cubeacon"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../com/eyro/cubeacon/Cubeacon.html" title="class in com.eyro.cubeacon"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/eyro/cubeacon/CBServiceListener.html" target="_top">Frames</a></li>
<li><a href="CBServiceListener.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
