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 77 78 79 80 81 82 83 84 85 86 87<html> 88<head> 89 90 91<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 92<meta name="viewport" content="width=device-width" /> 93 94<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> 95<title>LocationRequest | Android Developers</title> 96 97<!-- STYLESHEETS --> 98<link rel="stylesheet" 99href="//fonts.googleapis.com/css?family=Roboto+Condensed"> 100<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" 101 title="roboto"> 102<link href="/assets/css/default.css?v=2" rel="stylesheet" type="text/css"> 103 104 105 106<!-- JAVASCRIPT --> 107<script src="//www.google.com/jsapi" type="text/javascript"></script> 108<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script> 109<script type="text/javascript"> 110 var toRoot = "/"; 111 var metaTags = []; 112 var devsite = false; 113</script> 114<script src="/assets/js/docs.js?v=2" type="text/javascript"></script> 115 116<script> 117 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 118 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 119 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 120 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 121 122 ga('create', 'UA-5831155-1', 'android.com'); 123 ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker); 124 ga('send', 'pageview'); 125 ga('universal.send', 'pageview'); // Send page view for new tracker. 126</script> 127 128</head> 129 130<body class="gc-documentation google 131 develop" itemscope itemtype="http://schema.org/Article"> 132 <div id="doc-api-level" class="" style="display:none"></div> 133 <a name="top"></a> 134 135 136<a name="top"></a> 137 138 <!-- Header --> 139 <div id="header-wrapper"> 140 <div id="header"> 141 <div class="wrap" id="header-wrap"> 142 <div class="col-3 logo"> 143 <a href="/index.html"> 144 <img src="/assets/images/dac_logo.png" 145 srcset="/assets/images/dac_logo@2x.png 2x" 146 width="123" height="25" alt="Android Developers" /> 147 </a> 148 <div class="btn-quicknav" id="btn-quicknav"> 149 <a href="#" class="arrow-inactive">Quicknav</a> 150 <a href="#" class="arrow-active">Quicknav</a> 151 </div> 152 </div> 153 <ul class="nav-x col-9"> 154 <li class="design"> 155 <a href="/design/index.html" 156 zh-tw-lang="設計" 157 zh-cn-lang="设计" 158 ru-lang="Проектирование" 159 ko-lang="디자인" 160 ja-lang="設計" 161 es-lang="Diseñar" 162 >Design</a></li> 163 <li class="develop"><a href="/develop/index.html" 164 zh-tw-lang="開發" 165 zh-cn-lang="开发" 166 ru-lang="Разработка" 167 ko-lang="개발" 168 ja-lang="開発" 169 es-lang="Desarrollar" 170 >Develop</a></li> 171 <li class="distribute last"><a href="/distribute/index.html" 172 zh-tw-lang="發佈" 173 zh-cn-lang="分发" 174 ru-lang="Распространение" 175 ko-lang="배포" 176 ja-lang="配布" 177 es-lang="Distribuir" 178 >Distribute</a></li> 179 </ul> 180 181 182 183 184<div class="menu-container"> 185 <div class="moremenu"> 186 <div id="more-btn"></div> 187 </div> 188 <div class="morehover" id="moremenu"> 189 <div class="top"></div> 190 <div class="mid"> 191 <div class="header">Links</div> 192 <ul> 193 <li><a href="https://play.google.com/apps/publish/" target="_googleplay">Google Play Developer Console</a></li> 194 <li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li> 195 <li><a href="/about/index.html">About Android</a></li> 196 </ul> 197 <div class="header">Android Sites</div> 198 <ul> 199 <li><a href="http://www.android.com">Android.com</a></li> 200 <li class="active"><a>Android Developers</a></li> 201 <li><a href="http://source.android.com">Android Open Source Project</a></li> 202 </ul> 203 204 205 206 <div class="header">Language</div> 207 <div id="language" class="locales"> 208 <select name="language" onChange="changeLangPref(this.value, true)"> 209 <option value="en">English</option> 210 <option value="es">Español</option> 211 <option value="ja">日本語</option> 212 <option value="ko">한국어</option> 213 <option value="ru">Русский</option> 214 <option value="zh-cn">中文 (中国)</option> 215 <option value="zh-tw">中文 (台灣)</option> 216 </select> 217 </div> 218 <script type="text/javascript"> 219 <!-- 220 loadLangPref(); 221 //--> 222 </script> 223 224 225 <br class="clearfix" /> 226 </div><!-- end 'mid' --> 227 <div class="bottom"></div> 228 </div><!-- end 'moremenu' --> 229 230 <div class="search" id="search-container"> 231 <div class="search-inner"> 232 <div id="search-btn"></div> 233 <div class="left"></div> 234 <form onsubmit="return submit_search()"> 235 <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q" 236 onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)" 237 onkeydown="return search_changed(event, true, '/')" 238 onkeyup="return search_changed(event, false, '/')" /> 239 </form> 240 <div class="right"></div> 241 <a class="close hide">close</a> 242 <div class="left"></div> 243 <div class="right"></div> 244 </div><!-- end search-inner --> 245 </div><!-- end search-container --> 246 247 <div class="search_filtered_wrapper reference"> 248 <div class="suggest-card reference no-display"> 249 <ul class="search_filtered"> 250 </ul> 251 </div> 252 </div> 253 254 <div class="search_filtered_wrapper docs"> 255 <div class="suggest-card dummy no-display"> </div> 256 <div class="suggest-card develop no-display"> 257 <ul class="search_filtered"> 258 </ul> 259 <div class="child-card guides no-display"> 260 </div> 261 <div class="child-card training no-display"> 262 </div> 263 <div class="child-card samples no-display"> 264 </div> 265 </div> 266 <div class="suggest-card design no-display"> 267 <ul class="search_filtered"> 268 </ul> 269 </div> 270 <div class="suggest-card distribute no-display"> 271 <ul class="search_filtered"> 272 </ul> 273 </div> 274 </div> 275</div><!-- end menu-container (search and menu widget) --> 276 277 278 279 <!-- Expanded quicknav --> 280 <div id="quicknav" class="col-13"> 281 <ul> 282 <li class="about"> 283 <ul> 284 <li><a href="/about/index.html">About</a></li> 285 <li><a href="/wear/index.html">Wear</a></li> 286 <li><a href="/tv/index.html">TV</a></li> 287 <li><a href="/auto/index.html">Auto</a></li> 288 </ul> 289 </li> 290 <li class="design"> 291 <ul> 292 <li><a href="/design/index.html">Get Started</a></li> 293 <li><a href="/design/devices.html">Devices</a></li> 294 <li><a href="/design/style/index.html">Style</a></li> 295 <li><a href="/design/patterns/index.html">Patterns</a></li> 296 <li><a href="/design/building-blocks/index.html">Building Blocks</a></li> 297 <li><a href="/design/downloads/index.html">Downloads</a></li> 298 <li><a href="/design/videos/index.html">Videos</a></li> 299 </ul> 300 </li> 301 <li class="develop"> 302 <ul> 303 <li><a href="/training/index.html" 304 zh-tw-lang="訓練課程" 305 zh-cn-lang="培训" 306 ru-lang="Курсы" 307 ko-lang="교육" 308 ja-lang="トレーニング" 309 es-lang="Capacitación" 310 >Training</a></li> 311 <li><a href="/guide/index.html" 312 zh-tw-lang="API 指南" 313 zh-cn-lang="API 指南" 314 ru-lang="Руководства по API" 315 ko-lang="API 가이드" 316 ja-lang="API ガイド" 317 es-lang="Guías de la API" 318 >API Guides</a></li> 319 <li><a href="/reference/packages.html" 320 zh-tw-lang="參考資源" 321 zh-cn-lang="参考" 322 ru-lang="Справочник" 323 ko-lang="참조문서" 324 ja-lang="リファレンス" 325 es-lang="Referencia" 326 >Reference</a></li> 327 <li><a href="/sdk/index.html" 328 zh-tw-lang="相關工具" 329 zh-cn-lang="工具" 330 ru-lang="Инструменты" 331 ko-lang="도구" 332 ja-lang="ツール" 333 es-lang="Herramientas" 334 >Tools</a> 335 </li> 336 <li><a href="/google/index.html">Google Services</a> 337 </li> 338 339 <li><a href="/samples/index.html">Samples</a> 340 </li> 341 342 </ul> 343 </li> 344 <li class="distribute last"> 345 <ul> 346 <li><a href="/distribute/googleplay/index.html">Google Play</a></li> 347 <li><a href="/distribute/essentials/index.html">Essentials</a></li> 348 <li><a href="/distribute/users/index.html">Get Users</a></li> 349 <li><a href="/distribute/engage/index.html">Engage & Retain</a></li> 350 <li><a href="/distribute/monetize/index.html">Monetize</a></li> 351 <li><a href="/distribute/tools/index.html">Tools & Reference</a></li> 352 <li><a href="/distribute/stories/index.html">Developer Stories</a></li> 353 </ul> 354 </li> 355 </ul> 356 </div><!-- /Expanded quicknav --> 357 </div><!-- end header-wrap.wrap --> 358 </div><!-- end header --> 359 360 361 <!-- Secondary x-nav --> 362 <div id="nav-x"> 363 <div class="wrap"> 364 <ul class="nav-x col-9 develop" style="width:100%"> 365 <li class="training"><a href="/training/index.html" 366 zh-tw-lang="訓練課程" 367 zh-cn-lang="培训" 368 ru-lang="Курсы" 369 ko-lang="교육" 370 ja-lang="トレーニング" 371 es-lang="Capacitación" 372 >Training</a></li> 373 <li class="guide"><a href="/guide/index.html" 374 zh-tw-lang="API 指南" 375 zh-cn-lang="API 指南" 376 ru-lang="Руководства по API" 377 ko-lang="API 가이드" 378 ja-lang="API ガイド" 379 es-lang="Guías de la API" 380 >API Guides</a></li> 381 <li class="reference"><a href="/reference/packages.html" 382 zh-tw-lang="參考資源" 383 zh-cn-lang="参考" 384 ru-lang="Справочник" 385 ko-lang="참조문서" 386 ja-lang="リファレンス" 387 es-lang="Referencia" 388 >Reference</a></li> 389 <li class="tools"><a href="/sdk/index.html" 390 zh-tw-lang="相關工具" 391 zh-cn-lang="工具" 392 ru-lang="Инструменты" 393 ko-lang="도구" 394 ja-lang="ツール" 395 es-lang="Herramientas" 396 >Tools</a></li> 397 <li class="google"><a href="/google/index.html" 398 >Google Services</a> 399 </li> 400 401 <li class="samples"><a href="/samples/index.html" 402 >Samples</a> 403 </li> 404 405 </ul> 406 </div> 407 </div> 408 <!-- /Sendondary x-nav DEVELOP --> 409 410 411 412 <div id="searchResults" class="wrap" style="display:none;"> 413 <h2 id="searchTitle">Results</h2> 414 <div id="leftSearchControl" class="search-control">Loading...</div> 415 </div> 416 </div> <!--end header-wrapper --> 417 418 <div id="sticky-header"> 419 <div> 420 <a class="logo" href="#top"></a> 421 <a class="top" href="#top"></a> 422 <ul class="breadcrumb"> 423 424 <li class="current">LocationRequest</li> 425 </ul> 426 </div> 427 </div> 428 429 430 431 432 433 434 <div class="wrap clearfix" id="body-content"> 435 <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> 436 <div id="devdoc-nav" class="scroll-pane"> 437 438 439 440<ul id="nav"> 441 442 <li class="nav-section"> 443 <div class="nav-section-header empty"><a href="/google/index.html"> 444 <span class="en">Overview</span> 445 </a></div> 446 </li> 447 448 <li class="nav-section"> 449 <div class="nav-section-header empty"><a href="/google/play-services/games.html"> 450 <span class="en">Games</span> 451 </a></div> 452 </li> 453 <li class="nav-section"> 454 <div class="nav-section-header empty"><a href="/google/play-services/location.html"> 455 <span class="en">Location</span> 456 </a></div> 457 </li> 458 <li class="nav-section"> 459 <div class="nav-section-header empty"><a href="/google/play-services/plus.html"> 460 <span class="en">Google+</span> 461 </a></div> 462 </li> 463 <li class="nav-section"> 464 <div class="nav-section-header empty"><a href="/google/play-services/maps.html"> 465 <span class="en">Maps</span> 466 </a></div> 467 </li> 468 <li class="nav-section"> 469 <div class="nav-section-header empty"><a href="/google/play-services/drive.html"> 470 <span class="en">Drive</span> 471 </a></div> 472 </li> 473 <li class="nav-section"> 474 <div class="nav-section-header empty"><a href="/google/play-services/cast.html"> 475 <span class="en">Cast</span> 476 </a></div> 477 </li> 478 <li class="nav-section"> 479 <div class="nav-section-header"><a href="/google/play-services/ads.html"> 480 <span class="en">Ads</span></a> 481 </div> 482 <ul> 483 <li><a href="/google/play-services/id.html"> 484 <span class="en">Advertising ID</span></a> 485 </li> 486 </ul> 487 </li> 488 <li class="nav-section"> 489 <div class="nav-section-header empty"><a href="/google/play-services/wallet.html"> 490 <span class="en">Wallet</span> 491 </a></div> 492 </li> 493 494 495 <li class="nav-section"> 496 <div class="nav-section-header"><a href="/google/play-services/index.html"> 497 <span class="en">Google Play Services</span></a> 498 </div> 499 <ul> 500 <li><a href="/google/play-services/setup.html"> 501 <span class="en">Setting Up Google Play Services</span></a> 502 </li> 503 <li class="nav-section"> 504 <div class="nav-section-header"><a href="/google/auth/api-client.html"> 505 <span class="en">Accessing Google APIs</span></a> 506 </div> 507 <ul> 508 <li> 509 <a href="/google/auth/http-auth.html"> 510 <span class="en">Authorizing with Google for REST APIs</span> 511 </a> 512 </li> 513 </ul> 514 </li> 515 <li id="gms-tree-list" class="nav-section"> 516 <div class="nav-section-header"> 517 <a href="/reference/gms-packages.html"> 518 <span class="en">Reference</span> 519 </a> 520 <div> 521 </li> 522 </ul> 523 </li> 524 525 526 <li class="nav-section"> 527 <div class="nav-section-header"><a href="/google/play/billing/index.html"> 528 <span class="en">Google Play In-app Billing</span></a> 529 </div> 530 <ul> 531 <li><a href="/google/play/billing/billing_overview.html"> 532 <span class="en">Overview</span></a> 533 </li> 534 <li class="nav-section"><div class="nav-section-header"><a href="/google/play/billing/api.html"> 535 <span class="en">Version 3 API</span></a></div> 536 <ul> 537 <li><a href="/google/play/billing/billing_integrate.html"> 538 <span class="en">Implementing the API</span></a></li> 539 <li><a href="/google/play/billing/billing_reference.html"> 540 <span class="en">Reference</span></a></li> 541 </ul> 542 </li> 543 <li class="nav-section"><div class="nav-section-header"><a href="/google/play/billing/v2/api.html"> 544 <span class="en">Version 2 API</span></a></div> 545 <ul> 546 <li><a href="/google/play/billing/v2/billing_integrate.html"> 547 <span class="en">Implementing the API</span></a></li> 548 <li><a href="/google/play/billing/v2/billing_subscriptions.html"> 549 <span class="en">Subscriptions</span></a></li> 550 <li><a href="/google/play/billing/v2/billing_reference.html"> 551 <span class="en">Reference</span></a></li> 552 </ul> 553 </li> 554 <li><a href="/google/play/billing/billing_subscriptions.html"> 555 <span class="en">Subscriptions</span></a> 556 </li> 557 <li><a href="/google/play/billing/billing_best_practices.html"> 558 <span class="en">Security and Design</span></a> 559 </li> 560 <li><a href="/google/play/billing/billing_testing.html"> 561 <span class="en">Testing In-app Billing</span></a> 562 </li> 563 <li><a href="/google/play/billing/billing_admin.html"> 564 <span class="en">Administering In-app Billing</span></a> 565 </li> 566 <li><a href="/google/play/billing/versions.html"> 567 <span class="en">Version Notes</span></a> 568 </li> 569 </ul> 570 </li> 571 572 573 574 <li class="nav-section"> 575 <div class="nav-section-header"><a href="/google/gcm/index.html"> 576 <span class="en">Google Cloud Messaging</span></a> 577 </div> 578 <ul> 579 <li><a href="/google/gcm/gcm.html"> 580 <span class="en">Overview</span></a> 581 </li> 582 <li><a href="/google/gcm/gs.html"> 583 <span class="en">Getting Started</span></a> 584 </li> 585 <li><a href="/google/gcm/client.html"> 586 <span class="en">Implementing GCM Client</span></a> 587 </li> 588 <li class="nav-section"><div class="nav-section-header"><a href="/google/gcm/server.html"> 589 <span class="en">Implementing GCM Server</span></a></div> 590 <ul> 591 <li><a href="/google/gcm/ccs.html"> 592 <span class="en">CCS (XMPP)</span></a></li> 593 <li><a href="/google/gcm/http.html"> 594 <span class="en">HTTP</span></a></li> 595 </ul> 596 </li> 597 <li><a href="/google/gcm/notifications.html"> 598 <span class="en">User Notifications</span></a> 599 </li> 600 <li><a href="/google/gcm/adv.html"> 601 <span class="en">Advanced Topics</span></a> 602 </li> 603 <li><a href="/google/gcm/c2dm.html"> 604 <span class="en">Migration</span></a> 605 </li> 606 <li id="gcm-tree-list" class="nav-section"> 607 <div class="nav-section-header"> 608 <a href="/reference/gcm-packages.html"> 609 <span class="en">Reference</span> 610 </a> 611 <div> 612 </li> 613 </ul> 614 </li> 615 616 <li class="nav-section"> 617 <div class="nav-section-header empty"><a href="/google/gcs/index.html"> 618 <span class="en">Google Cloud Save</span></a> 619 </div> 620 </li> 621 622 <li class="nav-section"> 623 <div class="nav-section-header"><a href="/google/play/dist.html"> 624 <span class="en">Google Play Distribution</span></a> 625 </div> 626 <ul> 627 <li><a href="/google/play/filters.html"> 628 <span class="en">Filters on Google Play</span></a> 629 </li> 630 <li><a href="/google/play/billing/gp-purchase-status-api.html"> 631 <span class="en">Google Play Developer API</span></a> 632 </li> 633 <li><a href="/google/play/publishing/multiple-apks.html"> 634 <span class="en">Multiple APK Support</span></a> 635 </li> 636 <li><a href="/google/play/expansion-files.html"> 637 <span class="en">APK Expansion Files</span></a> 638 </li> 639 <li class="nav-section"> 640 <div class="nav-section-header"><a href="/google/play/licensing/index.html"> 641 <span class="en">Application Licensing</span></a> 642 </div> 643 <ul> 644 <li><a href="/google/play/licensing/overview.html"> 645 <span class="en">Licensing Overview</span></a> 646 </li> 647 <li><a href="/google/play/licensing/setting-up.html"> 648 <span class="en">Setting Up for Licensing</span></a> 649 </li> 650 <li><a href="/google/play/licensing/adding-licensing.html"> 651 <span class="en">Adding Licensing to Your App</span></a> 652 </li> 653 <li><a href="/google/play/licensing/licensing-reference.html"> 654 <span class="en">Licensing Reference</span></a> 655 </li> 656 </ul> 657 </li> 658 659 <li class="nav-section"> 660 <div class="nav-section-header"><a href="/google/backup/index.html"> 661 Android Backup Service</a> 662 </div> 663 <ul> 664 <li><a href="/google/backup/signup.html"> 665 Register</a> 666 </li> 667 </ul> 668 </li> 669 670 </ul> 671 672</li> 673 674 675 676</ul> 677 678<script type="text/javascript"> 679<!-- 680 buildToggleLists(); 681 changeNavLang(getLangPref()); 682//--> 683</script> 684 685 686 687 688 </div> 689 <script type="text/javascript"> 690 showGoogleRefTree(); 691 692 </script> 693 </div> <!-- end side-nav --> 694 <script> 695 $(document).ready(function() { 696 scrollIntoView("devdoc-nav"); 697 }); 698 </script> 699 700 701 702 703 704 705<div class="col-12" id="doc-col"> 706 707<div id="api-info-block"> 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735<div class="sum-details-links"> 736 737Summary: 738 739 740 741 742 743 <a href="#constants">Constants</a> 744 745 746 747 | <a href="#inhconstants">Inherited Constants</a> 748 749 750 751 752 753 754 755 | <a href="#pubmethods">Methods</a> 756 757 758 759 760 | <a href="#inhmethods">Inherited Methods</a> 761 762| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a> 763 764</div><!-- end sum-details-links --> 765<div class="api-level"> 766 767 768 769 770</div> 771</div><!-- end api-info-block --> 772 773 774<!-- ======== START OF CLASS DATA ======== --> 775 776<div id="jd-header"> 777 public 778 779 final 780 781 class 782<h1 itemprop="name">LocationRequest</h1> 783 784 785 786 787 extends Object<br/> 788 789 790 791 792 793 794 implements 795 796 SafeParcelable 797 798 799 800 801 802</div><!-- end header --> 803 804<div id="naMessage"></div> 805 806<div id="jd-content" class="api apilevel-"> 807<table class="jd-inheritance-table"> 808 809 810 <tr> 811 812 <td colspan="2" class="jd-inheritance-class-cell">java.lang.Object</td> 813 </tr> 814 815 816 <tr> 817 818 <td class="jd-inheritance-space"> ↳</td> 819 820 <td colspan="1" class="jd-inheritance-class-cell">com.google.android.gms.location.LocationRequest</td> 821 </tr> 822 823 824</table> 825 826 827 828 829 830 831 832<div class="jd-descr"> 833 834 835<h2>Class Overview</h2> 836<p itemprop="articleBody">A data object that contains quality of service parameters for requests to 837 the <code><a href="/reference/com/google/android/gms/location/FusedLocationProviderApi.html">FusedLocationProviderApi</a></code>. 838 839 <p>LocationRequest objects are used to request a quality of service for location updates from 840 the <code><a href="/reference/com/google/android/gms/location/FusedLocationProviderApi.html">FusedLocationProviderApi</a></code>. 841 842 <p>For example, if your application wants high accuracy location it should create a location 843 request with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> set to <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_HIGH_ACCURACY">PRIORITY_HIGH_ACCURACY</a></code> and 844 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code> to 5 seconds. This would be appropriate for mapping applications that are 845 showing your location in real-time. 846 847 <p>At the other extreme, if you want negligible power impact, but to still receive location 848 updates when available, then create a location request with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> set to 849 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_NO_POWER">PRIORITY_NO_POWER</a></code>. With this request your application will not trigger (and therefore 850 will not receive any power blame) any location updates, but will receive locations triggered by 851 other applications. This would be appropriate for applications that have no firm requirement 852 for location, but can take advantage when available. 853 854 <p>In between these two extremes is a very common use-case, where applications definitely want 855 to receive updates at a specified interval, and can receive them faster when available, but 856 still want a low power impact. These applications should consider 857 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_BALANCED_POWER_ACCURACY">PRIORITY_BALANCED_POWER_ACCURACY</a></code> combined with a faster 858 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval(long)</a></code> (such as 1 minute) and a slower <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code> 859 (such as 60 minutes). They will only be assigned power blame for the interval set by 860 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code>, but can still receive locations triggered by other applications at a rate 861 up to <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval(long)</a></code>. This style of request is appropriate for many location aware 862 applications, including background usage. Do be careful to also throttle 863 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval(long)</a></code> if you perform heavy-weight work after receiving an update - such 864 as using the network. 865 866 <p>Activities should strongly consider removing all location request when entering 867 the background (for example at <code><a href="/reference/android/app/Activity.html#onPause()">onPause()</a></code>), or at least swap the 868 request to a larger interval and lower quality. 869 870 <p>Applications cannot specify the exact location sources, such as GPS, that are used by the 871 LocationClient. In fact, the system may have multiple location sources (providers) running and 872 may fuse the results from several sources into a single Location object. 873 874 <p>Location requests from applications with 875 <code><a href="/reference/android/Manifest.permission.html#ACCESS_COARSE_LOCATION">ACCESS_COARSE_LOCATION</a></code> and not 876 <code><a href="/reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION">ACCESS_FINE_LOCATION</a></code> will be automatically throttled to a 877 slower interval, and the location object will be obfuscated to only show a coarse level of 878 accuracy. 879 880 <p>All location requests are considered hints, and you may receive locations that are 881 more/less accurate, and faster/slower than requested. 882</p> 883 884 885 886 887 888</div><!-- jd-descr --> 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905<div class="jd-descr"> 906 907 908<h2>Summary</h2> 909 910 911 912 913 914 915 916 917 918 919 920 921 922<!-- =========== ENUM CONSTANT SUMMARY =========== --> 923<table id="constants" class="jd-sumtable"><tr><th colspan="12">Constants</th></tr> 924 925 926 927 <tr class="alt-color api apilevel-" > 928 <td class="jd-typecol">int</td> 929 <td class="jd-linkcol"><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_BALANCED_POWER_ACCURACY">PRIORITY_BALANCED_POWER_ACCURACY</a></td> 930 <td class="jd-descrcol" width="100%">Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request "block" level accuracy.</td> 931 </tr> 932 933 934 <tr class=" api apilevel-" > 935 <td class="jd-typecol">int</td> 936 <td class="jd-linkcol"><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_HIGH_ACCURACY">PRIORITY_HIGH_ACCURACY</a></td> 937 <td class="jd-descrcol" width="100%">Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request the most accurate locations available.</td> 938 </tr> 939 940 941 <tr class="alt-color api apilevel-" > 942 <td class="jd-typecol">int</td> 943 <td class="jd-linkcol"><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_LOW_POWER">PRIORITY_LOW_POWER</a></td> 944 <td class="jd-descrcol" width="100%">Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request "city" level accuracy.</td> 945 </tr> 946 947 948 <tr class=" api apilevel-" > 949 <td class="jd-typecol">int</td> 950 <td class="jd-linkcol"><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_NO_POWER">PRIORITY_NO_POWER</a></td> 951 <td class="jd-descrcol" width="100%">Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request the best accuracy possible with zero additional 952 power consumption.</td> 953 </tr> 954 955 956 957</table> 958 959 960 961 962 963<!-- =========== ENUM CONSTANT SUMMARY =========== --> 964<table id="inhconstants" class="jd-sumtable"><tr><th> 965 <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a> 966 <div style="clear:left;">Inherited Constants</div></th></tr> 967 968 969 970 971<tr class="api apilevel-" > 972<td colspan="12"> 973 974 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-constants-android.os.Parcelable" class="jd-expando-trigger closed" 975 ><img id="inherited-constants-android.os.Parcelable-trigger" 976 src="/assets/images/triangle-closed.png" 977 class="jd-expando-trigger-img" /></a>From interface 978android.os.Parcelable 979<div id="inherited-constants-android.os.Parcelable"> 980 <div id="inherited-constants-android.os.Parcelable-list" 981 class="jd-inheritedlinks"> 982 </div> 983 <div id="inherited-constants-android.os.Parcelable-summary" style="display: none;"> 984 <table class="jd-sumtable-expando"> 985 986 987 988 <tr class="alt-color api apilevel-" > 989 <td class="jd-typecol">int</td> 990 <td class="jd-linkcol">CONTENTS_FILE_DESCRIPTOR</td> 991 <td class="jd-descrcol" width="100%"></td> 992 </tr> 993 994 995 <tr class=" api apilevel-" > 996 <td class="jd-typecol">int</td> 997 <td class="jd-linkcol">PARCELABLE_WRITE_RETURN_VALUE</td> 998 <td class="jd-descrcol" width="100%"></td> 999 </tr> 1000 1001 1002</table> 1003 </div> 1004</div> 1005</td></tr> 1006 1007 1008 1009<tr class="api apilevel-" > 1010<td colspan="12"> 1011 1012 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-constants-com.google.android.gms.common.internal.safeparcel.SafeParcelable" class="jd-expando-trigger closed" 1013 ><img id="inherited-constants-com.google.android.gms.common.internal.safeparcel.SafeParcelable-trigger" 1014 src="/assets/images/triangle-closed.png" 1015 class="jd-expando-trigger-img" /></a>From interface 1016com.google.android.gms.common.internal.safeparcel.SafeParcelable 1017<div id="inherited-constants-com.google.android.gms.common.internal.safeparcel.SafeParcelable"> 1018 <div id="inherited-constants-com.google.android.gms.common.internal.safeparcel.SafeParcelable-list" 1019 class="jd-inheritedlinks"> 1020 </div> 1021 <div id="inherited-constants-com.google.android.gms.common.internal.safeparcel.SafeParcelable-summary" style="display: none;"> 1022 <table class="jd-sumtable-expando"> 1023 1024 1025 1026 <tr class="alt-color api apilevel-" > 1027 <td class="jd-typecol">String</td> 1028 <td class="jd-linkcol">NULL</td> 1029 <td class="jd-descrcol" width="100%"></td> 1030 </tr> 1031 1032 1033</table> 1034 </div> 1035</div> 1036</td></tr> 1037 1038 1039</table> 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053<!-- ========== METHOD SUMMARY =========== --> 1054<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr> 1055 1056 1057 1058 1059 <tr class="alt-color api apilevel-" > 1060 <td class="jd-typecol"><nobr> 1061 1062 1063 1064 static 1065 1066 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1067 </td> 1068 <td class="jd-linkcol" width="100%"><nobr> 1069 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#create()">create</a></span>()</nobr> 1070 1071 <div class="jd-descrdiv">Create a location request with default parameters.</div> 1072 1073 </td></tr> 1074 1075 1076 1077 <tr class=" api apilevel-" > 1078 <td class="jd-typecol"><nobr> 1079 1080 1081 1082 1083 1084 int</nobr> 1085 </td> 1086 <td class="jd-linkcol" width="100%"><nobr> 1087 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#describeContents()">describeContents</a></span>()</nobr> 1088 1089 </td></tr> 1090 1091 1092 1093 <tr class="alt-color api apilevel-" > 1094 <td class="jd-typecol"><nobr> 1095 1096 1097 1098 1099 1100 boolean</nobr> 1101 </td> 1102 <td class="jd-linkcol" width="100%"><nobr> 1103 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#equals(java.lang.Object)">equals</a></span>(Object object)</nobr> 1104 1105 </td></tr> 1106 1107 1108 1109 <tr class=" api apilevel-" > 1110 <td class="jd-typecol"><nobr> 1111 1112 1113 1114 1115 1116 long</nobr> 1117 </td> 1118 <td class="jd-linkcol" width="100%"><nobr> 1119 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#getExpirationTime()">getExpirationTime</a></span>()</nobr> 1120 1121 <div class="jd-descrdiv">Get the request expiration time, in milliseconds since boot.</div> 1122 1123 </td></tr> 1124 1125 1126 1127 <tr class="alt-color api apilevel-" > 1128 <td class="jd-typecol"><nobr> 1129 1130 1131 1132 1133 1134 long</nobr> 1135 </td> 1136 <td class="jd-linkcol" width="100%"><nobr> 1137 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval()">getFastestInterval</a></span>()</nobr> 1138 1139 <div class="jd-descrdiv">Get the fastest interval of this request, in milliseconds.</div> 1140 1141 </td></tr> 1142 1143 1144 1145 <tr class=" api apilevel-" > 1146 <td class="jd-typecol"><nobr> 1147 1148 1149 1150 1151 1152 long</nobr> 1153 </td> 1154 <td class="jd-linkcol" width="100%"><nobr> 1155 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#getInterval()">getInterval</a></span>()</nobr> 1156 1157 <div class="jd-descrdiv">Get the desired interval of this request, in milliseconds.</div> 1158 1159 </td></tr> 1160 1161 1162 1163 <tr class="alt-color api apilevel-" > 1164 <td class="jd-typecol"><nobr> 1165 1166 1167 1168 1169 1170 int</nobr> 1171 </td> 1172 <td class="jd-linkcol" width="100%"><nobr> 1173 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#getNumUpdates()">getNumUpdates</a></span>()</nobr> 1174 1175 <div class="jd-descrdiv">Get the number of updates requested.</div> 1176 1177 </td></tr> 1178 1179 1180 1181 <tr class=" api apilevel-" > 1182 <td class="jd-typecol"><nobr> 1183 1184 1185 1186 1187 1188 int</nobr> 1189 </td> 1190 <td class="jd-linkcol" width="100%"><nobr> 1191 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#getPriority()">getPriority</a></span>()</nobr> 1192 1193 <div class="jd-descrdiv">Get the quality of the request.</div> 1194 1195 </td></tr> 1196 1197 1198 1199 <tr class="alt-color api apilevel-" > 1200 <td class="jd-typecol"><nobr> 1201 1202 1203 1204 1205 1206 float</nobr> 1207 </td> 1208 <td class="jd-linkcol" width="100%"><nobr> 1209 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#getSmallestDisplacement()">getSmallestDisplacement</a></span>()</nobr> 1210 1211 <div class="jd-descrdiv">Get the minimum displacement between location updates in meters 1212 1213 <p>By default this is 0.</div> 1214 1215 </td></tr> 1216 1217 1218 1219 <tr class=" api apilevel-" > 1220 <td class="jd-typecol"><nobr> 1221 1222 1223 1224 1225 1226 int</nobr> 1227 </td> 1228 <td class="jd-linkcol" width="100%"><nobr> 1229 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#hashCode()">hashCode</a></span>()</nobr> 1230 1231 </td></tr> 1232 1233 1234 1235 <tr class="alt-color api apilevel-" > 1236 <td class="jd-typecol"><nobr> 1237 1238 1239 1240 1241 1242 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1243 </td> 1244 <td class="jd-linkcol" width="100%"><nobr> 1245 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setExpirationDuration(long)">setExpirationDuration</a></span>(long millis)</nobr> 1246 1247 <div class="jd-descrdiv">Set the duration of this request, in milliseconds.</div> 1248 1249 </td></tr> 1250 1251 1252 1253 <tr class=" api apilevel-" > 1254 <td class="jd-typecol"><nobr> 1255 1256 1257 1258 1259 1260 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1261 </td> 1262 <td class="jd-linkcol" width="100%"><nobr> 1263 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setExpirationTime(long)">setExpirationTime</a></span>(long millis)</nobr> 1264 1265 <div class="jd-descrdiv">Set the request expiration time, in millisecond since boot.</div> 1266 1267 </td></tr> 1268 1269 1270 1271 <tr class="alt-color api apilevel-" > 1272 <td class="jd-typecol"><nobr> 1273 1274 1275 1276 1277 1278 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1279 </td> 1280 <td class="jd-linkcol" width="100%"><nobr> 1281 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval</a></span>(long millis)</nobr> 1282 1283 <div class="jd-descrdiv">Explicitly set the fastest interval for location updates, in milliseconds.</div> 1284 1285 </td></tr> 1286 1287 1288 1289 <tr class=" api apilevel-" > 1290 <td class="jd-typecol"><nobr> 1291 1292 1293 1294 1295 1296 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1297 </td> 1298 <td class="jd-linkcol" width="100%"><nobr> 1299 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval</a></span>(long millis)</nobr> 1300 1301 <div class="jd-descrdiv">Set the desired interval for active location updates, in milliseconds.</div> 1302 1303 </td></tr> 1304 1305 1306 1307 <tr class="alt-color api apilevel-" > 1308 <td class="jd-typecol"><nobr> 1309 1310 1311 1312 1313 1314 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1315 </td> 1316 <td class="jd-linkcol" width="100%"><nobr> 1317 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setNumUpdates(int)">setNumUpdates</a></span>(int numUpdates)</nobr> 1318 1319 <div class="jd-descrdiv">Set the number of location updates.</div> 1320 1321 </td></tr> 1322 1323 1324 1325 <tr class=" api apilevel-" > 1326 <td class="jd-typecol"><nobr> 1327 1328 1329 1330 1331 1332 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1333 </td> 1334 <td class="jd-linkcol" width="100%"><nobr> 1335 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority</a></span>(int priority)</nobr> 1336 1337 <div class="jd-descrdiv">Set the priority of the request.</div> 1338 1339 </td></tr> 1340 1341 1342 1343 <tr class="alt-color api apilevel-" > 1344 <td class="jd-typecol"><nobr> 1345 1346 1347 1348 1349 1350 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a></nobr> 1351 </td> 1352 <td class="jd-linkcol" width="100%"><nobr> 1353 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#setSmallestDisplacement(float)">setSmallestDisplacement</a></span>(float smallestDisplacementMeters)</nobr> 1354 1355 <div class="jd-descrdiv">Set the minimum displacement between location updates in meters 1356 1357 <p>By default this is 0.</div> 1358 1359 </td></tr> 1360 1361 1362 1363 <tr class=" api apilevel-" > 1364 <td class="jd-typecol"><nobr> 1365 1366 1367 1368 1369 1370 String</nobr> 1371 </td> 1372 <td class="jd-linkcol" width="100%"><nobr> 1373 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#toString()">toString</a></span>()</nobr> 1374 1375 </td></tr> 1376 1377 1378 1379 <tr class="alt-color api apilevel-" > 1380 <td class="jd-typecol"><nobr> 1381 1382 1383 1384 1385 1386 void</nobr> 1387 </td> 1388 <td class="jd-linkcol" width="100%"><nobr> 1389 <span class="sympad"><a href="/reference/com/google/android/gms/location/LocationRequest.html#writeToParcel(android.os.Parcel, int)">writeToParcel</a></span>(Parcel parcel, int flags)</nobr> 1390 1391 </td></tr> 1392 1393 1394 1395</table> 1396 1397 1398 1399 1400 1401 1402 1403<!-- ========== METHOD SUMMARY =========== --> 1404<table id="inhmethods" class="jd-sumtable"><tr><th> 1405 <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a> 1406 <div style="clear:left;">Inherited Methods</div></th></tr> 1407 1408 1409<tr class="api apilevel-" > 1410<td colspan="12"> 1411 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed" 1412 ><img id="inherited-methods-java.lang.Object-trigger" 1413 src="/assets/images/triangle-closed.png" 1414 class="jd-expando-trigger-img" /></a> 1415From class 1416 1417 java.lang.Object 1418 1419<div id="inherited-methods-java.lang.Object"> 1420 <div id="inherited-methods-java.lang.Object-list" 1421 class="jd-inheritedlinks"> 1422 </div> 1423 <div id="inherited-methods-java.lang.Object-summary" style="display: none;"> 1424 <table class="jd-sumtable-expando"> 1425 1426 1427 1428 1429 <tr class="alt-color api apilevel-" > 1430 <td class="jd-typecol"><nobr> 1431 1432 1433 1434 1435 1436 Object</nobr> 1437 </td> 1438 <td class="jd-linkcol" width="100%"><nobr> 1439 <span class="sympad">clone</span>()</nobr> 1440 1441 </td></tr> 1442 1443 1444 1445 <tr class=" api apilevel-" > 1446 <td class="jd-typecol"><nobr> 1447 1448 1449 1450 1451 1452 boolean</nobr> 1453 </td> 1454 <td class="jd-linkcol" width="100%"><nobr> 1455 <span class="sympad">equals</span>(Object arg0)</nobr> 1456 1457 </td></tr> 1458 1459 1460 1461 <tr class="alt-color api apilevel-" > 1462 <td class="jd-typecol"><nobr> 1463 1464 1465 1466 1467 1468 void</nobr> 1469 </td> 1470 <td class="jd-linkcol" width="100%"><nobr> 1471 <span class="sympad">finalize</span>()</nobr> 1472 1473 </td></tr> 1474 1475 1476 1477 <tr class=" api apilevel-" > 1478 <td class="jd-typecol"><nobr> 1479 1480 1481 final 1482 1483 1484 Class<?></nobr> 1485 </td> 1486 <td class="jd-linkcol" width="100%"><nobr> 1487 <span class="sympad">getClass</span>()</nobr> 1488 1489 </td></tr> 1490 1491 1492 1493 <tr class="alt-color api apilevel-" > 1494 <td class="jd-typecol"><nobr> 1495 1496 1497 1498 1499 1500 int</nobr> 1501 </td> 1502 <td class="jd-linkcol" width="100%"><nobr> 1503 <span class="sympad">hashCode</span>()</nobr> 1504 1505 </td></tr> 1506 1507 1508 1509 <tr class=" api apilevel-" > 1510 <td class="jd-typecol"><nobr> 1511 1512 1513 final 1514 1515 1516 void</nobr> 1517 </td> 1518 <td class="jd-linkcol" width="100%"><nobr> 1519 <span class="sympad">notify</span>()</nobr> 1520 1521 </td></tr> 1522 1523 1524 1525 <tr class="alt-color api apilevel-" > 1526 <td class="jd-typecol"><nobr> 1527 1528 1529 final 1530 1531 1532 void</nobr> 1533 </td> 1534 <td class="jd-linkcol" width="100%"><nobr> 1535 <span class="sympad">notifyAll</span>()</nobr> 1536 1537 </td></tr> 1538 1539 1540 1541 <tr class=" api apilevel-" > 1542 <td class="jd-typecol"><nobr> 1543 1544 1545 1546 1547 1548 String</nobr> 1549 </td> 1550 <td class="jd-linkcol" width="100%"><nobr> 1551 <span class="sympad">toString</span>()</nobr> 1552 1553 </td></tr> 1554 1555 1556 1557 <tr class="alt-color api apilevel-" > 1558 <td class="jd-typecol"><nobr> 1559 1560 1561 final 1562 1563 1564 void</nobr> 1565 </td> 1566 <td class="jd-linkcol" width="100%"><nobr> 1567 <span class="sympad">wait</span>()</nobr> 1568 1569 </td></tr> 1570 1571 1572 1573 <tr class=" api apilevel-" > 1574 <td class="jd-typecol"><nobr> 1575 1576 1577 final 1578 1579 1580 void</nobr> 1581 </td> 1582 <td class="jd-linkcol" width="100%"><nobr> 1583 <span class="sympad">wait</span>(long arg0, int arg1)</nobr> 1584 1585 </td></tr> 1586 1587 1588 1589 <tr class="alt-color api apilevel-" > 1590 <td class="jd-typecol"><nobr> 1591 1592 1593 final 1594 1595 1596 void</nobr> 1597 </td> 1598 <td class="jd-linkcol" width="100%"><nobr> 1599 <span class="sympad">wait</span>(long arg0)</nobr> 1600 1601 </td></tr> 1602 1603 1604</table> 1605 </div> 1606</div> 1607</td></tr> 1608 1609 1610 1611<tr class="api apilevel-" > 1612<td colspan="12"> 1613 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-android.os.Parcelable" class="jd-expando-trigger closed" 1614 ><img id="inherited-methods-android.os.Parcelable-trigger" 1615 src="/assets/images/triangle-closed.png" 1616 class="jd-expando-trigger-img" /></a> 1617From interface 1618 1619 android.os.Parcelable 1620 1621<div id="inherited-methods-android.os.Parcelable"> 1622 <div id="inherited-methods-android.os.Parcelable-list" 1623 class="jd-inheritedlinks"> 1624 </div> 1625 <div id="inherited-methods-android.os.Parcelable-summary" style="display: none;"> 1626 <table class="jd-sumtable-expando"> 1627 1628 1629 1630 1631 <tr class="alt-color api apilevel-" > 1632 <td class="jd-typecol"><nobr> 1633 abstract 1634 1635 1636 1637 1638 int</nobr> 1639 </td> 1640 <td class="jd-linkcol" width="100%"><nobr> 1641 <span class="sympad">describeContents</span>()</nobr> 1642 1643 </td></tr> 1644 1645 1646 1647 <tr class=" api apilevel-" > 1648 <td class="jd-typecol"><nobr> 1649 abstract 1650 1651 1652 1653 1654 void</nobr> 1655 </td> 1656 <td class="jd-linkcol" width="100%"><nobr> 1657 <span class="sympad">writeToParcel</span>(Parcel arg0, int arg1)</nobr> 1658 1659 </td></tr> 1660 1661 1662</table> 1663 </div> 1664</div> 1665</td></tr> 1666 1667 1668 1669 1670</table> 1671 1672 1673</div><!-- jd-descr (summary) --> 1674 1675<!-- Details --> 1676 1677 1678 1679 1680 1681 1682 1683 1684<!-- XML Attributes --> 1685 1686 1687<!-- Enum Values --> 1688 1689 1690<!-- Constants --> 1691 1692 1693<!-- ========= ENUM CONSTANTS DETAIL ======== --> 1694<h2>Constants</h2> 1695 1696 1697 1698 1699<A NAME="PRIORITY_BALANCED_POWER_ACCURACY"></A> 1700 1701<div class="jd-details api apilevel-"> 1702 <h4 class="jd-details-title"> 1703 <span class="normal"> 1704 public 1705 static 1706 final 1707 int 1708 </span> 1709 PRIORITY_BALANCED_POWER_ACCURACY 1710 </h4> 1711 <div class="api-level"> 1712 1713 1714 1715 1716 </div> 1717 <div class="jd-details-descr"> 1718 1719 <div class="jd-tagdata jd-tagdescr"><p>Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request "block" level accuracy. 1720 1721 <p>Block level accuracy is considered to be about 100 meter accuracy. Using a coarse 1722 accuracy such as this often consumes less power. 1723</p></div> 1724 1725 1726 <div class="jd-tagdata"> 1727 <span class="jd-tagtitle">Constant Value: </span> 1728 <span> 1729 1730 102 1731 (0x00000066) 1732 1733 </span> 1734 </div> 1735 1736 </div> 1737</div> 1738 1739 1740 1741<A NAME="PRIORITY_HIGH_ACCURACY"></A> 1742 1743<div class="jd-details api apilevel-"> 1744 <h4 class="jd-details-title"> 1745 <span class="normal"> 1746 public 1747 static 1748 final 1749 int 1750 </span> 1751 PRIORITY_HIGH_ACCURACY 1752 </h4> 1753 <div class="api-level"> 1754 1755 1756 1757 1758 </div> 1759 <div class="jd-details-descr"> 1760 1761 <div class="jd-tagdata jd-tagdescr"><p>Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request the most accurate locations available. 1762 1763 <p>This will return the finest location available. 1764</p></div> 1765 1766 1767 <div class="jd-tagdata"> 1768 <span class="jd-tagtitle">Constant Value: </span> 1769 <span> 1770 1771 100 1772 (0x00000064) 1773 1774 </span> 1775 </div> 1776 1777 </div> 1778</div> 1779 1780 1781 1782<A NAME="PRIORITY_LOW_POWER"></A> 1783 1784<div class="jd-details api apilevel-"> 1785 <h4 class="jd-details-title"> 1786 <span class="normal"> 1787 public 1788 static 1789 final 1790 int 1791 </span> 1792 PRIORITY_LOW_POWER 1793 </h4> 1794 <div class="api-level"> 1795 1796 1797 1798 1799 </div> 1800 <div class="jd-details-descr"> 1801 1802 <div class="jd-tagdata jd-tagdescr"><p>Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request "city" level accuracy. 1803 1804 <p>City level accuracy is considered to be about 10km accuracy. Using a coarse accuracy 1805 such as this often consumes less power. 1806</p></div> 1807 1808 1809 <div class="jd-tagdata"> 1810 <span class="jd-tagtitle">Constant Value: </span> 1811 <span> 1812 1813 104 1814 (0x00000068) 1815 1816 </span> 1817 </div> 1818 1819 </div> 1820</div> 1821 1822 1823 1824<A NAME="PRIORITY_NO_POWER"></A> 1825 1826<div class="jd-details api apilevel-"> 1827 <h4 class="jd-details-title"> 1828 <span class="normal"> 1829 public 1830 static 1831 final 1832 int 1833 </span> 1834 PRIORITY_NO_POWER 1835 </h4> 1836 <div class="api-level"> 1837 1838 1839 1840 1841 </div> 1842 <div class="jd-details-descr"> 1843 1844 <div class="jd-tagdata jd-tagdescr"><p>Used with <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> to request the best accuracy possible with zero additional 1845 power consumption. 1846 1847 <p>No locations will be returned unless a different client has requested location updates 1848 in which case this request will act as a passive listener to those locations. 1849</p></div> 1850 1851 1852 <div class="jd-tagdata"> 1853 <span class="jd-tagtitle">Constant Value: </span> 1854 <span> 1855 1856 105 1857 (0x00000069) 1858 1859 </span> 1860 </div> 1861 1862 </div> 1863</div> 1864 1865 1866 1867 1868<!-- Fields --> 1869 1870 1871<!-- Public ctors --> 1872 1873 1874 1875<!-- ========= CONSTRUCTOR DETAIL ======== --> 1876<!-- Protected ctors --> 1877 1878 1879 1880<!-- ========= METHOD DETAIL ======== --> 1881<!-- Public methdos --> 1882 1883<h2>Public Methods</h2> 1884 1885 1886 1887<A NAME="create()"></A> 1888 1889<div class="jd-details api apilevel-"> 1890 <h4 class="jd-details-title"> 1891 <span class="normal"> 1892 public 1893 static 1894 1895 1896 1897 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 1898 </span> 1899 <span class="sympad">create</span> 1900 <span class="normal">()</span> 1901 </h4> 1902 <div class="api-level"> 1903 <div></div> 1904 1905 1906 1907 </div> 1908 <div class="jd-details-descr"> 1909 1910 <div class="jd-tagdata jd-tagdescr"><p>Create a location request with default parameters. 1911 1912 <p>Default parameters are for a block accuracy, slowly updated location. It can then be 1913 adjusted as required by the applications before passing to the 1914 <code><a href="/reference/com/google/android/gms/location/FusedLocationProviderApi.html">FusedLocationProviderApi</a></code>.</p></div> 1915 <div class="jd-tagdata"> 1916 <h5 class="jd-tagtitle">Returns</h5> 1917 <ul class="nolist"><li>a new location request 1918</li></ul> 1919 </div> 1920 1921 </div> 1922</div> 1923 1924 1925<A NAME="describeContents()"></A> 1926 1927<div class="jd-details api apilevel-"> 1928 <h4 class="jd-details-title"> 1929 <span class="normal"> 1930 public 1931 1932 1933 1934 1935 int 1936 </span> 1937 <span class="sympad">describeContents</span> 1938 <span class="normal">()</span> 1939 </h4> 1940 <div class="api-level"> 1941 <div></div> 1942 1943 1944 1945 </div> 1946 <div class="jd-details-descr"> 1947 1948 <div class="jd-tagdata jd-tagdescr"><p></p></div> 1949 1950 </div> 1951</div> 1952 1953 1954<A NAME="equals(java.lang.Object)"></A> 1955 1956<div class="jd-details api apilevel-"> 1957 <h4 class="jd-details-title"> 1958 <span class="normal"> 1959 public 1960 1961 1962 1963 1964 boolean 1965 </span> 1966 <span class="sympad">equals</span> 1967 <span class="normal">(Object object)</span> 1968 </h4> 1969 <div class="api-level"> 1970 <div></div> 1971 1972 1973 1974 </div> 1975 <div class="jd-details-descr"> 1976 1977 <div class="jd-tagdata jd-tagdescr"><p></p></div> 1978 1979 </div> 1980</div> 1981 1982 1983<A NAME="getExpirationTime()"></A> 1984 1985<div class="jd-details api apilevel-"> 1986 <h4 class="jd-details-title"> 1987 <span class="normal"> 1988 public 1989 1990 1991 1992 1993 long 1994 </span> 1995 <span class="sympad">getExpirationTime</span> 1996 <span class="normal">()</span> 1997 </h4> 1998 <div class="api-level"> 1999 <div></div> 2000 2001 2002 2003 </div> 2004 <div class="jd-details-descr"> 2005 2006 <div class="jd-tagdata jd-tagdescr"><p>Get the request expiration time, in milliseconds since boot. 2007 2008 <p>This value can be compared to <code><a href="/reference/android/os/SystemClock.html#elapsedRealtime()">elapsedRealtime()</a></code> to determine the time 2009 until expiration.</p></div> 2010 <div class="jd-tagdata"> 2011 <h5 class="jd-tagtitle">Returns</h5> 2012 <ul class="nolist"><li>expiration time of request, in milliseconds since boot including suspend 2013</li></ul> 2014 </div> 2015 2016 </div> 2017</div> 2018 2019 2020<A NAME="getFastestInterval()"></A> 2021 2022<div class="jd-details api apilevel-"> 2023 <h4 class="jd-details-title"> 2024 <span class="normal"> 2025 public 2026 2027 2028 2029 2030 long 2031 </span> 2032 <span class="sympad">getFastestInterval</span> 2033 <span class="normal">()</span> 2034 </h4> 2035 <div class="api-level"> 2036 <div></div> 2037 2038 2039 2040 </div> 2041 <div class="jd-details-descr"> 2042 2043 <div class="jd-tagdata jd-tagdescr"><p>Get the fastest interval of this request, in milliseconds. 2044 2045 <p>The system will never provide location updates faster than the minimum of 2046 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval()">getFastestInterval()</a></code> and <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#getInterval()">getInterval()</a></code>.</p></div> 2047 <div class="jd-tagdata"> 2048 <h5 class="jd-tagtitle">Returns</h5> 2049 <ul class="nolist"><li>fastest interval in milliseconds, exact 2050</li></ul> 2051 </div> 2052 2053 </div> 2054</div> 2055 2056 2057<A NAME="getInterval()"></A> 2058 2059<div class="jd-details api apilevel-"> 2060 <h4 class="jd-details-title"> 2061 <span class="normal"> 2062 public 2063 2064 2065 2066 2067 long 2068 </span> 2069 <span class="sympad">getInterval</span> 2070 <span class="normal">()</span> 2071 </h4> 2072 <div class="api-level"> 2073 <div></div> 2074 2075 2076 2077 </div> 2078 <div class="jd-details-descr"> 2079 2080 <div class="jd-tagdata jd-tagdescr"><p>Get the desired interval of this request, in milliseconds.</p></div> 2081 <div class="jd-tagdata"> 2082 <h5 class="jd-tagtitle">Returns</h5> 2083 <ul class="nolist"><li>desired interval in milliseconds, inexact 2084</li></ul> 2085 </div> 2086 2087 </div> 2088</div> 2089 2090 2091<A NAME="getNumUpdates()"></A> 2092 2093<div class="jd-details api apilevel-"> 2094 <h4 class="jd-details-title"> 2095 <span class="normal"> 2096 public 2097 2098 2099 2100 2101 int 2102 </span> 2103 <span class="sympad">getNumUpdates</span> 2104 <span class="normal">()</span> 2105 </h4> 2106 <div class="api-level"> 2107 <div></div> 2108 2109 2110 2111 </div> 2112 <div class="jd-details-descr"> 2113 2114 <div class="jd-tagdata jd-tagdescr"><p>Get the number of updates requested. 2115 2116 <p>By default this is <code><a href="/reference/java/lang/Integer.html#MAX_VALUE">MAX_VALUE</a></code>, which indicates that locations are updated 2117 until the request is explicitly removed.</p></div> 2118 <div class="jd-tagdata"> 2119 <h5 class="jd-tagtitle">Returns</h5> 2120 <ul class="nolist"><li>number of updates 2121</li></ul> 2122 </div> 2123 2124 </div> 2125</div> 2126 2127 2128<A NAME="getPriority()"></A> 2129 2130<div class="jd-details api apilevel-"> 2131 <h4 class="jd-details-title"> 2132 <span class="normal"> 2133 public 2134 2135 2136 2137 2138 int 2139 </span> 2140 <span class="sympad">getPriority</span> 2141 <span class="normal">()</span> 2142 </h4> 2143 <div class="api-level"> 2144 <div></div> 2145 2146 2147 2148 </div> 2149 <div class="jd-details-descr"> 2150 2151 <div class="jd-tagdata jd-tagdescr"><p>Get the quality of the request.</p></div> 2152 <div class="jd-tagdata"> 2153 <h5 class="jd-tagtitle">Returns</h5> 2154 <ul class="nolist"><li>an accuracy constant 2155</li></ul> 2156 </div> 2157 2158 </div> 2159</div> 2160 2161 2162<A NAME="getSmallestDisplacement()"></A> 2163 2164<div class="jd-details api apilevel-"> 2165 <h4 class="jd-details-title"> 2166 <span class="normal"> 2167 public 2168 2169 2170 2171 2172 float 2173 </span> 2174 <span class="sympad">getSmallestDisplacement</span> 2175 <span class="normal">()</span> 2176 </h4> 2177 <div class="api-level"> 2178 <div></div> 2179 2180 2181 2182 </div> 2183 <div class="jd-details-descr"> 2184 2185 <div class="jd-tagdata jd-tagdescr"><p>Get the minimum displacement between location updates in meters 2186 2187 <p>By default this is 0.</p></div> 2188 <div class="jd-tagdata"> 2189 <h5 class="jd-tagtitle">Returns</h5> 2190 <ul class="nolist"><li>minimum displacement between location updates in meters 2191</li></ul> 2192 </div> 2193 2194 </div> 2195</div> 2196 2197 2198<A NAME="hashCode()"></A> 2199 2200<div class="jd-details api apilevel-"> 2201 <h4 class="jd-details-title"> 2202 <span class="normal"> 2203 public 2204 2205 2206 2207 2208 int 2209 </span> 2210 <span class="sympad">hashCode</span> 2211 <span class="normal">()</span> 2212 </h4> 2213 <div class="api-level"> 2214 <div></div> 2215 2216 2217 2218 </div> 2219 <div class="jd-details-descr"> 2220 2221 <div class="jd-tagdata jd-tagdescr"><p></p></div> 2222 2223 </div> 2224</div> 2225 2226 2227<A NAME="setExpirationDuration(long)"></A> 2228 2229<div class="jd-details api apilevel-"> 2230 <h4 class="jd-details-title"> 2231 <span class="normal"> 2232 public 2233 2234 2235 2236 2237 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2238 </span> 2239 <span class="sympad">setExpirationDuration</span> 2240 <span class="normal">(long millis)</span> 2241 </h4> 2242 <div class="api-level"> 2243 <div></div> 2244 2245 2246 2247 </div> 2248 <div class="jd-details-descr"> 2249 2250 <div class="jd-tagdata jd-tagdescr"><p>Set the duration of this request, in milliseconds. 2251 2252 <p>The duration begins immediately (and not when the request is passed to the location 2253 client), so call this method again if the request is re-used at a later time. 2254 2255 <p>The location client will automatically stop updates after the request expires. 2256 2257 <p>The duration includes suspend time. Values less than 0 are allowed, but indicate that 2258 the request has already expired.</p></div> 2259 <div class="jd-tagdata"> 2260 <h5 class="jd-tagtitle">Parameters</h5> 2261 <table class="jd-tagtable"> 2262 <tr> 2263 <th>millis</td> 2264 <td>duration of request in milliseconds</td> 2265 </tr> 2266 </table> 2267 </div> 2268 <div class="jd-tagdata"> 2269 <h5 class="jd-tagtitle">Returns</h5> 2270 <ul class="nolist"><li>the same object, so that setters can be chained 2271</li></ul> 2272 </div> 2273 2274 </div> 2275</div> 2276 2277 2278<A NAME="setExpirationTime(long)"></A> 2279 2280<div class="jd-details api apilevel-"> 2281 <h4 class="jd-details-title"> 2282 <span class="normal"> 2283 public 2284 2285 2286 2287 2288 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2289 </span> 2290 <span class="sympad">setExpirationTime</span> 2291 <span class="normal">(long millis)</span> 2292 </h4> 2293 <div class="api-level"> 2294 <div></div> 2295 2296 2297 2298 </div> 2299 <div class="jd-details-descr"> 2300 2301 <div class="jd-tagdata jd-tagdescr"><p>Set the request expiration time, in millisecond since boot. 2302 2303 <p>This expiration time uses the same time base as <code><a href="/reference/android/os/SystemClock.html#elapsedRealtime()">elapsedRealtime()</a></code>. 2304 2305 <p>The location client will automatically stop updates after the request expires. 2306 2307 <p>The duration includes suspend time. Values before <code><a href="/reference/android/os/SystemClock.html#elapsedRealtime()">elapsedRealtime()</a></code> 2308 are allowed, but indicate that the request has already expired.</p></div> 2309 <div class="jd-tagdata"> 2310 <h5 class="jd-tagtitle">Parameters</h5> 2311 <table class="jd-tagtable"> 2312 <tr> 2313 <th>millis</td> 2314 <td>expiration time of request, in milliseconds since boot including suspend</td> 2315 </tr> 2316 </table> 2317 </div> 2318 <div class="jd-tagdata"> 2319 <h5 class="jd-tagtitle">Returns</h5> 2320 <ul class="nolist"><li>the same object, so that setters can be chained 2321</li></ul> 2322 </div> 2323 2324 </div> 2325</div> 2326 2327 2328<A NAME="setFastestInterval(long)"></A> 2329 2330<div class="jd-details api apilevel-"> 2331 <h4 class="jd-details-title"> 2332 <span class="normal"> 2333 public 2334 2335 2336 2337 2338 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2339 </span> 2340 <span class="sympad">setFastestInterval</span> 2341 <span class="normal">(long millis)</span> 2342 </h4> 2343 <div class="api-level"> 2344 <div></div> 2345 2346 2347 2348 </div> 2349 <div class="jd-details-descr"> 2350 2351 <div class="jd-tagdata jd-tagdescr"><p>Explicitly set the fastest interval for location updates, in milliseconds. 2352 2353 <p>This controls the fastest rate at which your application will receive location updates, 2354 which might be faster than <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code> in some situations (for example, if other 2355 applications are triggering location updates). 2356 2357 <p>This allows your application to passively acquire locations at a rate faster than it 2358 actively acquires locations, saving power. 2359 2360 <p>Unlike <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code>, this parameter is exact. Your application will never 2361 receive updates faster than this value. 2362 2363 <p>If you don't call this method, a fastest interval will be selected for you. It will be 2364 a value faster than your active interval (<code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code>). 2365 2366 <p>An interval of 0 is allowed, but not recommended, since location updates may be 2367 extremely fast on future implementations. 2368 2369 <p>If <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval(long)</a></code> is set slower than <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code>, then your 2370 effective fastest interval is <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code>.</p></div> 2371 <div class="jd-tagdata"> 2372 <h5 class="jd-tagtitle">Parameters</h5> 2373 <table class="jd-tagtable"> 2374 <tr> 2375 <th>millis</td> 2376 <td>fastest interval for updates in milliseconds, exact</td> 2377 </tr> 2378 </table> 2379 </div> 2380 <div class="jd-tagdata"> 2381 <h5 class="jd-tagtitle">Returns</h5> 2382 <ul class="nolist"><li>the same object, so that setters can be chained 2383</li></ul> 2384 </div> 2385 <div class="jd-tagdata"> 2386 <h5 class="jd-tagtitle">Throws</h5> 2387 <table class="jd-tagtable"> 2388 <tr> 2389 <th>IllegalArgumentException</td> 2390 <td>if the interval is less than zero</td> 2391 </tr> 2392 </table> 2393 </div> 2394 2395 </div> 2396</div> 2397 2398 2399<A NAME="setInterval(long)"></A> 2400 2401<div class="jd-details api apilevel-"> 2402 <h4 class="jd-details-title"> 2403 <span class="normal"> 2404 public 2405 2406 2407 2408 2409 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2410 </span> 2411 <span class="sympad">setInterval</span> 2412 <span class="normal">(long millis)</span> 2413 </h4> 2414 <div class="api-level"> 2415 <div></div> 2416 2417 2418 2419 </div> 2420 <div class="jd-details-descr"> 2421 2422 <div class="jd-tagdata jd-tagdescr"><p>Set the desired interval for active location updates, in milliseconds. 2423 2424 <p>The location client will actively try to obtain location updates for your application 2425 at this interval, so it has a direct influence on the amount of power used by your 2426 application. Choose your interval wisely. 2427 2428 <p>This interval is inexact. You may not receive updates at all (if no location sources 2429 are available), or you may receive them slower than requested. You may also receive them 2430 faster than requested (if other applications are requesting location at a faster interval). 2431 The fastest rate that that you will receive updates can be controlled with 2432 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)">setFastestInterval(long)</a></code>. By default this fastest rate is 6x the interval frequency. 2433 2434 <p>Applications with only the coarse location permission may have their interval silently 2435 throttled. 2436 2437 <p>An interval of 0 is allowed, but not recommended, since location updates may be extremely 2438 fast on future implementations. 2439 2440 <p><code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> and <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code> are the most important parameters 2441 on a location request.</p></div> 2442 <div class="jd-tagdata"> 2443 <h5 class="jd-tagtitle">Parameters</h5> 2444 <table class="jd-tagtable"> 2445 <tr> 2446 <th>millis</td> 2447 <td>desired interval in millisecond, inexact</td> 2448 </tr> 2449 </table> 2450 </div> 2451 <div class="jd-tagdata"> 2452 <h5 class="jd-tagtitle">Returns</h5> 2453 <ul class="nolist"><li>the same object, so that setters can be chained 2454</li></ul> 2455 </div> 2456 <div class="jd-tagdata"> 2457 <h5 class="jd-tagtitle">Throws</h5> 2458 <table class="jd-tagtable"> 2459 <tr> 2460 <th>IllegalArgumentException</td> 2461 <td>if the interval is less than zero</td> 2462 </tr> 2463 </table> 2464 </div> 2465 2466 </div> 2467</div> 2468 2469 2470<A NAME="setNumUpdates(int)"></A> 2471 2472<div class="jd-details api apilevel-"> 2473 <h4 class="jd-details-title"> 2474 <span class="normal"> 2475 public 2476 2477 2478 2479 2480 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2481 </span> 2482 <span class="sympad">setNumUpdates</span> 2483 <span class="normal">(int numUpdates)</span> 2484 </h4> 2485 <div class="api-level"> 2486 <div></div> 2487 2488 2489 2490 </div> 2491 <div class="jd-details-descr"> 2492 2493 <div class="jd-tagdata jd-tagdescr"><p>Set the number of location updates. 2494 2495 <p>By default locations are continuously updated until the request is explicitly removed, 2496 however you can optionally request a set number of updates. For example, if your 2497 application only needs a single fresh location, then call this method with a value of 1 2498 before passing the request to the location client. 2499 2500 <p>When using this option care must be taken to either explicitly remove the request 2501 when no longer needed or to set an expiration with (<code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setExpirationDuration(long)">setExpirationDuration(long)</a></code> or 2502 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setExpirationTime(long)">setExpirationTime(long)</a></code>. Otherwise in some cases if a location can't be computed, this 2503 request could stay active indefinitely consuming power.</p></div> 2504 <div class="jd-tagdata"> 2505 <h5 class="jd-tagtitle">Parameters</h5> 2506 <table class="jd-tagtable"> 2507 <tr> 2508 <th>numUpdates</td> 2509 <td>the number of location updates requested</td> 2510 </tr> 2511 </table> 2512 </div> 2513 <div class="jd-tagdata"> 2514 <h5 class="jd-tagtitle">Returns</h5> 2515 <ul class="nolist"><li>the same object, so that setters can be chained 2516</li></ul> 2517 </div> 2518 <div class="jd-tagdata"> 2519 <h5 class="jd-tagtitle">Throws</h5> 2520 <table class="jd-tagtable"> 2521 <tr> 2522 <th>IllegalArgumentException</td> 2523 <td>if numUpdates is 0 or less</td> 2524 </tr> 2525 </table> 2526 </div> 2527 2528 </div> 2529</div> 2530 2531 2532<A NAME="setPriority(int)"></A> 2533 2534<div class="jd-details api apilevel-"> 2535 <h4 class="jd-details-title"> 2536 <span class="normal"> 2537 public 2538 2539 2540 2541 2542 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2543 </span> 2544 <span class="sympad">setPriority</span> 2545 <span class="normal">(int priority)</span> 2546 </h4> 2547 <div class="api-level"> 2548 <div></div> 2549 2550 2551 2552 </div> 2553 <div class="jd-details-descr"> 2554 2555 <div class="jd-tagdata jd-tagdescr"><p>Set the priority of the request. 2556 2557 <p>Use with a priority constant such as <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_HIGH_ACCURACY">PRIORITY_HIGH_ACCURACY</a></code>. No other values 2558 are accepted. 2559 2560 <p>The priority of the request is a strong hint to the LocationClient for which location 2561 sources to use. For example, <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_HIGH_ACCURACY">PRIORITY_HIGH_ACCURACY</a></code> is more likely to use GPS, and 2562 <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_BALANCED_POWER_ACCURACY">PRIORITY_BALANCED_POWER_ACCURACY</a></code> is more likely to use WIFI & Cell tower 2563 positioning, but it also depends on many other factors (such as which sources are available) 2564 and is implementation dependent. 2565 2566 <p><code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setPriority(int)">setPriority(int)</a></code> and <code><a href="/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)">setInterval(long)</a></code> are the most important parameters 2567 on a location request.</p></div> 2568 <div class="jd-tagdata"> 2569 <h5 class="jd-tagtitle">Parameters</h5> 2570 <table class="jd-tagtable"> 2571 <tr> 2572 <th>priority</td> 2573 <td>an accuracy or power constant</td> 2574 </tr> 2575 </table> 2576 </div> 2577 <div class="jd-tagdata"> 2578 <h5 class="jd-tagtitle">Returns</h5> 2579 <ul class="nolist"><li>the same object, so that setters can be chained 2580</li></ul> 2581 </div> 2582 <div class="jd-tagdata"> 2583 <h5 class="jd-tagtitle">Throws</h5> 2584 <table class="jd-tagtable"> 2585 <tr> 2586 <th>IllegalArgumentException</td> 2587 <td>if the quality constant is not valid</td> 2588 </tr> 2589 </table> 2590 </div> 2591 2592 </div> 2593</div> 2594 2595 2596<A NAME="setSmallestDisplacement(float)"></A> 2597 2598<div class="jd-details api apilevel-"> 2599 <h4 class="jd-details-title"> 2600 <span class="normal"> 2601 public 2602 2603 2604 2605 2606 <a href="/reference/com/google/android/gms/location/LocationRequest.html">LocationRequest</a> 2607 </span> 2608 <span class="sympad">setSmallestDisplacement</span> 2609 <span class="normal">(float smallestDisplacementMeters)</span> 2610 </h4> 2611 <div class="api-level"> 2612 <div></div> 2613 2614 2615 2616 </div> 2617 <div class="jd-details-descr"> 2618 2619 <div class="jd-tagdata jd-tagdescr"><p>Set the minimum displacement between location updates in meters 2620 2621 <p>By default this is 0.</p></div> 2622 <div class="jd-tagdata"> 2623 <h5 class="jd-tagtitle">Parameters</h5> 2624 <table class="jd-tagtable"> 2625 <tr> 2626 <th>smallestDisplacementMeters</td> 2627 <td>the smallest displacement in meters the user must move 2628 between location updates.</td> 2629 </tr> 2630 </table> 2631 </div> 2632 <div class="jd-tagdata"> 2633 <h5 class="jd-tagtitle">Returns</h5> 2634 <ul class="nolist"><li>the same object, so that setters can be chained 2635</li></ul> 2636 </div> 2637 <div class="jd-tagdata"> 2638 <h5 class="jd-tagtitle">Throws</h5> 2639 <table class="jd-tagtable"> 2640 <tr> 2641 <th>IllegalArgumentException</td> 2642 <td>if smallestDisplacementMeters is negative</td> 2643 </tr> 2644 </table> 2645 </div> 2646 2647 </div> 2648</div> 2649 2650 2651<A NAME="toString()"></A> 2652 2653<div class="jd-details api apilevel-"> 2654 <h4 class="jd-details-title"> 2655 <span class="normal"> 2656 public 2657 2658 2659 2660 2661 String 2662 </span> 2663 <span class="sympad">toString</span> 2664 <span class="normal">()</span> 2665 </h4> 2666 <div class="api-level"> 2667 <div></div> 2668 2669 2670 2671 </div> 2672 <div class="jd-details-descr"> 2673 2674 <div class="jd-tagdata jd-tagdescr"><p></p></div> 2675 2676 </div> 2677</div> 2678 2679 2680<A NAME="writeToParcel(android.os.Parcel, int)"></A> 2681 2682<div class="jd-details api apilevel-"> 2683 <h4 class="jd-details-title"> 2684 <span class="normal"> 2685 public 2686 2687 2688 2689 2690 void 2691 </span> 2692 <span class="sympad">writeToParcel</span> 2693 <span class="normal">(Parcel parcel, int flags)</span> 2694 </h4> 2695 <div class="api-level"> 2696 <div></div> 2697 2698 2699 2700 </div> 2701 <div class="jd-details-descr"> 2702 2703 <div class="jd-tagdata jd-tagdescr"><p></p></div> 2704 2705 </div> 2706</div> 2707 2708 2709 2710 2711 2712<!-- ========= METHOD DETAIL ======== --> 2713 2714 2715 2716<!-- ========= END OF CLASS DATA ========= --> 2717<A NAME="navbar_top"></A> 2718 2719<div id="footer" class="wrap" > 2720 2721 2722 <div id="copyright"> 2723 2724 Except as noted, this content is licensed under <a 2725 href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. 2726 For details and restrictions, see the <a href="/license.html"> 2727 Content License</a>. 2728 </div> 2729 <div id="build_info"> 2730 2731<script src="/timestamp.js" type="text/javascript"></script> 2732<script>document.write(BUILD_TIMESTAMP)</script> 2733 2734 </div> 2735 2736 2737 <div id="footerlinks"> 2738 2739 <p> 2740 <a href="/about/index.html">About Android</a> | 2741 <a href="/legal.html">Legal</a> | 2742 <a href="/support.html">Support</a> 2743 </p> 2744 </div> 2745 2746</div> <!-- end footer --> 2747</div> <!-- jd-content --> 2748 2749</div><!-- end doc-content --> 2750 2751</div> <!-- end body-content --> 2752 2753 2754 2755 2756 2757 2758</body> 2759</html> 2760