• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76<html>
77<head>
78
79
80
81<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
82
83<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
84<title>ActivityRecognitionClient | Android Developers</title>
85
86<!-- STYLESHEETS -->
87<link rel="stylesheet"
88href="//fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
89<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
90
91
92
93<!-- JAVASCRIPT -->
94<script src="//www.google.com/jsapi" type="text/javascript"></script>
95<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
96<script type="text/javascript">
97  var toRoot = "/";
98  var devsite = false;
99</script>
100<script src="/assets/js/docs.js" type="text/javascript"></script>
101
102<script type="text/javascript">
103  var _gaq = _gaq || [];
104  _gaq.push(['_setAccount', 'UA-5831155-1']);
105  _gaq.push(['_trackPageview']);
106
107  (function() {
108    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
109    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
110    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
111  })();
112</script>
113</head>
114<body class="gc-documentation google
115  develop" itemscope itemtype="http://schema.org/Article">
116  <div id="doc-api-level" class="" style="display:none"></div>
117  <a name="top"></a>
118
119<a name="top"></a>
120
121    <!-- Header -->
122    <div id="header">
123        <div class="wrap" id="header-wrap">
124          <div class="col-3 logo">
125          <a href="/index.html">
126            <img src="/assets/images/dac_logo.png" width="123" height="25" alt="Android Developers" />
127          </a>
128          <div class="btn-quicknav" id="btn-quicknav">
129          	<a href="#" class="arrow-inactive">Quicknav</a>
130			      <a href="#" class="arrow-active">Quicknav</a>
131          </div>
132          </div>
133            <ul class="nav-x col-9">
134                <li class="design">
135                  <a href="/design/index.html"
136                  zh-tw-lang="設計"
137                  zh-cn-lang="设计"
138                  ru-lang="Проектирование"
139                  ko-lang="디자인"
140                  ja-lang="設計"
141                  es-lang="Diseñar"
142                  >Design</a></li>
143                <li class="develop"><a href="/develop/index.html"
144                  zh-tw-lang="開發"
145                  zh-cn-lang="开发"
146                  ru-lang="Разработка"
147                  ko-lang="개발"
148                  ja-lang="開発"
149                  es-lang="Desarrollar"
150                  >Develop</a></li>
151                <li class="distribute last"><a href="/distribute/index.html"
152                  zh-tw-lang="發佈"
153                  zh-cn-lang="分发"
154                  ru-lang="Распространение"
155                  ko-lang="배포"
156                  ja-lang="配布"
157                  es-lang="Distribuir"
158                  >Distribute</a></li>
159            </ul>
160
161            <!-- New Search -->
162            <div class="menu-container">
163            <div class="moremenu">
164    <div id="more-btn"></div>
165  </div>
166  <div class="morehover" id="moremenu">
167    <div class="top"></div>
168    <div class="mid">
169      <div class="header">Links</div>
170      <ul>
171        <li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
172        <li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
173        <li><a href="/about/index.html">About Android</a></li>
174      </ul>
175      <div class="header">Android Sites</div>
176      <ul>
177        <li><a href="http://www.android.com">Android.com</a></li>
178        <li class="active"><a>Android Developers</a></li>
179        <li><a href="http://source.android.com">Android Open Source Project</a></li>
180      </ul>
181
182
183
184        <div class="header">Language</div>
185          <div id="language" class="locales">
186            <select name="language" onChange="changeLangPref(this.value, true)">
187                <option value="en">English</option>
188                <option value="es">Español</option>
189                <option value="ja">日本語</option>
190                <option value="ko">한국어</option>
191                <option value="ru">Русский</option>
192                <option value="zh-cn">中文 (中国)</option>
193                <option value="zh-tw">中文 (台灣)</option>
194            </select>
195          </div>
196        <script type="text/javascript">
197          <!--
198          loadLangPref();
199            //-->
200        </script>
201
202
203
204
205      <br class="clearfix" />
206    </div>
207    <div class="bottom"></div>
208  </div>
209  <div class="search" id="search-container">
210    <div class="search-inner">
211      <div id="search-btn"></div>
212      <div class="left"></div>
213      <form onsubmit="return submit_search()">
214        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
215onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
216onkeydown="return search_changed(event, true, '/')"
217onkeyup="return search_changed(event, false, '/')" />
218      </form>
219      <div class="right"></div>
220        <a class="close hide">close</a>
221        <div class="left"></div>
222        <div class="right"></div>
223    </div>
224  </div>
225
226  <div class="search_filtered_wrapper reference">
227    <div class="suggest-card reference no-display">
228      <ul class="search_filtered">
229      </ul>
230    </div>
231  </div>
232
233  <div class="search_filtered_wrapper docs">
234    <div class="suggest-card dummy no-display">&nbsp;</div>
235    <div class="suggest-card develop no-display">
236      <ul class="search_filtered">
237      </ul>
238      <div class="child-card guides no-display">
239      </div>
240      <div class="child-card training no-display">
241      </div>
242    </div>
243    <div class="suggest-card design no-display">
244      <ul class="search_filtered">
245      </ul>
246    </div>
247    <div class="suggest-card distribute no-display">
248      <ul class="search_filtered">
249      </ul>
250    </div>
251  </div>
252
253  </div>
254  <!-- /New Search>
255
256
257          <!-- Expanded quicknav -->
258           <div id="quicknav" class="col-9">
259                <ul>
260                    <li class="design">
261                      <ul>
262                        <li><a href="/design/index.html">Get Started</a></li>
263                        <li><a href="/design/style/index.html">Style</a></li>
264                        <li><a href="/design/patterns/index.html">Patterns</a></li>
265                        <li><a href="/design/building-blocks/index.html">Building Blocks</a></li>
266                        <li><a href="/design/downloads/index.html">Downloads</a></li>
267                        <li><a href="/design/videos/index.html">Videos</a></li>
268                      </ul>
269                    </li>
270                    <li class="develop">
271                      <ul>
272                        <li><a href="/training/index.html"
273                          zh-tw-lang="訓練課程"
274                          zh-cn-lang="培训"
275                          ru-lang="Курсы"
276                          ko-lang="교육"
277                          ja-lang="トレーニング"
278                          es-lang="Capacitación"
279                          >Training</a></li>
280                        <li><a href="/guide/components/index.html"
281                          zh-tw-lang="API 指南"
282                          zh-cn-lang="API 指南"
283                          ru-lang="Руководства по API"
284                          ko-lang="API 가이드"
285                          ja-lang="API ガイド"
286                          es-lang="Guías de la API"
287                          >API Guides</a></li>
288                        <li><a href="/reference/packages.html"
289                          zh-tw-lang="參考資源"
290                          zh-cn-lang="参考"
291                          ru-lang="Справочник"
292                          ko-lang="참조문서"
293                          ja-lang="リファレンス"
294                          es-lang="Referencia"
295                          >Reference</a></li>
296                        <li><a href="/tools/index.html"
297                          zh-tw-lang="相關工具"
298                          zh-cn-lang="工具"
299                          ru-lang="Инструменты"
300                          ko-lang="도구"
301                          ja-lang="ツール"
302                          es-lang="Herramientas"
303                          >Tools</a>
304                          <ul><li><a href="/sdk/index.html">Get the SDK</a></li></ul>
305                        </li>
306                        <li><a href="/google/index.html">Google Services</a>
307                        </li>
308                      </ul>
309                    </li>
310                    <li class="distribute last">
311                      <ul>
312                        <li><a href="/distribute/index.html">Google Play</a></li>
313                        <li><a href="/distribute/googleplay/publish/index.html">Publishing</a></li>
314                        <li><a href="/distribute/googleplay/promote/index.html">Promoting</a></li>
315                        <li><a href="/distribute/googleplay/quality/index.html">App Quality</a></li>
316                        <li><a href="/distribute/googleplay/spotlight/index.html">Spotlight</a></li>
317                        <li><a href="/distribute/open.html">Open Distribution</a></li>
318                      </ul>
319                    </li>
320                </ul>
321          </div>
322          <!-- /Expanded quicknav -->
323        </div>
324    </div>
325    <!-- /Header -->
326
327
328  <div id="searchResults" class="wrap" style="display:none;">
329          <h2 id="searchTitle">Results</h2>
330          <div id="leftSearchControl" class="search-control">Loading...</div>
331  </div>
332
333
334
335    <!-- Secondary x-nav -->
336    <div id="nav-x">
337        <div class="wrap">
338            <ul class="nav-x col-9 develop" style="width:100%">
339                <li class="training"><a href="/training/index.html"
340                  zh-tw-lang="訓練課程"
341                  zh-cn-lang="培训"
342                  ru-lang="Курсы"
343                  ko-lang="교육"
344                  ja-lang="トレーニング"
345                  es-lang="Capacitación"
346                  >Training</a></li>
347                <li class="guide"><a href="/guide/components/index.html"
348                  zh-tw-lang="API 指南"
349                  zh-cn-lang="API 指南"
350                  ru-lang="Руководства по API"
351                  ko-lang="API 가이드"
352                  ja-lang="API ガイド"
353                  es-lang="Guías de la API"
354                  >API Guides</a></li>
355                <li class="reference"><a href="/reference/packages.html"
356                  zh-tw-lang="參考資源"
357                  zh-cn-lang="参考"
358                  ru-lang="Справочник"
359                  ko-lang="참조문서"
360                  ja-lang="リファレンス"
361                  es-lang="Referencia"
362                  >Reference</a></li>
363                <li class="tools"><a href="/tools/index.html"
364                  zh-tw-lang="相關工具"
365                  zh-cn-lang="工具"
366                  ru-lang="Инструменты"
367                  ko-lang="도구"
368                  ja-lang="ツール"
369                  es-lang="Herramientas"
370                  >Tools</a></li>
371                <li class="google"><a href="/google/index.html"
372                  >Google Services</a>
373                </li>
374            </ul>
375        </div>
376
377    </div>
378    <!-- /Sendondary x-nav -->
379
380
381
382
383
384
385
386
387
388  <div class="wrap clearfix" id="body-content">
389    <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
390      <div id="devdoc-nav" class="scroll-pane">
391<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
392
393
394
395<ul id="nav">
396
397  <li class="nav-section">
398    <div class="nav-section-header empty"><a href="/google/index.html">
399          <span class="en">Overview</span>
400      </a></div>
401  </li>
402
403  <li class="nav-section">
404    <div class="nav-section-header empty"><a href="/google/play-services/games.html">
405          <span class="en">Games</span>
406      </a></div>
407  </li>
408  <li class="nav-section">
409    <div class="nav-section-header empty"><a href="/google/play-services/location.html">
410          <span class="en">Location</span>
411      </a></div>
412  </li>
413  <li class="nav-section">
414    <div class="nav-section-header empty"><a href="/google/play-services/plus.html">
415          <span class="en">Google+</span>
416                </a></div>
417  </li>
418  <li class="nav-section">
419    <div class="nav-section-header empty"><a href="/google/play-services/maps.html">
420          <span class="en">Google Maps</span>
421      </a></div>
422  </li>
423  <li class="nav-section">
424    <div class="nav-section-header empty"><a href="/google/play-services/auth.html">
425          <span class="en">Authorization</span>
426      </a></div>
427  </li>
428
429
430
431  <li class="nav-section">
432    <div class="nav-section-header"><a href="/google/play-services/index.html">
433      <span class="en">Google Play Services</span></a>
434    </div>
435    <ul>
436      <li><a href="/google/play-services/setup.html">
437          <span class="en">Setup</span></a>
438      </li>
439      <li id="gms-tree-list" class="nav-section">
440        <div class="nav-section-header">
441          <a href="/reference/gms-packages.html">
442            <span class="en">Reference</span>
443          </a>
444        <div>
445      </li>
446    </ul>
447  </li>
448
449
450  <li class="nav-section">
451    <div class="nav-section-header"><a href="/google/play/billing/index.html">
452      <span class="en">Google Play In-app Billing</span></a>
453    </div>
454    <ul>
455      <li><a href="/google/play/billing/billing_overview.html">
456              <span class="en">Overview</span></a>
457      </li>
458      <li class="nav-section"><div class="nav-section-header"><a href="/google/play/billing/api.html">
459              <span class="en">Version 3 API</span></a></div>
460              <ul>
461              <li><a href="/google/play/billing/billing_integrate.html">
462              <span class="en">Implementing the API</span></a></li>
463              <li><a href="/google/play/billing/billing_reference.html">
464              <span class="en">Reference</span></a></li>
465              </ul>
466      </li>
467      <li class="nav-section"><div class="nav-section-header"><a href="/google/play/billing/v2/api.html">
468              <span class="en">Version 2 API</span></a></div>
469              <ul>
470              <li><a href="/google/play/billing/v2/billing_integrate.html">
471              <span class="en">Implementing the API</span></a></li>
472              <li><a href="/google/play/billing/v2/billing_subscriptions.html">
473              <span class="en">Subscriptions</span></a></li>
474              <li><a href="/google/play/billing/v2/billing_reference.html">
475              <span class="en">Reference</span></a></li>
476              </ul>
477      </li>
478      <li><a href="/google/play/billing/billing_subscriptions.html">
479              <span class="en">Subscriptions</span></a>
480      </li>
481      <li><a href="/google/play/billing/billing_best_practices.html">
482              <span class="en">Security and Design</span></a>
483      </li>
484      <li><a href="/google/play/billing/billing_testing.html">
485              <span class="en">Testing In-app Billing</span></a>
486      </li>
487      <li><a href="/google/play/billing/billing_admin.html">
488              <span class="en">Administering In-app Billing</span></a>
489      </li>
490      <li><a href="/google/play/billing/versions.html">
491              <span class="en">Version Notes</span></a>
492      </li>
493    </ul>
494  </li>
495
496
497
498  <li class="nav-section">
499      <div class="nav-section-header"><a href="/google/gcm/index.html">
500        <span class="en">Google Cloud Messaging</span></a>
501      </div>
502      <ul>
503        <li><a href="/google/gcm/gs.html">
504            <span class="en">Getting Started</span></a>
505        </li>
506        <li><a href="/google/gcm/gcm.html">
507            <span class="en">Architectural Overview</span></a>
508        </li>
509        <li><a href="/google/gcm/demo.html">
510            <span class="en">Demo App Tutorial</span></a>
511        </li>
512        <li><a href="/google/gcm/adv.html">
513            <span class="en">Advanced Topics</span></a>
514        </li>
515        <li><a href="/google/gcm/c2dm.html">
516            <span class="en">Migration</span></a>
517        </li>
518        <li id="gcm-tree-list" class="nav-section">
519          <div class="nav-section-header">
520            <a href="/reference/gcm-packages.html">
521              <span class="en">Reference</span>
522            </a>
523          <div>
524        </li>
525      </ul>
526  </li>
527
528  <li class="nav-section">
529    <div class="nav-section-header"><a href="/google/play/dist.html">
530      <span class="en">Google Play Distribution</span></a>
531    </div>
532    <ul>
533      <li><a href="/google/play/filters.html">
534          <span class="en">Filters on Google Play</span></a>
535      </li>
536
537      <li><a href="/google/play/publishing/multiple-apks.html">
538          <span class="en">Multiple APK Support</span></a>
539      </li>
540      <li><a href="/google/play/expansion-files.html">
541          <span class="en">APK Expansion Files</span></a>
542      </li>
543      <li class="nav-section">
544        <div class="nav-section-header"><a href="/google/play/licensing/index.html">
545          <span class="en">Application Licensing</span></a>
546        </div>
547        <ul>
548          <li><a href="/google/play/licensing/overview.html">
549              <span class="en">Licensing Overview</span></a>
550          </li>
551          <li><a href="/google/play/licensing/setting-up.html">
552              <span class="en">Setting Up for Licensing</span></a>
553          </li>
554          <li><a href="/google/play/licensing/adding-licensing.html">
555              <span class="en">Adding Licensing to Your App</span></a>
556          </li>
557          <li><a href="/google/play/licensing/licensing-reference.html">
558              <span class="en">Licensing Reference</span></a>
559          </li>
560        </ul>
561      </li>
562
563  <li class="nav-section">
564    <div class="nav-section-header"><a href="/google/backup/index.html">
565      Android Backup Service</a>
566    </div>
567    <ul>
568      <li><a href="/google/backup/signup.html">
569          Register</a>
570      </li>
571    </ul>
572  </li>
573
574  </ul>
575
576</li>
577
578
579
580</ul>
581
582<script type="text/javascript">
583<!--
584    buildToggleLists();
585    changeNavLang(getLangPref());
586//-->
587</script>
588
589
590
591
592      </div>
593      <script type="text/javascript">
594       showGoogleRefTree();
595
596      </script>
597    </div> <!-- end side-nav -->
598    <script>
599      $(document).ready(function() {
600        scrollIntoView("devdoc-nav");
601        });
602    </script>
603
604
605
606
607
608
609<div class="col-12"  id="doc-col">
610
611<div id="api-info-block">
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630<div class="sum-details-links">
631
632Summary:
633
634
635
636
637
638
639
640
641
642  <a href="#pubctors">Ctors</a>
643
644
645
646
647  &#124; <a href="#pubmethods">Methods</a>
648
649
650
651
652  &#124; <a href="#inhmethods">Inherited Methods</a>
653
654&#124; <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
655
656</div><!-- end sum-details-links -->
657<div class="api-level">
658
659
660
661
662</div>
663</div><!-- end api-info-block -->
664
665
666<!-- ======== START OF CLASS DATA ======== -->
667
668<div id="jd-header">
669    public
670
671
672
673    class
674<h1 itemprop="name">ActivityRecognitionClient</h1>
675
676
677
678
679    extends Object<br/>
680
681
682
683
684
685
686      implements
687
688        <a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html">GooglePlayServicesClient</a>
689
690
691
692
693
694</div><!-- end header -->
695
696<div id="naMessage"></div>
697
698<div id="jd-content" class="api apilevel-">
699<table class="jd-inheritance-table">
700
701
702    <tr>
703
704        <td colspan="2" class="jd-inheritance-class-cell">java.lang.Object</td>
705    </tr>
706
707
708    <tr>
709
710            <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td>
711
712        <td colspan="1" class="jd-inheritance-class-cell">com.google.android.gms.location.ActivityRecognitionClient</td>
713    </tr>
714
715
716</table>
717
718
719
720
721
722
723
724<div class="jd-descr">
725
726
727<h2>Class Overview</h2>
728<p itemprop="articleBody">The main entry point for activity recognition integration.
729 <p>
730 The activity recognition service is a low power mechanism that allows
731 application to receive periodic updates of detected user activities. For
732 example, it can detect if the user is currently on foot, in a car, on a
733 bicycle or still.
734 <p>
735 The activities are detected by periodically waking up the device and reading
736 short bursts of sensor data. It only makes use of low power sensors in order
737 to keep the power usage to a minimum.
738 <p>
739 To request activity recognition, do the following in a class that implements
740 <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a></code> and
741 <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a></code>:
742 <pre class="prettyprint">
743  // Connect to the ActivityRecognitionService
744 ActivityRecognitionClient mActivityRecognitionClient =
745         new ActivityRecognitionClient(this, this, this);
746 mActivityRecognitionClient.connect();
747
748  // Called when a connection to the ActivityRecognitionService has been established.
749 public void onConnected(Bundle connectionHint) {
750     Intent intent = new Intent(this, MyIntentService.class);
751     PendingIntent callbackIntent = PendingIntent.getService(this, 0, intent,
752             PendingIntent.FLAG_UPDATE_CURRENT);
753     mActivityRecognitionClient.requestActivityUpdates(30000, callbackIntent);
754 }
755 </pre>
756 To receive activity detections, put the following in a class that extends <code><a href="/reference/android/app/IntentService.html">IntentService</a></code>:
757 <pre class="prettyprint">
758 protected void onHandleIntent(Intent intent) {
759     if (ActivityRecognitionResult.hasResult(intent)) {
760         ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
761         // Put your application specific logic here (i.e. result.getMostProbableActivity())
762     }
763 }</pre>
764 <p>
765 Use of the <code><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html">ActivityRecognitionClient</a></code> requires the
766 com.google.android.gms.permission.ACTIVITY_RECOGNITION permission.
767</p>
768
769
770
771
772
773</div><!-- jd-descr -->
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790<div class="jd-descr">
791
792
793<h2>Summary</h2>
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817<!-- ======== CONSTRUCTOR SUMMARY ======== -->
818<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
819
820
821
822
823    <tr class="alt-color api apilevel-" >
824        <td class="jd-typecol"><nobr>
825
826
827
828
829
830            </nobr>
831        </td>
832        <td class="jd-linkcol" width="100%"><nobr>
833        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#ActivityRecognitionClient(android.content.Context, com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks, com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">ActivityRecognitionClient</a></span>(Context context, <a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> connectedListener, <a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> connectionFailedListener)</nobr>
834
835        <div class="jd-descrdiv">Creates a <code><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html">ActivityRecognitionClient</a></code>.</div>
836
837  </td></tr>
838
839
840
841</table>
842
843
844
845
846
847
848<!-- ========== METHOD SUMMARY =========== -->
849<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
850
851
852
853
854    <tr class="alt-color api apilevel-" >
855        <td class="jd-typecol"><nobr>
856
857
858
859
860
861            void</nobr>
862        </td>
863        <td class="jd-linkcol" width="100%"><nobr>
864        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#connect()">connect</a></span>()</nobr>
865
866        <div class="jd-descrdiv">Connects the client to Google Play services.</div>
867
868  </td></tr>
869
870
871
872    <tr class=" api apilevel-" >
873        <td class="jd-typecol"><nobr>
874
875
876
877
878
879            void</nobr>
880        </td>
881        <td class="jd-linkcol" width="100%"><nobr>
882        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#disconnect()">disconnect</a></span>()</nobr>
883
884        <div class="jd-descrdiv">Closes the connection to Google Play services.</div>
885
886  </td></tr>
887
888
889
890    <tr class="alt-color api apilevel-" >
891        <td class="jd-typecol"><nobr>
892
893
894
895
896
897            boolean</nobr>
898        </td>
899        <td class="jd-linkcol" width="100%"><nobr>
900        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#isConnected()">isConnected</a></span>()</nobr>
901
902        <div class="jd-descrdiv">Checks if the client is currently connected to the service, so that
903 requests to other methods will succeed.</div>
904
905  </td></tr>
906
907
908
909    <tr class=" api apilevel-" >
910        <td class="jd-typecol"><nobr>
911
912
913
914
915
916            boolean</nobr>
917        </td>
918        <td class="jd-linkcol" width="100%"><nobr>
919        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#isConnecting()">isConnecting</a></span>()</nobr>
920
921        <div class="jd-descrdiv">Checks if the client is attempting to connect to the service.</div>
922
923  </td></tr>
924
925
926
927    <tr class="alt-color api apilevel-" >
928        <td class="jd-typecol"><nobr>
929
930
931
932
933
934            boolean</nobr>
935        </td>
936        <td class="jd-linkcol" width="100%"><nobr>
937        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#isConnectionCallbacksRegistered(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">isConnectionCallbacksRegistered</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</nobr>
938
939        <div class="jd-descrdiv">Returns true if the specified listener is currently registered to
940 receive connection events.</div>
941
942  </td></tr>
943
944
945
946    <tr class=" api apilevel-" >
947        <td class="jd-typecol"><nobr>
948
949
950
951
952
953            boolean</nobr>
954        </td>
955        <td class="jd-linkcol" width="100%"><nobr>
956        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#isConnectionFailedListenerRegistered(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">isConnectionFailedListenerRegistered</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</nobr>
957
958        <div class="jd-descrdiv">Returns true if the specified listener is currently registered to
959 receive connection failed events.</div>
960
961  </td></tr>
962
963
964
965    <tr class="alt-color api apilevel-" >
966        <td class="jd-typecol"><nobr>
967
968
969
970
971
972            void</nobr>
973        </td>
974        <td class="jd-linkcol" width="100%"><nobr>
975        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#registerConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">registerConnectionCallbacks</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</nobr>
976
977        <div class="jd-descrdiv">Registers a listener to receive connection events from this <code>GooglePlayServicesClient</code>.</div>
978
979  </td></tr>
980
981
982
983    <tr class=" api apilevel-" >
984        <td class="jd-typecol"><nobr>
985
986
987
988
989
990            void</nobr>
991        </td>
992        <td class="jd-linkcol" width="100%"><nobr>
993        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#registerConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">registerConnectionFailedListener</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</nobr>
994
995        <div class="jd-descrdiv">Registers a listener to receive connection failed events from this
996 <code>GooglePlayServicesClient</code>.</div>
997
998  </td></tr>
999
1000
1001
1002    <tr class="alt-color api apilevel-" >
1003        <td class="jd-typecol"><nobr>
1004
1005
1006
1007
1008
1009            void</nobr>
1010        </td>
1011        <td class="jd-linkcol" width="100%"><nobr>
1012        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#removeActivityUpdates(android.app.PendingIntent)">removeActivityUpdates</a></span>(PendingIntent callbackIntent)</nobr>
1013
1014        <div class="jd-descrdiv">Removes all activity updates for the specified PendingIntent.</div>
1015
1016  </td></tr>
1017
1018
1019
1020    <tr class=" api apilevel-" >
1021        <td class="jd-typecol"><nobr>
1022
1023
1024
1025
1026
1027            void</nobr>
1028        </td>
1029        <td class="jd-linkcol" width="100%"><nobr>
1030        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#requestActivityUpdates(long, android.app.PendingIntent)">requestActivityUpdates</a></span>(long detectionIntervalMillis, PendingIntent callbackIntent)</nobr>
1031
1032        <div class="jd-descrdiv">Register for activity recognition updates.</div>
1033
1034  </td></tr>
1035
1036
1037
1038    <tr class="alt-color api apilevel-" >
1039        <td class="jd-typecol"><nobr>
1040
1041
1042
1043
1044
1045            void</nobr>
1046        </td>
1047        <td class="jd-linkcol" width="100%"><nobr>
1048        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#unregisterConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">unregisterConnectionCallbacks</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</nobr>
1049
1050        <div class="jd-descrdiv">Removes a connection listener from this <code>GooglePlayServicesClient</code>.</div>
1051
1052  </td></tr>
1053
1054
1055
1056    <tr class=" api apilevel-" >
1057        <td class="jd-typecol"><nobr>
1058
1059
1060
1061
1062
1063            void</nobr>
1064        </td>
1065        <td class="jd-linkcol" width="100%"><nobr>
1066        <span class="sympad"><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#unregisterConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">unregisterConnectionFailedListener</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</nobr>
1067
1068        <div class="jd-descrdiv">Removes a connection failed listener from the <code>GooglePlayServicesClient</code>.</div>
1069
1070  </td></tr>
1071
1072
1073
1074</table>
1075
1076
1077
1078
1079
1080
1081
1082<!-- ========== METHOD SUMMARY =========== -->
1083<table id="inhmethods" class="jd-sumtable"><tr><th>
1084  <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
1085  <div style="clear:left;">Inherited Methods</div></th></tr>
1086
1087
1088<tr class="api apilevel-" >
1089<td colspan="12">
1090  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
1091          ><img id="inherited-methods-java.lang.Object-trigger"
1092          src="/assets/images/triangle-closed.png"
1093          class="jd-expando-trigger-img" /></a>
1094From class
1095
1096  java.lang.Object
1097
1098<div id="inherited-methods-java.lang.Object">
1099  <div id="inherited-methods-java.lang.Object-list"
1100        class="jd-inheritedlinks">
1101  </div>
1102  <div id="inherited-methods-java.lang.Object-summary" style="display: none;">
1103    <table class="jd-sumtable-expando">
1104
1105
1106
1107
1108    <tr class="alt-color api apilevel-" >
1109        <td class="jd-typecol"><nobr>
1110
1111
1112
1113
1114
1115            Object</nobr>
1116        </td>
1117        <td class="jd-linkcol" width="100%"><nobr>
1118        <span class="sympad">clone</span>()</nobr>
1119
1120  </td></tr>
1121
1122
1123
1124    <tr class=" api apilevel-" >
1125        <td class="jd-typecol"><nobr>
1126
1127
1128
1129
1130
1131            boolean</nobr>
1132        </td>
1133        <td class="jd-linkcol" width="100%"><nobr>
1134        <span class="sympad">equals</span>(Object arg0)</nobr>
1135
1136  </td></tr>
1137
1138
1139
1140    <tr class="alt-color api apilevel-" >
1141        <td class="jd-typecol"><nobr>
1142
1143
1144
1145
1146
1147            void</nobr>
1148        </td>
1149        <td class="jd-linkcol" width="100%"><nobr>
1150        <span class="sympad">finalize</span>()</nobr>
1151
1152  </td></tr>
1153
1154
1155
1156    <tr class=" api apilevel-" >
1157        <td class="jd-typecol"><nobr>
1158
1159
1160            final
1161
1162
1163            Class&lt;?&gt;</nobr>
1164        </td>
1165        <td class="jd-linkcol" width="100%"><nobr>
1166        <span class="sympad">getClass</span>()</nobr>
1167
1168  </td></tr>
1169
1170
1171
1172    <tr class="alt-color api apilevel-" >
1173        <td class="jd-typecol"><nobr>
1174
1175
1176
1177
1178
1179            int</nobr>
1180        </td>
1181        <td class="jd-linkcol" width="100%"><nobr>
1182        <span class="sympad">hashCode</span>()</nobr>
1183
1184  </td></tr>
1185
1186
1187
1188    <tr class=" api apilevel-" >
1189        <td class="jd-typecol"><nobr>
1190
1191
1192            final
1193
1194
1195            void</nobr>
1196        </td>
1197        <td class="jd-linkcol" width="100%"><nobr>
1198        <span class="sympad">notify</span>()</nobr>
1199
1200  </td></tr>
1201
1202
1203
1204    <tr class="alt-color api apilevel-" >
1205        <td class="jd-typecol"><nobr>
1206
1207
1208            final
1209
1210
1211            void</nobr>
1212        </td>
1213        <td class="jd-linkcol" width="100%"><nobr>
1214        <span class="sympad">notifyAll</span>()</nobr>
1215
1216  </td></tr>
1217
1218
1219
1220    <tr class=" api apilevel-" >
1221        <td class="jd-typecol"><nobr>
1222
1223
1224
1225
1226
1227            String</nobr>
1228        </td>
1229        <td class="jd-linkcol" width="100%"><nobr>
1230        <span class="sympad">toString</span>()</nobr>
1231
1232  </td></tr>
1233
1234
1235
1236    <tr class="alt-color api apilevel-" >
1237        <td class="jd-typecol"><nobr>
1238
1239
1240            final
1241
1242
1243            void</nobr>
1244        </td>
1245        <td class="jd-linkcol" width="100%"><nobr>
1246        <span class="sympad">wait</span>()</nobr>
1247
1248  </td></tr>
1249
1250
1251
1252    <tr class=" api apilevel-" >
1253        <td class="jd-typecol"><nobr>
1254
1255
1256            final
1257
1258
1259            void</nobr>
1260        </td>
1261        <td class="jd-linkcol" width="100%"><nobr>
1262        <span class="sympad">wait</span>(long arg0, int arg1)</nobr>
1263
1264  </td></tr>
1265
1266
1267
1268    <tr class="alt-color api apilevel-" >
1269        <td class="jd-typecol"><nobr>
1270
1271
1272            final
1273
1274
1275            void</nobr>
1276        </td>
1277        <td class="jd-linkcol" width="100%"><nobr>
1278        <span class="sympad">wait</span>(long arg0)</nobr>
1279
1280  </td></tr>
1281
1282
1283</table>
1284  </div>
1285</div>
1286</td></tr>
1287
1288
1289
1290<tr class="api apilevel-" >
1291<td colspan="12">
1292  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-com.google.android.gms.common.GooglePlayServicesClient" class="jd-expando-trigger closed"
1293          ><img id="inherited-methods-com.google.android.gms.common.GooglePlayServicesClient-trigger"
1294          src="/assets/images/triangle-closed.png"
1295          class="jd-expando-trigger-img" /></a>
1296From interface
1297
1298  <a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html">com.google.android.gms.common.GooglePlayServicesClient</a>
1299
1300<div id="inherited-methods-com.google.android.gms.common.GooglePlayServicesClient">
1301  <div id="inherited-methods-com.google.android.gms.common.GooglePlayServicesClient-list"
1302        class="jd-inheritedlinks">
1303  </div>
1304  <div id="inherited-methods-com.google.android.gms.common.GooglePlayServicesClient-summary" style="display: none;">
1305    <table class="jd-sumtable-expando">
1306
1307
1308
1309
1310    <tr class="alt-color api apilevel-" >
1311        <td class="jd-typecol"><nobr>
1312            abstract
1313
1314
1315
1316
1317            void</nobr>
1318        </td>
1319        <td class="jd-linkcol" width="100%"><nobr>
1320        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#connect()">connect</a></span>()</nobr>
1321
1322        <div class="jd-descrdiv">Connects the client to Google Play services.</div>
1323
1324  </td></tr>
1325
1326
1327
1328    <tr class=" api apilevel-" >
1329        <td class="jd-typecol"><nobr>
1330            abstract
1331
1332
1333
1334
1335            void</nobr>
1336        </td>
1337        <td class="jd-linkcol" width="100%"><nobr>
1338        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#disconnect()">disconnect</a></span>()</nobr>
1339
1340        <div class="jd-descrdiv">Closes the connection to Google Play services.</div>
1341
1342  </td></tr>
1343
1344
1345
1346    <tr class="alt-color api apilevel-" >
1347        <td class="jd-typecol"><nobr>
1348            abstract
1349
1350
1351
1352
1353            boolean</nobr>
1354        </td>
1355        <td class="jd-linkcol" width="100%"><nobr>
1356        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#isConnected()">isConnected</a></span>()</nobr>
1357
1358        <div class="jd-descrdiv">Checks if the client is currently connected to the service, so that
1359 requests to other methods will succeed.</div>
1360
1361  </td></tr>
1362
1363
1364
1365    <tr class=" api apilevel-" >
1366        <td class="jd-typecol"><nobr>
1367            abstract
1368
1369
1370
1371
1372            boolean</nobr>
1373        </td>
1374        <td class="jd-linkcol" width="100%"><nobr>
1375        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#isConnecting()">isConnecting</a></span>()</nobr>
1376
1377        <div class="jd-descrdiv">Checks if the client is attempting to connect to the service.</div>
1378
1379  </td></tr>
1380
1381
1382
1383    <tr class="alt-color api apilevel-" >
1384        <td class="jd-typecol"><nobr>
1385            abstract
1386
1387
1388
1389
1390            boolean</nobr>
1391        </td>
1392        <td class="jd-linkcol" width="100%"><nobr>
1393        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#isConnectionCallbacksRegistered(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">isConnectionCallbacksRegistered</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</nobr>
1394
1395        <div class="jd-descrdiv">Returns true if the specified listener is currently registered to
1396 receive connection events.</div>
1397
1398  </td></tr>
1399
1400
1401
1402    <tr class=" api apilevel-" >
1403        <td class="jd-typecol"><nobr>
1404            abstract
1405
1406
1407
1408
1409            boolean</nobr>
1410        </td>
1411        <td class="jd-linkcol" width="100%"><nobr>
1412        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#isConnectionFailedListenerRegistered(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">isConnectionFailedListenerRegistered</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</nobr>
1413
1414        <div class="jd-descrdiv">Returns true if the specified listener is currently registered to
1415 receive connection failed events.</div>
1416
1417  </td></tr>
1418
1419
1420
1421    <tr class="alt-color api apilevel-" >
1422        <td class="jd-typecol"><nobr>
1423            abstract
1424
1425
1426
1427
1428            void</nobr>
1429        </td>
1430        <td class="jd-linkcol" width="100%"><nobr>
1431        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#registerConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">registerConnectionCallbacks</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</nobr>
1432
1433        <div class="jd-descrdiv">Registers a listener to receive connection events from this <code>GooglePlayServicesClient</code>.</div>
1434
1435  </td></tr>
1436
1437
1438
1439    <tr class=" api apilevel-" >
1440        <td class="jd-typecol"><nobr>
1441            abstract
1442
1443
1444
1445
1446            void</nobr>
1447        </td>
1448        <td class="jd-linkcol" width="100%"><nobr>
1449        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#registerConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">registerConnectionFailedListener</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</nobr>
1450
1451        <div class="jd-descrdiv">Registers a listener to receive connection failed events from this
1452 <code>GooglePlayServicesClient</code>.</div>
1453
1454  </td></tr>
1455
1456
1457
1458    <tr class="alt-color api apilevel-" >
1459        <td class="jd-typecol"><nobr>
1460            abstract
1461
1462
1463
1464
1465            void</nobr>
1466        </td>
1467        <td class="jd-linkcol" width="100%"><nobr>
1468        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#unregisterConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">unregisterConnectionCallbacks</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</nobr>
1469
1470        <div class="jd-descrdiv">Removes a connection listener from this <code>GooglePlayServicesClient</code>.</div>
1471
1472  </td></tr>
1473
1474
1475
1476    <tr class=" api apilevel-" >
1477        <td class="jd-typecol"><nobr>
1478            abstract
1479
1480
1481
1482
1483            void</nobr>
1484        </td>
1485        <td class="jd-linkcol" width="100%"><nobr>
1486        <span class="sympad"><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#unregisterConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">unregisterConnectionFailedListener</a></span>(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</nobr>
1487
1488        <div class="jd-descrdiv">Removes a connection failed listener from the <code>GooglePlayServicesClient</code>.</div>
1489
1490  </td></tr>
1491
1492
1493</table>
1494  </div>
1495</div>
1496</td></tr>
1497
1498
1499</table>
1500
1501
1502</div><!-- jd-descr (summary) -->
1503
1504<!-- Details -->
1505
1506
1507
1508
1509
1510
1511
1512
1513<!-- XML Attributes -->
1514
1515
1516<!-- Enum Values -->
1517
1518
1519<!-- Constants -->
1520
1521
1522<!-- Fields -->
1523
1524
1525<!-- Public ctors -->
1526
1527
1528<!-- ========= CONSTRUCTOR DETAIL ======== -->
1529<h2>Public Constructors</h2>
1530
1531
1532
1533<A NAME="ActivityRecognitionClient(android.content.Context, com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks, com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)"></A>
1534
1535<div class="jd-details api apilevel-">
1536    <h4 class="jd-details-title">
1537      <span class="normal">
1538        public
1539
1540
1541
1542
1543
1544      </span>
1545      <span class="sympad">ActivityRecognitionClient</span>
1546      <span class="normal">(Context context, <a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> connectedListener, <a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> connectionFailedListener)</span>
1547    </h4>
1548      <div class="api-level">
1549        <div></div>
1550
1551
1552
1553      </div>
1554    <div class="jd-details-descr">
1555
1556  <div class="jd-tagdata jd-tagdescr"><p>Creates a <code><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html">ActivityRecognitionClient</a></code>.</p></div>
1557  <div class="jd-tagdata">
1558      <h5 class="jd-tagtitle">Parameters</h5>
1559      <table class="jd-tagtable">
1560        <tr>
1561          <th>context</td>
1562          <td>The context to use for the connection.</td>
1563        </tr>
1564        <tr>
1565          <th>connectedListener</td>
1566          <td>The callbacks invoked when the client is
1567            connected.</td>
1568        </tr>
1569        <tr>
1570          <th>connectionFailedListener</td>
1571          <td>The listener which will be notified if
1572            the connection attempt fails.
1573</td>
1574        </tr>
1575      </table>
1576  </div>
1577
1578    </div>
1579</div>
1580
1581
1582
1583
1584
1585<!-- ========= CONSTRUCTOR DETAIL ======== -->
1586<!-- Protected ctors -->
1587
1588
1589
1590<!-- ========= METHOD DETAIL ======== -->
1591<!-- Public methdos -->
1592
1593<h2>Public Methods</h2>
1594
1595
1596
1597<A NAME="connect()"></A>
1598
1599<div class="jd-details api apilevel-">
1600    <h4 class="jd-details-title">
1601      <span class="normal">
1602        public
1603
1604
1605
1606
1607        void
1608      </span>
1609      <span class="sympad">connect</span>
1610      <span class="normal">()</span>
1611    </h4>
1612      <div class="api-level">
1613        <div></div>
1614
1615
1616
1617      </div>
1618    <div class="jd-details-descr">
1619
1620  <div class="jd-tagdata jd-tagdescr"><p>Connects the client to Google Play services. This method returns immediately, and connects to
1621 the service in the background. If the connection is successful,
1622 <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)">onConnected(Bundle)</a></code> is called. On a
1623 failure, <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)">onConnectionFailed(ConnectionResult)</a></code> is called.
1624</p></div>
1625
1626    </div>
1627</div>
1628
1629
1630<A NAME="disconnect()"></A>
1631
1632<div class="jd-details api apilevel-">
1633    <h4 class="jd-details-title">
1634      <span class="normal">
1635        public
1636
1637
1638
1639
1640        void
1641      </span>
1642      <span class="sympad">disconnect</span>
1643      <span class="normal">()</span>
1644    </h4>
1645      <div class="api-level">
1646        <div></div>
1647
1648
1649
1650      </div>
1651    <div class="jd-details-descr">
1652
1653  <div class="jd-tagdata jd-tagdescr"><p>Closes the connection to Google Play services. No calls can be made on this object
1654 after calling this method.</p></div>
1655
1656    </div>
1657</div>
1658
1659
1660<A NAME="isConnected()"></A>
1661
1662<div class="jd-details api apilevel-">
1663    <h4 class="jd-details-title">
1664      <span class="normal">
1665        public
1666
1667
1668
1669
1670        boolean
1671      </span>
1672      <span class="sympad">isConnected</span>
1673      <span class="normal">()</span>
1674    </h4>
1675      <div class="api-level">
1676        <div></div>
1677
1678
1679
1680      </div>
1681    <div class="jd-details-descr">
1682
1683  <div class="jd-tagdata jd-tagdescr"><p>Checks if the client is currently connected to the service, so that
1684 requests to other methods will succeed.  Applications should guard
1685 client actions caused by the user with a call to this method.</p></div>
1686  <div class="jd-tagdata">
1687      <h5 class="jd-tagtitle">Returns</h5>
1688      <ul class="nolist"><li>true If the client is connected to the service.
1689</li></ul>
1690  </div>
1691
1692    </div>
1693</div>
1694
1695
1696<A NAME="isConnecting()"></A>
1697
1698<div class="jd-details api apilevel-">
1699    <h4 class="jd-details-title">
1700      <span class="normal">
1701        public
1702
1703
1704
1705
1706        boolean
1707      </span>
1708      <span class="sympad">isConnecting</span>
1709      <span class="normal">()</span>
1710    </h4>
1711      <div class="api-level">
1712        <div></div>
1713
1714
1715
1716      </div>
1717    <div class="jd-details-descr">
1718
1719  <div class="jd-tagdata jd-tagdescr"><p>Checks if the client is attempting to connect to the service.</p></div>
1720  <div class="jd-tagdata">
1721      <h5 class="jd-tagtitle">Returns</h5>
1722      <ul class="nolist"><li>true If the client is attempting to connect to the service.
1723</li></ul>
1724  </div>
1725
1726    </div>
1727</div>
1728
1729
1730<A NAME="isConnectionCallbacksRegistered(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)"></A>
1731
1732<div class="jd-details api apilevel-">
1733    <h4 class="jd-details-title">
1734      <span class="normal">
1735        public
1736
1737
1738
1739
1740        boolean
1741      </span>
1742      <span class="sympad">isConnectionCallbacksRegistered</span>
1743      <span class="normal">(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</span>
1744    </h4>
1745      <div class="api-level">
1746        <div></div>
1747
1748
1749
1750      </div>
1751    <div class="jd-details-descr">
1752
1753  <div class="jd-tagdata jd-tagdescr"><p>Returns true if the specified listener is currently registered to
1754 receive connection events.</p></div>
1755  <div class="jd-tagdata">
1756      <h5 class="jd-tagtitle">Parameters</h5>
1757      <table class="jd-tagtable">
1758        <tr>
1759          <th>listener</td>
1760          <td>The listener to check for.</td>
1761        </tr>
1762      </table>
1763  </div>
1764  <div class="jd-tagdata">
1765      <h5 class="jd-tagtitle">Returns</h5>
1766      <ul class="nolist"><li>true If the specified listener is currently registered to receive connection
1767             events.</li></ul>
1768  </div>
1769
1770    </div>
1771</div>
1772
1773
1774<A NAME="isConnectionFailedListenerRegistered(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)"></A>
1775
1776<div class="jd-details api apilevel-">
1777    <h4 class="jd-details-title">
1778      <span class="normal">
1779        public
1780
1781
1782
1783
1784        boolean
1785      </span>
1786      <span class="sympad">isConnectionFailedListenerRegistered</span>
1787      <span class="normal">(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</span>
1788    </h4>
1789      <div class="api-level">
1790        <div></div>
1791
1792
1793
1794      </div>
1795    <div class="jd-details-descr">
1796
1797  <div class="jd-tagdata jd-tagdescr"><p>Returns true if the specified listener is currently registered to
1798 receive connection failed events.</p></div>
1799  <div class="jd-tagdata">
1800      <h5 class="jd-tagtitle">Parameters</h5>
1801      <table class="jd-tagtable">
1802        <tr>
1803          <th>listener</td>
1804          <td>The listener to check for.</td>
1805        </tr>
1806      </table>
1807  </div>
1808  <div class="jd-tagdata">
1809      <h5 class="jd-tagtitle">Returns</h5>
1810      <ul class="nolist"><li>true If the specified listener is currently registered to receive connection
1811             failed events.</li></ul>
1812  </div>
1813
1814    </div>
1815</div>
1816
1817
1818<A NAME="registerConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)"></A>
1819
1820<div class="jd-details api apilevel-">
1821    <h4 class="jd-details-title">
1822      <span class="normal">
1823        public
1824
1825
1826
1827
1828        void
1829      </span>
1830      <span class="sympad">registerConnectionCallbacks</span>
1831      <span class="normal">(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</span>
1832    </h4>
1833      <div class="api-level">
1834        <div></div>
1835
1836
1837
1838      </div>
1839    <div class="jd-details-descr">
1840
1841  <div class="jd-tagdata jd-tagdescr"><p>Registers a listener to receive connection events from this <code>GooglePlayServicesClient</code>.
1842 If we are already connected, the listener's <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)">onConnected(Bundle)</a></code> method
1843 will be called immediately.  Applications should balance calls to this method with calls to
1844 <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#unregisterConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">unregisterConnectionCallbacks(ConnectionCallbacks)</a></code> to avoid leaking resources.
1845 <p>
1846 If the specified listener is already registered to receive connection events, this
1847 method will not add a duplicate entry for the same listener, but <strong>will</strong>
1848 still call the listener's <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)">onConnected(Bundle)</a></code> method if currently
1849 connected.
1850 <p>
1851 Note that the order of messages received here may not be stable, so clients should not rely
1852 on the order that multiple listeners receive events in.</p></div>
1853  <div class="jd-tagdata">
1854      <h5 class="jd-tagtitle">Parameters</h5>
1855      <table class="jd-tagtable">
1856        <tr>
1857          <th>listener</td>
1858          <td>the listener where the results of the asynchronous <code><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#connect()">connect()</a></code> call are
1859            delivered.
1860</td>
1861        </tr>
1862      </table>
1863  </div>
1864
1865    </div>
1866</div>
1867
1868
1869<A NAME="registerConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)"></A>
1870
1871<div class="jd-details api apilevel-">
1872    <h4 class="jd-details-title">
1873      <span class="normal">
1874        public
1875
1876
1877
1878
1879        void
1880      </span>
1881      <span class="sympad">registerConnectionFailedListener</span>
1882      <span class="normal">(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</span>
1883    </h4>
1884      <div class="api-level">
1885        <div></div>
1886
1887
1888
1889      </div>
1890    <div class="jd-details-descr">
1891
1892  <div class="jd-tagdata jd-tagdescr"><p>Registers a listener to receive connection failed events from this
1893 <code>GooglePlayServicesClient</code>. Unlike <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#registerConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)">registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks)</a></code>, if we are not
1894 already connected, the listener's <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)">onConnectionFailed(ConnectionResult)</a></code>
1895 method will not be called immediately.  Applications should balance calls to this method with
1896 calls to <code><a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.html#unregisterConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)">unregisterConnectionFailedListener(OnConnectionFailedListener)</a></code> to avoid
1897 leaking resources.
1898 <p>
1899 If the specified listener is already registered to receive connection failed events, this
1900 method will not add a duplicate entry for the same listener.
1901 <p>
1902 Note that the order of messages received here may not be stable, so clients should not rely
1903 on the order that multiple listeners receive events in.</p></div>
1904  <div class="jd-tagdata">
1905      <h5 class="jd-tagtitle">Parameters</h5>
1906      <table class="jd-tagtable">
1907        <tr>
1908          <th>listener</td>
1909          <td>the listener where the results of the asynchronous <code><a href="/reference/com/google/android/gms/location/ActivityRecognitionClient.html#connect()">connect()</a></code> call are
1910            delivered.
1911</td>
1912        </tr>
1913      </table>
1914  </div>
1915
1916    </div>
1917</div>
1918
1919
1920<A NAME="removeActivityUpdates(android.app.PendingIntent)"></A>
1921
1922<div class="jd-details api apilevel-">
1923    <h4 class="jd-details-title">
1924      <span class="normal">
1925        public
1926
1927
1928
1929
1930        void
1931      </span>
1932      <span class="sympad">removeActivityUpdates</span>
1933      <span class="normal">(PendingIntent callbackIntent)</span>
1934    </h4>
1935      <div class="api-level">
1936        <div></div>
1937
1938
1939
1940      </div>
1941    <div class="jd-details-descr">
1942
1943  <div class="jd-tagdata jd-tagdescr"><p>Removes all activity updates for the specified PendingIntent.
1944 <p>
1945 Calling this function requires the
1946 com.google.android.gms.permission.ACTIVITY_RECOGNITION permission.</p></div>
1947  <div class="jd-tagdata">
1948      <h5 class="jd-tagtitle">Parameters</h5>
1949      <table class="jd-tagtable">
1950        <tr>
1951          <th>callbackIntent</td>
1952          <td>pending intent object that no longer needs activity
1953            detection updates</td>
1954        </tr>
1955      </table>
1956  </div>
1957  <div class="jd-tagdata">
1958      <h5 class="jd-tagtitle">Throws</h5>
1959      <table class="jd-tagtable">
1960        <tr>
1961            <th>IllegalStateException</td>
1962            <td>if this method was called at an
1963             inappropriate time, such as before the LocationServiceClient
1964             has bound to the remote service.
1965</td>
1966        </tr>
1967      </table>
1968  </div>
1969
1970    </div>
1971</div>
1972
1973
1974<A NAME="requestActivityUpdates(long, android.app.PendingIntent)"></A>
1975
1976<div class="jd-details api apilevel-">
1977    <h4 class="jd-details-title">
1978      <span class="normal">
1979        public
1980
1981
1982
1983
1984        void
1985      </span>
1986      <span class="sympad">requestActivityUpdates</span>
1987      <span class="normal">(long detectionIntervalMillis, PendingIntent callbackIntent)</span>
1988    </h4>
1989      <div class="api-level">
1990        <div></div>
1991
1992
1993
1994      </div>
1995    <div class="jd-details-descr">
1996
1997  <div class="jd-tagdata jd-tagdescr"><p>Register for activity recognition updates.
1998 <p>
1999 The activities are detected by periodically waking up the device and
2000 reading short bursts of sensor data. It only makes use of low power
2001 sensors in order to keep the power usage to a minimum. For example, it
2002 can detect if the user is currently on foot, in a car, on a bicycle or
2003 still. See <code><a href="/reference/com/google/android/gms/location/DetectedActivity.html">DetectedActivity</a></code> for more details.
2004 <p>
2005 The activity detection update interval can be controlled with the
2006 detectionIntervalMillis parameter. Larger values will result in fewer
2007 activity detections while improving battery life. Smaller values will
2008 result in more frequent activity detections but will consume more power
2009 since the device must be woken up more frequently.
2010 <p>
2011 Activities may be received more frequently than the
2012 detectionIntervalMillis parameter if another application has also
2013 requested activity updates at a faster rate. It may also receive updates
2014 faster when the activity detection service receives a signal that the
2015 current activity may change, such as if the device has been still for a
2016 long period of time and is then unplugged from a phone charger.
2017 <p>
2018 Activities may arrive several seconds after the requested
2019 detectionIntervalMillis if the activity detection service requires more
2020 samples to make a more accurate prediction.
2021 <p>
2022 A common use case is that an application wants to monitor activities in
2023 the background and perform an action when a specific activity is
2024 detected. To do this without needing a service that is always on in the
2025 background consuming resources, detected activities are delivered via an
2026 intent. The application specifies a PendingIntent callback (typically an
2027 IntentService) which will be called when activities are detected. See the
2028 documentation of <code><a href="/reference/android/app/PendingIntent.html">PendingIntent</a></code> for more details.
2029 <p>
2030 Applications can call this function several times in a row with the same
2031 callbackIntent to change the desired activity detection interval.
2032 <p>
2033 Calling this function requires the
2034 com.google.android.gms.permission.ACTIVITY_RECOGNITION permission.</p></div>
2035  <div class="jd-tagdata">
2036      <h5 class="jd-tagtitle">Parameters</h5>
2037      <table class="jd-tagtable">
2038        <tr>
2039          <th>detectionIntervalMillis</td>
2040          <td>the desired time between activity
2041            detections. Larger values will result in fewer activity
2042            detections while improving battery life. A value of 0 will
2043            result in activity detections at the fastest possible rate.</td>
2044        </tr>
2045        <tr>
2046          <th>callbackIntent</td>
2047          <td>a PendingIntent to be sent for each activity
2048            detection.</td>
2049        </tr>
2050      </table>
2051  </div>
2052  <div class="jd-tagdata">
2053      <h5 class="jd-tagtitle">Throws</h5>
2054      <table class="jd-tagtable">
2055        <tr>
2056            <th>IllegalStateException</td>
2057            <td>if this method was called at an
2058             inappropriate time, such as before the LocationServiceClient
2059             has bound to the remote service.
2060</td>
2061        </tr>
2062      </table>
2063  </div>
2064
2065    </div>
2066</div>
2067
2068
2069<A NAME="unregisterConnectionCallbacks(com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks)"></A>
2070
2071<div class="jd-details api apilevel-">
2072    <h4 class="jd-details-title">
2073      <span class="normal">
2074        public
2075
2076
2077
2078
2079        void
2080      </span>
2081      <span class="sympad">unregisterConnectionCallbacks</span>
2082      <span class="normal">(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html">GooglePlayServicesClient.ConnectionCallbacks</a> listener)</span>
2083    </h4>
2084      <div class="api-level">
2085        <div></div>
2086
2087
2088
2089      </div>
2090    <div class="jd-details-descr">
2091
2092  <div class="jd-tagdata jd-tagdescr"><p>Removes a connection listener from this <code>GooglePlayServicesClient</code>. Note that removing
2093 a listener does not generate any callbacks.
2094 <p>
2095 If the specified listener is not currently registered to receive connection events, this
2096 method will have no effect.</p></div>
2097  <div class="jd-tagdata">
2098      <h5 class="jd-tagtitle">Parameters</h5>
2099      <table class="jd-tagtable">
2100        <tr>
2101          <th>listener</td>
2102          <td>the listener to unregister.
2103</td>
2104        </tr>
2105      </table>
2106  </div>
2107
2108    </div>
2109</div>
2110
2111
2112<A NAME="unregisterConnectionFailedListener(com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener)"></A>
2113
2114<div class="jd-details api apilevel-">
2115    <h4 class="jd-details-title">
2116      <span class="normal">
2117        public
2118
2119
2120
2121
2122        void
2123      </span>
2124      <span class="sympad">unregisterConnectionFailedListener</span>
2125      <span class="normal">(<a href="/reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html">GooglePlayServicesClient.OnConnectionFailedListener</a> listener)</span>
2126    </h4>
2127      <div class="api-level">
2128        <div></div>
2129
2130
2131
2132      </div>
2133    <div class="jd-details-descr">
2134
2135  <div class="jd-tagdata jd-tagdescr"><p>Removes a connection failed listener from the <code>GooglePlayServicesClient</code>.
2136 Note that removing a listener does not generate any callbacks.
2137 <p>
2138 If the specified listener is not currently registered to receive connection failed events,
2139 this method will have no effect.</p></div>
2140  <div class="jd-tagdata">
2141      <h5 class="jd-tagtitle">Parameters</h5>
2142      <table class="jd-tagtable">
2143        <tr>
2144          <th>listener</td>
2145          <td>the listener to unregister.
2146</td>
2147        </tr>
2148      </table>
2149  </div>
2150
2151    </div>
2152</div>
2153
2154
2155
2156
2157
2158<!-- ========= METHOD DETAIL ======== -->
2159
2160
2161
2162<!-- ========= END OF CLASS DATA ========= -->
2163<A NAME="navbar_top"></A>
2164
2165<div id="footer" class="wrap" >
2166
2167
2168  <div id="copyright">
2169
2170  Except as noted, this content is licensed under <a
2171  href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
2172  For details and restrictions, see the <a href="/license.html">
2173  Content License</a>.
2174  </div>
2175  <div id="build_info">
2176
2177<script src="/timestamp.js" type="text/javascript"></script>
2178<script>document.write(BUILD_TIMESTAMP)</script>
2179
2180  </div>
2181
2182
2183  <div id="footerlinks">
2184
2185  <p>
2186    <a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
2187    <a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
2188    <a href="/support.html">Support</a>
2189  </p>
2190  </div>
2191
2192</div> <!-- end footer -->
2193</div> <!-- jd-content -->
2194
2195</div><!-- end doc-content -->
2196
2197</div> <!-- end body-content -->
2198
2199
2200
2201
2202
2203
2204</body>
2205</html>
2206