瀏覽代碼

first commit

xuxinyi 1 年之前
當前提交
58153099d8
共有 100 個文件被更改,包括 7911 次插入0 次删除
  1. 3 0
      .idea/.gitignore
  2. 201 0
      LICENSE
  3. 35 0
      README.md
  4. 36 0
      README_ZH.md
  5. 二進制
      images/home.jpg
  6. 二進制
      images/locationgetlast.jpg
  7. 二進制
      images/locationhd.jpg
  8. 53 0
      locationkit-java-sample/LICENSE
  9. 45 0
      locationkit-java-sample/README.md
  10. 18 0
      locationkit-java-sample/Third Party Open Source Software Notice.doc
  11. 137 0
      locationkit-java-sample/app/app.iml
  12. 68 0
      locationkit-java-sample/app/build.gradle
  13. 29 0
      locationkit-java-sample/app/proguard-rules.pro
  14. 100 0
      locationkit-java-sample/app/src/main/AndroidManifest.xml
  15. 12 0
      locationkit-java-sample/app/src/main/assets/ActivityTransitionRequest.json
  16. 4 0
      locationkit-java-sample/app/src/main/assets/CheckLocationSettings.json
  17. 11 0
      locationkit-java-sample/app/src/main/assets/LocationRequest.json
  18. 二進制
      locationkit-java-sample/app/src/main/assets/ic_launcher-web.png
  19. 30 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/Constant.java
  20. 81 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/CoordinateConverterActivity.java
  21. 209 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/HuaweiLocationActivity.java
  22. 59 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/JsonDataUtil.java
  23. 377 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/LogInfoUtil.java
  24. 88 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/NavigationContextStateActivity.java
  25. 38 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/NoDoubleClickUtils.java
  26. 96 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/RequestPermission.java
  27. 128 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/WriteLogActivity.java
  28. 260 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/activity/ActivityConversionActivity.java
  29. 277 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/activity/ActivityIdentificationActivity.java
  30. 302 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/geofence/GeoFenceActivity.java
  31. 74 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/geofence/GeoFenceBroadcastReceiver.java
  32. 390 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/geofence/OperateGeoFenceActivity.java
  33. 189 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/CheckSettingActivity.java
  34. 96 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/GetLastLocationActivity.java
  35. 92 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/GetLocationAvailabilityActivity.java
  36. 94 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/LocationBaseActivity.java
  37. 130 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/LocationBroadcastReceiver.java
  38. 420 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/RequestLocationUpdatesHDWithCallbackActivity.java
  39. 228 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/RequestLocationUpdatesWithCallbackActivity.java
  40. 162 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/RequestLocationUpdatesWithIntentActivity.java
  41. 99 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/SetMockLocationActivity.java
  42. 111 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/SetMockModeActivity.java
  43. 79 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/util/CoordinateConverterUtil.java
  44. 57 0
      locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/util/NotificationUtil.java
  45. 89 0
      locationkit-java-sample/app/src/main/java/com/huawei/logger/LocationLog.java
  46. 49 0
      locationkit-java-sample/app/src/main/java/com/huawei/logger/LogCatWrapper.java
  47. 118 0
      locationkit-java-sample/app/src/main/java/com/huawei/logger/LogFragment.java
  48. 29 0
      locationkit-java-sample/app/src/main/java/com/huawei/logger/LogNode.java
  49. 103 0
      locationkit-java-sample/app/src/main/java/com/huawei/logger/LogView.java
  50. 50 0
      locationkit-java-sample/app/src/main/java/com/huawei/logger/LoggerActivity.java
  51. 二進制
      locationkit-java-sample/app/src/main/res/drawable-hdpi/ic_launcher.png
  52. 二進制
      locationkit-java-sample/app/src/main/res/drawable-mdpi/ic_launcher.png
  53. 9 0
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_blue_circle_side.xml
  54. 6 0
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_btn_selector.xml
  55. 8 0
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_white_circle.xml
  56. 8 0
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_white_pressed_circle.xml
  57. 二進制
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/huawei_logo.png
  58. 二進制
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/ic_launcher.png
  59. 二進制
      locationkit-java-sample/app/src/main/res/drawable-xhdpi/ic_push_notification.png
  60. 二進制
      locationkit-java-sample/app/src/main/res/drawable-xxhdpi/ic_launcher.png
  61. 55 0
      locationkit-java-sample/app/src/main/res/layout/activity_check_setting.xml
  62. 101 0
      locationkit-java-sample/app/src/main/res/layout/activity_coordinate_converter.xml
  63. 249 0
      locationkit-java-sample/app/src/main/res/layout/activity_geo_fence.xml
  64. 87 0
      locationkit-java-sample/app/src/main/res/layout/activity_hms_hd.xml
  65. 91 0
      locationkit-java-sample/app/src/main/res/layout/activity_huaweilocation.xml
  66. 26 0
      locationkit-java-sample/app/src/main/res/layout/activity_location_get_last_location.xml
  67. 27 0
      locationkit-java-sample/app/src/main/res/layout/activity_location_get_location_availability.xml
  68. 51 0
      locationkit-java-sample/app/src/main/res/layout/activity_location_request_location_updates_callback.xml
  69. 50 0
      locationkit-java-sample/app/src/main/res/layout/activity_location_request_location_updates_intent.xml
  70. 41 0
      locationkit-java-sample/app/src/main/res/layout/activity_location_set_mock_location.xml
  71. 62 0
      locationkit-java-sample/app/src/main/res/layout/activity_location_set_mock_mode.xml
  72. 46 0
      locationkit-java-sample/app/src/main/res/layout/activity_navigation_context_state.xml
  73. 212 0
      locationkit-java-sample/app/src/main/res/layout/activity_operate_geo_fence.xml
  74. 70 0
      locationkit-java-sample/app/src/main/res/layout/activity_request_activity_transition.xml
  75. 65 0
      locationkit-java-sample/app/src/main/res/layout/activity_request_activity_updates.xml
  76. 388 0
      locationkit-java-sample/app/src/main/res/layout/activity_transition.xml
  77. 242 0
      locationkit-java-sample/app/src/main/res/layout/activity_transition_type.xml
  78. 134 0
      locationkit-java-sample/app/src/main/res/layout/activity_wirte_log.xml
  79. 49 0
      locationkit-java-sample/app/src/main/res/layout/detected_activity_layout.xml
  80. 25 0
      locationkit-java-sample/app/src/main/res/layout/item_background_location.xml
  81. 18 0
      locationkit-java-sample/app/src/main/res/layout/pending_intent_activity_layout.xml
  82. 二進制
      locationkit-java-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png
  83. 二進制
      locationkit-java-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png
  84. 二進制
      locationkit-java-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  85. 二進制
      locationkit-java-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  86. 二進制
      locationkit-java-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  87. 17 0
      locationkit-java-sample/app/src/main/res/values/colors.xml
  88. 15 0
      locationkit-java-sample/app/src/main/res/values/dimens.xml
  89. 40 0
      locationkit-java-sample/app/src/main/res/values/strings.xml
  90. 60 0
      locationkit-java-sample/app/src/main/res/values/styles.xml
  91. 27 0
      locationkit-java-sample/build.gradle
  92. 19 0
      locationkit-java-sample/gradle.properties
  93. 二進制
      locationkit-java-sample/gradle/wrapper/gradle-wrapper.jar
  94. 6 0
      locationkit-java-sample/gradle/wrapper/gradle-wrapper.properties
  95. 160 0
      locationkit-java-sample/gradlew
  96. 90 0
      locationkit-java-sample/gradlew.bat
  97. 二進制
      locationkit-java-sample/images/home.png
  98. 二進制
      locationkit-java-sample/images/locationgetlast.png
  99. 二進制
      locationkit-java-sample/images/locationhd.png
  100. 1 0
      locationkit-java-sample/settings.gradle

+ 3 - 0
.idea/.gitignore

@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml

+ 201 - 0
LICENSE

@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

+ 35 - 0
README.md

@@ -0,0 +1,35 @@
+#  HMS Core Location Kit Sample Code (Android)
+English | [中文](README_ZH.md)
+
+## Contents
+ * [Introduction](#Introduction)
+ * [Preparations](#Preparations)
+ * [Installation](#Installation)
+ * [Environment Requirements](#Environment-Requirements)
+ * [Result](#Result)
+ * [Technical Support](#Technical-Support)
+ * [License](#License)
+
+## Introduction
+The sample code encapsulates APIs of HMS Core Location Kit, and provides many sample programs for your reference or use.
+## Preparations
+The sample code is built using Gradle to demonstrate how to use the Location SDK for Android. First, download the sample code by cloning this repository or downloading the archived snapshot. In Android Studio, click **Open an existing Android Studio project** and select the directory where the **sample** file is located. You can use the **gradlew build** command to directly build the project. Then, you need to create an app in AppGallery Connect, obtain the **agconnect-services.json** file, and add it to the project. You also need to generate a signing certificate fingerprint, add the signing certificate file to the project, and add related configurations to the **build.gradle** file. For details, please refer to "Configuring App Information in AppGallery Connect" in the official development guide.
+## Installation
+1.	Clone or download the project and open it using Android Studio or a compatible IDE.
+2.	Use the IDE to install the configured project on your device.
+## Environment Requirements
+A Huawei phone or tablet running EMUI 5.0 or later, or a non-Huawei phone running Android 5.1 or later.
+## Result
+<img src="images/home.jpg" width = 20% height = 20%> <img src="images/locationgetlast.jpg" width = 20% height = 20%> <img src="images/locationhd.jpg" width = 20% height = 20%>
+
+## Technical Support
+You can visit the [Reddit community](https://www.reddit.com/r/HuaweiDevelopers/) to obtain the latest information about HMS Core and communicate with other developers.
+
+If you have any questions about the sample code, try the following:
+- Visit [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes), submit your questions, and tag them with `huawei-mobile-services`. Huawei experts will answer your questions.
+- Visit the HMS Core section in the [HUAWEI Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001?ha_source=hms1) and communicate with other developers.
+
+If you encounter any issues when using the sample code, submit your [issues](https://github.com/HMS-Core/hms-location-demo/issues) or submit a [pull request](https://github.com/HMS-Core/hms-location-demo/pulls).
+
+## License
+The sample code is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).

+ 36 - 0
README_ZH.md

@@ -0,0 +1,36 @@
+#  华为定位服务安卓版示例代码
+中文 | [English](README.md)
+
+## 目录
+ * [简介](#简介)
+ * [开发准备](#开发准备)
+ * [安装](#安装)
+ * [环境要求](#环境要求)
+ * [结果](#结果)
+ * [技术支持](#技术支持)
+ * [授权许可](#授权许可)
+
+## 简介
+华为定位服务示例代码封装有华为定位服务的接口。 其提供许多示例程序供你参考或使用。
+## 开发准备
+我们还提供一个示例来展示如何使用安卓版定位服务SDK。 该示例使用Gradle编译系统。 首先通过克隆改仓库或者下载归档的快照来下载示例代码。 在Android Stuido中,选择Open an existing Android Studio project,然后选择示例文件所在的目录。 你可以使用gradlew build命令来直接编译项目。 你应该在AppGallery Connect中创建一个应用,获取agconnect-services.json文件并将其加入到你的项目中。 你还应生成一个签名证书指纹,将证书文件添加到你的项目中,并在build.gradle文件中添加配置。 参见“配置AppGallery Connect”在AppGallery Connect配置应用信息。
+## 安装
+1.	克隆或者下载该项目,在Android Studio或者兼容的IDE中打开下载的文件夹。
+2.	使用IDE功能在你的设备上安装配置的项目。
+## 环境要求
+EMUI 5.0及以上的华为手机、华为平板或Android 5.1及以上的非华为手机。
+## 结果
+<img src="images/home.jpg" width = 20% height = 20%> <img src="images/locationgetlast.jpg" width = 20% height = 20%> <img src="images/locationhd.jpg" width = 20% height = 20%>
+
+## 技术支持
+如果您对HMS Core还处于评估阶段,可在[Reddit社区](https://www.reddit.com/r/HuaweiDevelopers/
+)获取关于HMS Core的最新讯息,并与其他开发者交流见解。
+
+如果您对使用HMS示例代码有疑问,请尝试:
+- 开发过程遇到问题上[Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes),在`huawei-mobile-services`标签下提问,有华为研发专家在线一对一解决您的问题。
+- 到[华为开发者论坛](https://developer.huawei.com/consumer/cn/forum/blockdisplay?fid=18) HMS Core板块与其他开发者进行交流。
+
+如果您在尝试示例代码中遇到问题,请向仓库提交[issue](https://github.com/HMS-Core/hms-location-demo/issues),也欢迎您提交[Pull Request](https://github.com/HMS-Core/hms-location-demo/pulls)。
+
+## 授权许可
+定位服务Java示例代码经过[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)授权许可。

二進制
images/home.jpg


二進制
images/locationgetlast.jpg


二進制
images/locationhd.jpg


+ 53 - 0
locationkit-java-sample/LICENSE

@@ -0,0 +1,53 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 
+
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS

+ 45 - 0
locationkit-java-sample/README.md

@@ -0,0 +1,45 @@
+##  huawei-location-android-demo
+
+
+## Table of Contents
+
+ * [Introduction](#introduction)
+ * [Getting Started](#getting-started)
+ * [Installation](#installation)
+ * [Supported Environments](#supported-environments)
+ * [Sample Code](#sample-code)
+ * [Result](#result)
+ * [License](#license)
+ 
+ 
+## Introduction
+HUAWEI Location Kit sample code encapsulates APIs of the HUAWEI Location Kit. It provides many sample programs for your reference or usage.
+   
+## Getting Started
+We also provide an sample to demonstrate the use of LocationKit SDK for Android.
+This sample uses the Gradle build system.
+First download the demo by cloning this repository or downloading an archived snapshot.
+In Android Studio, use the "Open an existing Android Studio project", and select the directory of "huawei-location-android-demo".
+You can use the "gradlew build" command to build the project directly.
+You should create an app in AppGallery Connect, and obtain the file of agconnect-services.json and add to the project. You should also generate a signing certificate fingerprint and add the certificate file to the project, and add configuration to build.gradle. See the Configuring App Information in AppGallery Connect guide to configure app in AppGallery Connect.
+
+## Installation
+ 
+1. Clone or download this project and open the downloaded folder in Android Studio or compatible IDE.
+2. use IDE's functionality to install configured project on to your device.
+
+## Supported Environments
+   Huawei phones with EMUI 5.0 or later, Huawei tablets, or non-Huawei phones with Android 5.1 or later.
+
+## Sample Code
+1. Invoke the addGeofence method of GeoFenceData to add a geo-fence. The code location is in the addGeofence method of the  src\main\java\com\huawei\hmssample2\geofence\GeoFenceActivity.java fle.
+2. location broadcast receiver.The code is stored in src\main\java\com\huawei\hmssample2\location\fusedlocation\LocationBaseActivity.java
+
+## Result
+<img src="images/home.png" width = 20% height = 20%>
+<img src="images/locationgetlast.png" width = 20% height = 20%>
+<img src="images/locationhd.png" width = 20% height = 20%>
+
+
+##  License
+huawei-location-android-demo is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

File diff suppressed because it is too large
+ 18 - 0
locationkit-java-sample/Third Party Open Source Software Notice.doc


+ 137 - 0
locationkit-java-sample/app/app.iml

@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android-gradle" name="Android-Gradle">
+      <configuration>
+        <option name="GRADLE_PROJECT_PATH" value=":app" />
+        <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.3.2" />
+        <option name="LAST_KNOWN_AGP_VERSION" value="3.3.2" />
+      </configuration>
+    </facet>
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="SELECTED_BUILD_VARIANT" value="debug" />
+        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
+        <afterSyncTasks>
+          <task>generateDebugSources</task>
+        </afterSyncTasks>
+        <option name="ALLOW_USER_CONFIGURATION" value="false" />
+        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
+        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
+        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
+        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
+        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
+    <output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
+    <output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/build" />
+    </content>
+    <orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Gradle: com.android.support:collections:28.0.0@jar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.1@jar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:common:1.1.1@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:28.0.0@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.3@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-fragment:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:loader:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:viewpager:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:coordinatorlayout:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:drawerlayout:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:slidingpanelayout:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:customview:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-compat:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:versionedparcelable:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:cursoradapter:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:1.1.1@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:documentfile:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:print:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:1.1.1@aar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata:1.1.1@aar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:1.1.1@aar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:runtime:1.1.1@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:interpolator:28.0.0@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:location:4.0.3.303@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:base:4.0.3.302@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:availableupdate:4.0.3.302@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:ui:4.0.3.302@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:stats:4.0.3.302@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:device:4.0.3.302@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:log:4.0.3.302@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:network-grs:4.0.2.300@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:network-common:4.0.2.300@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.agconnect:agconnect-core:1.0.0.300@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hmf:tasks:1.3.3.300@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.huawei.hms:update:2.0.6.300@aar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout:1.1.3@aar" level="project" />
+  </component>
+</module>

+ 68 - 0
locationkit-java-sample/app/build.gradle

@@ -0,0 +1,68 @@
+apply plugin: 'com.android.application'
+apply plugin: 'com.huawei.agconnect'
+android {
+    signingConfigs {
+        release {
+            storeFile file('../android.keystore')
+            keyAlias 'android.keystore'
+            keyPassword 'android'
+            storePassword 'android'
+            v2SigningEnabled true
+        }
+    }
+    lintOptions {
+        abortOnError false
+    }
+    //noinspection GradleCompatible
+    compileSdkVersion 30
+    buildToolsVersion "30.0.3"
+    defaultConfig {
+        applicationId "com.huawei.Locationsample6"
+        minSdkVersion 22
+        targetSdkVersion 31
+        versionCode 1
+        versionName "1.0"
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+    }
+    compileOptions {
+        sourceCompatibility 1.8
+        targetCompatibility 1.8
+    }
+
+    buildTypes {
+        release {
+            // Enable obfuscation
+            minifyEnabled true
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+            signingConfig signingConfigs.release
+            debuggable true
+            packagingOptions {
+                // CPU architecture: ARMv7 ARMv8.
+                doNotStrip "*/arm64-v8a/libucs-credential.so"
+                doNotStrip "*/armeabi-v7a/libucs-credential.so"
+                // CPU architecture: x86 x86_64.
+                doNotStrip "*/x86/libucs-credential.so"
+                doNotStrip "*/x86_64/libucs-credential.so"
+            }
+        }
+        debug {
+            debuggable true
+            signingConfig signingConfigs.release
+            packagingOptions {
+                // CPU architecture: ARMv7 ARMv8.
+                doNotStrip "*/arm64-v8a/libucs-credential.so"
+                doNotStrip "*/armeabi-v7a/libucs-credential.so"
+                //CPU architecture: x86 x86_64.
+                doNotStrip "*/x86/libucs-credential.so"
+                doNotStrip "*/x86_64/libucs-credential.so"
+            }
+        }
+    }
+    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
+}
+
+dependencies {
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'com.huawei.hms:location:6.12.0.300'
+    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+}

+ 29 - 0
locationkit-java-sample/app/proguard-rules.pro

@@ -0,0 +1,29 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\adt-bundle-windows-x86-20140702\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+-ignorewarnings
+-keepattributes *Annotation*
+-keepattributes Exceptions
+-keepattributes InnerClasses
+-keepattributes Signature
+-keepattributes SourceFile,LineNumberTable
+-keep class com.huawei.hianalytics.**{*;}
+-keep class com.huawei.updatesdk.**{*;}
+-keep class com.huawei.hms.**{*;}
+-keep class * extends com.huawei.hms.core.aidl.IMessageEntity{ *; }
+-keep public class com.huawei.location.nlp.network.** {*; }
+-keep class com.huawei.wisesecurity.ucs.**{*;}

+ 100 - 0
locationkit-java-sample/app/src/main/AndroidManifest.xml

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    package="com.huawei.locationsample6">
+
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
+    <uses-permission android:name="com.huawei.hms.permission.ACTIVITY_RECOGNITION" />
+    <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
+    <uses-permission
+        android:name="android.permission.ACCESS_MOCK_LOCATION"
+        tools:ignore="MockLocation,ProtectedPermissions" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
+
+    <application
+        android:allowBackup="false"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:requestLegacyExternalStorage="true"
+        android:supportsRtl="true"
+        android:theme="@style/AppTheme">
+
+        <activity android:name=".NavigationContextStateActivity" />
+        <activity android:name=".location.fusedlocation.CheckSettingActivity" />
+        <activity android:name=".geofence.OperateGeoFenceActivity" />
+        <activity android:name=".geofence.GeoFenceActivity" />
+        <activity
+            android:name=".HuaweiLocationActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity> <!-- RequestLocationUpdatesWithCallback -->
+        <activity
+            android:name=".location.fusedlocation.RequestLocationUpdatesWithCallbackActivity"
+            android:configChanges="orientation|screenSize" /> <!-- RequestLocationUpdatesWithIntent -->
+        <activity
+            android:name=".location.fusedlocation.RequestLocationUpdatesWithIntentActivity"
+            android:configChanges="orientation|screenSize" /> <!-- GetLastLocation -->
+        <activity
+            android:name=".location.fusedlocation.GetLastLocationActivity"
+            android:configChanges="orientation|screenSize" /> <!-- GetLocationAvailability -->
+        <activity
+            android:name=".location.fusedlocation.GetLocationAvailabilityActivity"
+            android:configChanges="orientation|screenSize" /> <!-- SetMockMode -->
+        <activity
+            android:name=".location.fusedlocation.SetMockModeActivity"
+            android:configChanges="orientation|screenSize" /> <!-- SetMockLocation -->
+        <activity
+            android:name=".location.fusedlocation.SetMockLocationActivity"
+            android:configChanges="orientation|screenSize" />
+        <activity
+            android:name=".activity.ActivityConversionActivity"
+            android:configChanges="orientation|screenSize" />
+        <activity
+            android:name=".activity.ActivityIdentificationActivity"
+            android:configChanges="orientation|screenSize" />
+        <activity
+            android:name=".location.fusedlocation.RequestLocationUpdatesHDWithCallbackActivity"
+            android:configChanges="orientation|screenSize" /> <!-- LocationBroadcastReceiver -->
+        <activity
+            android:name=".WriteLogActivity"
+            android:configChanges="orientation|screenSize" />
+        <activity
+            android:name=".CoordinateConverterActivity"
+            android:configChanges="orientation|screenSize" />
+
+        <service
+            android:name="com.huawei.location.service.BackGroundService"
+            android:foregroundServiceType="location" />
+
+        <receiver
+            android:name=".location.fusedlocation.LocationBroadcastReceiver"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="com.huawei.hmssample.location.LocationBroadcastReceiver.ACTION_PROCESS_LOCATION" />
+            </intent-filter>
+        </receiver>
+        <receiver
+            android:name=".geofence.GeoFenceBroadcastReceiver"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="com.huawei.hmssample.geofence.GeoFenceBroadcastReceiver.ACTION_PROCESS_LOCATION" />
+            </intent-filter>
+        </receiver>
+    </application>
+
+</manifest>

+ 12 - 0
locationkit-java-sample/app/src/main/assets/ActivityTransitionRequest.json

@@ -0,0 +1,12 @@
+{
+  "transitions":
+  [{
+    "transitionType": 0,
+    "activityType": 3
+    },
+    {
+      "transitionType": 1,
+      "activityType": 3
+    }
+  ]
+}

+ 4 - 0
locationkit-java-sample/app/src/main/assets/CheckLocationSettings.json

@@ -0,0 +1,4 @@
+{
+  "alwaysShow": false,
+  "needBle": false
+}

+ 11 - 0
locationkit-java-sample/app/src/main/assets/LocationRequest.json

@@ -0,0 +1,11 @@
+{
+  "priority": 200,
+  "interval": 5000,
+  "fastestInterval": 5000,
+  "isFastestIntervalExplicitlySet": false,
+  "expirationTime": 9223372036854775807,
+  "expirationDuration": 9223372036854775807,
+  "numUpdates": 2147483647,
+  "smallestDisplacement": 0,
+  "maxWaitTime": 0
+}

二進制
locationkit-java-sample/app/src/main/assets/ic_launcher-web.png


+ 30 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/Constant.java

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+/**
+ * Request code
+ *
+ * @since 2020-5-11
+ */
+public class Constant {
+    // Configuration whether to display log 1 display 0 not display logs
+    public static final int IS_LOG = 1;
+
+    // Request Location Permission
+    public static final int REQUEST_LOCATION_PERMISSION = 1009;
+}

+ 81 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/CoordinateConverterActivity.java

@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ */
+
+package com.huawei.locationsample6;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.locationsample6.util.CoordinateConverterUtil;
+
+/**
+ * CoordinateConverterActivity
+ *
+ * @since 2022-08-22
+ */
+public class CoordinateConverterActivity extends LocationBaseActivity implements View.OnClickListener {
+    private static final String LAT_DEFAULT = "31.196055890098226";
+
+    private static final String LON_DEFAULT = "121.31340512699686";
+
+    private EditText etLon;
+
+    private EditText etLat;
+
+    private EditText etTransformType;
+
+    private TextView tvResultShow;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_coordinate_converter);
+        findViewById(R.id.do_transform).setOnClickListener(this);
+        etLon = (EditText) findViewById(R.id.et_lon);
+        etLat = (EditText) findViewById(R.id.et_lat);
+        etTransformType = (EditText) findViewById(R.id.et_transform_type);
+        tvResultShow = (TextView) findViewById(R.id.tv_result_show);
+        addLogFragment();
+        etLat.setText(LAT_DEFAULT);
+        etLon.setText(LON_DEFAULT);
+    }
+
+    @Override
+    public void onClick(View view) {
+        if (view.getId() == R.id.do_transform) {
+            tvResultShow.setText("");
+            change();
+        }
+    }
+
+    private void change() {
+        StringBuffer buffer = new StringBuffer(0);
+        double lat = 0.0d;
+        double lon = 0.0d;
+        int type = 0;
+        try {
+            if (!TextUtils.isEmpty(etLat.getText().toString().trim())) {
+                lat = Double.valueOf(etLat.getText().toString().trim());
+            }
+            if (!TextUtils.isEmpty(etLon.getText().toString().trim())) {
+                lon = Double.valueOf(etLon.getText().toString().trim());
+            }
+            if (!TextUtils.isEmpty(etTransformType.getText().toString().trim())) {
+                type = Integer.parseInt(etTransformType.getText().toString().trim());
+            }
+            String change = CoordinateConverterUtil.change(lat, lon, type);
+            buffer.append(change);
+            buffer.append(System.lineSeparator());
+        } catch (NumberFormatException e) {
+            buffer.append(e.getMessage());
+            buffer.append(System.lineSeparator());
+            buffer.append("Replace the parameter with the correct one.");
+        }
+        tvResultShow.setText(buffer);
+    }
+}

+ 209 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/HuaweiLocationActivity.java

@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import androidx.core.app.ActivityCompat;
+
+import com.huawei.locationsample6.activity.ActivityConversionActivity;
+import com.huawei.locationsample6.activity.ActivityIdentificationActivity;
+import com.huawei.locationsample6.geofence.OperateGeoFenceActivity;
+import com.huawei.locationsample6.location.fusedlocation.CheckSettingActivity;
+import com.huawei.locationsample6.location.fusedlocation.GetLastLocationActivity;
+import com.huawei.locationsample6.location.fusedlocation.GetLocationAvailabilityActivity;
+import com.huawei.locationsample6.location.fusedlocation.RequestLocationUpdatesHDWithCallbackActivity;
+import com.huawei.locationsample6.location.fusedlocation.RequestLocationUpdatesWithCallbackActivity;
+import com.huawei.locationsample6.location.fusedlocation.RequestLocationUpdatesWithIntentActivity;
+import com.huawei.locationsample6.location.fusedlocation.SetMockLocationActivity;
+import com.huawei.locationsample6.location.fusedlocation.SetMockModeActivity;
+
+/**
+ * Demonstration of Huawei Location Service Usage
+ *
+ * @since 2020-5-11
+ */
+public class HuaweiLocationActivity extends Activity implements OnClickListener {
+    public static final String TAG = "HuaweiLocationActivity";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_huaweilocation);
+        // Button click listeners
+        findViewById(R.id.location_requestLocationUpdatesWithIntent).setOnClickListener(this);
+        findViewById(R.id.location_getLocationAvailability).setOnClickListener(this);
+        findViewById(R.id.location_getLastLocation).setOnClickListener(this);
+        findViewById(R.id.location_requestLocationUpdatesWithCallback).setOnClickListener(this);
+        findViewById(R.id.location_setMockLocation).setOnClickListener(this);
+        findViewById(R.id.location_setMockMode).setOnClickListener(this);
+        findViewById(R.id.location_activity_update).setOnClickListener(this);
+        findViewById(R.id.location_activity_transition_update).setOnClickListener(this);
+        findViewById(R.id.GeoFence).setOnClickListener(this);
+        findViewById(R.id.locationHD).setOnClickListener(this);
+        findViewById(R.id.getNavigationContextState).setOnClickListener(this);
+        findViewById(R.id.check_setting).setOnClickListener(this);
+        findViewById(R.id.write_log).setOnClickListener(this);
+        findViewById(R.id.coordinate_converter).setOnClickListener(this);
+
+        // You must have the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission. Otherwise, the location service
+        // is unavailable.
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
+            Log.i(TAG, "android sdk < 28 Q");
+            if (ActivityCompat.checkSelfPermission(this,
+                Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(this,
+                    Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+                String[] strings =
+                    {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
+                ActivityCompat.requestPermissions(this, strings, 1);
+            }
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+            if (ActivityCompat.checkSelfPermission(this,
+                Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(this,
+                    Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+                String[] strings =
+                    {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
+                ActivityCompat.requestPermissions(this, strings, 3);
+            }else{
+                RequestPermission.requestBackgroundPermission(this);
+            }
+        } else {
+            if (ActivityCompat.checkSelfPermission(this,
+                Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(this,
+                    Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(this,
+                    "android.permission.ACCESS_BACKGROUND_LOCATION") != PackageManager.PERMISSION_GRANTED) {
+                String[] strings = {Manifest.permission.ACCESS_FINE_LOCATION,
+                    Manifest.permission.ACCESS_COARSE_LOCATION, "android.permission.ACCESS_BACKGROUND_LOCATION"};
+                ActivityCompat.requestPermissions(this, strings, 2);
+            }
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_requestLocationUpdatesWithIntent:
+                    startIntent(RequestLocationUpdatesWithIntentActivity.class);
+                    break;
+                case R.id.location_getLastLocation:
+                    startIntent(GetLastLocationActivity.class);
+                    break;
+                case R.id.location_getLocationAvailability:
+                    startIntent(GetLocationAvailabilityActivity.class);
+                    break;
+                case R.id.location_requestLocationUpdatesWithCallback:
+                    startIntent(RequestLocationUpdatesWithCallbackActivity.class);
+                    break;
+                case R.id.location_setMockLocation:
+                    startIntent(SetMockLocationActivity.class);
+                    break;
+                case R.id.location_setMockMode:
+                    startIntent(SetMockModeActivity.class);
+                    break;
+                case R.id.GeoFence:
+                    startIntent(OperateGeoFenceActivity.class);
+                    break;
+                case R.id.location_activity_transition_update:
+                    startIntent(ActivityConversionActivity.class);
+                    break;
+                default:
+                    otherClick(v.getId());
+                    break;
+            }
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            Log.i(TAG, "HuaweiLocation Exception:" + e);
+        }
+    }
+
+    private void otherClick(int id) {
+        switch (id) {
+            case R.id.location_activity_update:
+                startIntent(ActivityIdentificationActivity.class);
+                break;
+            case R.id.locationHD:
+                startIntent(RequestLocationUpdatesHDWithCallbackActivity.class);
+                break;
+            case R.id.getNavigationContextState:
+                startIntent(NavigationContextStateActivity.class);
+                break;
+            case R.id.check_setting:
+                startIntent(CheckSettingActivity.class);
+                break;
+            case R.id.write_log:
+                startIntent(WriteLogActivity.class);
+                break;
+            case R.id.coordinate_converter:
+                startIntent(CoordinateConverterActivity.class);
+                break;
+            default:
+                throw new IllegalArgumentException("view error:" + id);
+        }
+    }
+
+    private void startIntent(Class<?> clazz) {
+        Intent intent = new Intent(this, clazz);
+        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        startActivity(intent);
+    }
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        if (requestCode == 1) {
+            if (grantResults.length > 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED
+                && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
+                Log.i(TAG, "onRequestPermissionsResult: apply LOCATION PERMISSION successful");
+            } else {
+                Log.i(TAG, "onRequestPermissionsResult: apply LOCATION PERMISSSION  failed");
+            }
+        }
+
+        if (requestCode == 2) {
+            if (grantResults.length > 2 && grantResults[2] == PackageManager.PERMISSION_GRANTED
+                && grantResults[0] == PackageManager.PERMISSION_GRANTED
+                && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
+                Log.i(TAG, "onRequestPermissionsResult: apply ACCESS_BACKGROUND_LOCATION successful");
+            } else {
+                Log.i(TAG, "onRequestPermissionsResult: apply ACCESS_BACKGROUND_LOCATION  failed");
+            }
+        }
+        if (requestCode == 3) {
+            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED
+                || grantResults[1] == PackageManager.PERMISSION_GRANTED) {
+                Log.i(TAG, "onRequestPermissionsResult: apply LOCATION PERMISSION successful");
+                RequestPermission.requestBackgroundPermission(this);
+            } else {
+                Log.i(TAG, "onRequestPermissionsResult: apply LOCATION PERMISSSION  failed");
+            }
+        }
+    }
+}

+ 59 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/JsonDataUtil.java

@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+import android.content.Context;
+import android.content.res.AssetManager;
+
+import com.huawei.logger.LocationLog;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+
+public class JsonDataUtil {
+    public static final String TAG = "JsonDataUtil";
+
+    public static String getJson(Context context, String fileName, boolean isBr) {
+        StringBuilder stringBuilder = new StringBuilder();
+        BufferedReader bf = null;
+        try {
+            AssetManager assetManager = context.getAssets();
+            bf = new BufferedReader(new InputStreamReader(assetManager.open(fileName), Charset.forName("UTF-8")));
+            String line;
+            while ((line = bf.readLine()) != null) {
+                stringBuilder.append(line);
+                if (isBr) {
+                    stringBuilder.append("\n");
+                }
+            }
+        } catch (IOException e) {
+            LocationLog.i(TAG, "IOException" + e.getClass().getSimpleName());
+        } finally {
+            try {
+                if (bf != null) {
+                    bf.close();
+                }
+            } catch (IOException e) {
+                LocationLog.i(TAG, "IOException" + e.getClass().getSimpleName());
+            }
+        }
+        return stringBuilder.toString();
+    }
+
+}

+ 377 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/LogInfoUtil.java

@@ -0,0 +1,377 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+import android.Manifest;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.location.GpsSatellite;
+import android.location.GpsStatus;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.net.wifi.ScanResult;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Looper;
+import android.provider.Settings;
+import android.telephony.CellInfo;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+import androidx.core.app.ActivityCompat;
+
+import com.huawei.location.lite.common.util.ExecutorUtil;
+
+import java.math.BigInteger;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * LogInfoUtil
+ *
+ * @since 2020-07-29
+ */
+public class LogInfoUtil {
+    public static final String TAG = "LogInfoUtil";
+
+    private static LocationManager locationManager;
+
+    private static WifiManager wifiMgr;
+
+    private static BroadcastReceiver wifiScanReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context c, Intent intent) {
+            boolean success = true;
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                try {
+                    success = intent.getBooleanExtra(WifiManager.EXTRA_RESULTS_UPDATED, false);
+                } catch (Exception e) {
+                    Log.i(TAG, "isException");
+                }
+            }
+            if (success) {
+                List<ScanResult> scanResults = wifiMgr.getScanResults();
+                if (scanResults == null || scanResults.isEmpty()) {
+                    Log.e(TAG + "-WIFI", "wifi scan result null");
+                    return;
+                }
+                WifiInfo info = wifiMgr.getConnectionInfo();
+                StringBuilder currentWifiInfo = new StringBuilder();
+                if (info != null && !TextUtils.isEmpty(info.getBSSID())) {
+                    long mac = 0L;
+                    if (!TextUtils.isEmpty(info.getBSSID())) {
+                        mac = Long.parseLong(new BigInteger(info.getBSSID().replace(":", ""), 16).toString());
+                    }
+                    currentWifiInfo.append("[Current Connect wifi: ")
+                        .append(info.toString())
+                        .append(", BSSID: ")
+                        .append(info.getBSSID())
+                        .append(", MAC: ")
+                        .append(mac)
+                        .append(".]")
+                        .append("\n");
+                } else {
+                    currentWifiInfo.append("Current Connect wifi is null. ").append("\n");
+                }
+                Log.i(TAG + "-WIFI", currentWifiInfo.toString());
+                for (ScanResult result : scanResults) {
+                    long mac = 0L;
+                    if (!TextUtils.isEmpty(result.BSSID)) {
+                        mac = Long.parseLong(new BigInteger(result.BSSID.replace(":", ""), 16).toString());
+                    }
+                    Log.i(TAG + "-WIFI", "[" + result.toString() + ", MAC: " + mac + "]" + "\n");
+                }
+            }
+        }
+    };
+
+    private static BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            String action = intent.getAction();
+            if (BluetoothDevice.ACTION_FOUND.equals(action)) {
+                // Obtain the device from the intent.
+                try{
+                    BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+                    // Determine whether pairing has been performed.
+                    if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
+                        String devicesStr = "[" + "Name: " + device.getName() + ", Address: " + device.getAddress()
+                                + ", BondState: " + device.getBondState();
+                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+                            devicesStr += ", Type: " + device.getType();
+                        }
+                        devicesStr += "]";
+                        Log.i(TAG + "-Bluetooth", devicesStr);
+                    }
+                } catch (Exception exception) {
+                    Log.i(TAG + "-Bluetooth", "isException");
+                }
+                // Search Complete.
+            } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
+                Log.i(TAG + "-Bluetooth", "end");
+            } else {
+                Log.i(TAG + "-Bluetooth", "receive");
+            }
+        }
+    };
+
+    public static synchronized void getLogInfo(final Context context) {
+        Log.i(TAG, "getLogInfo start");
+        if (!isLocationEnabled(context)) {
+            Log.i(TAG, "isLocationEnabled is false");
+            return;
+        }
+        ExecutorUtil.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                Looper.prepare();
+                try {
+                    getWIFIInfo(context);
+                    getCellInfo(context);
+                    getGPSInfo(context);
+                    getBluetoothInfo(context);
+                    Looper.loop();
+                } catch (Exception e) {
+                    Log.e(TAG, "getLogInfo error : " + e.getMessage());
+                }
+            }
+        });
+    }
+
+    public static void removeLogInfo() {
+        removeLocation();
+    }
+
+    private static boolean isRegisterReceiverBle = false;
+
+    private static void getBluetoothInfo(Context context) {
+        Log.i(TAG + "-Bluetooth", "getBluetoothInfo start");
+        BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+        if (mBluetoothAdapter == null) {
+            Log.i(TAG + "-Bluetooth", "Bluetooth is not found");
+            return;
+        }
+        // Determine whether to enable Bluetooth.
+        if (!mBluetoothAdapter.isEnabled()) {
+            Log.i(TAG + "-Bluetooth", "Bluetooth is off");
+            return;
+        }
+        // Obtaining Paired Devices.
+        Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
+        // Check whether there are paired devices.
+        if (pairedDevices.size() > 0) {
+            for (BluetoothDevice device : pairedDevices) {
+                // Traverse to the list
+                StringBuilder pairedDevicesStr = new StringBuilder("getBondedDevices: [");
+                pairedDevicesStr.append("Name: ")
+                    .append(device.getName())
+                    .append(", Address: ")
+                    .append(device.getAddress())
+                    .append(", BondState: ")
+                    .append(device.getBondState());
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+                    pairedDevicesStr.append(", Type: ").append(device.getType());
+                }
+                pairedDevicesStr.append("]").append("\n");
+                Log.i(TAG + "-Bluetooth", pairedDevicesStr.toString());
+            }
+        }
+        IntentFilter intent = new IntentFilter();
+        intent.addAction(BluetoothDevice.ACTION_FOUND); // Use BroadcastReceiver to get search results
+        intent.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
+        intent.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
+        if (isRegisterReceiverBle) {
+            context.unregisterReceiver(broadcastReceiver);
+        }
+        context.registerReceiver(broadcastReceiver, intent);
+        isRegisterReceiverBle = true;
+        // Determines whether the search is in progress. If the search is in progress, cancels the search.
+        if (mBluetoothAdapter.isDiscovering()) {
+            mBluetoothAdapter.cancelDiscovery();
+        }
+        // Start Search
+        mBluetoothAdapter.startDiscovery();
+    }
+
+    /**
+     * Check whether the location service is enabled.
+     *
+     * @param context context
+     * @return true enabled
+     */
+    public static boolean isLocationEnabled(Context context) {
+        int locationMode = 0;
+        String locationProviders;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            try {
+                locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE);
+            } catch (Settings.SettingNotFoundException e) {
+                return false;
+            }
+            return locationMode != Settings.Secure.LOCATION_MODE_OFF;
+        } else {
+            locationProviders =
+                Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
+            return !TextUtils.isEmpty(locationProviders);
+        }
+    }
+
+    private static void getGPSInfo(final Context context) {
+        Log.i(TAG + "-GPS", "getGPSInfo start");
+        // Obtaining the Location Management Service
+        if (ActivityCompat.checkSelfPermission(context,
+            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+            && ActivityCompat.checkSelfPermission(context,
+                Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+            Log.i(TAG, "checkSelfPermission ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION false:");
+            return;
+        }
+        if (context.getSystemService(Context.LOCATION_SERVICE) instanceof LocationManager) {
+            locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
+        }
+        // Set the minimum interval for automatic update of the listener to N seconds. (1 second is 1 x 1000, which is
+        // mainly for convenience.) or the minimum displacement change exceeds N m
+        // Obtains data from the location provider in real time and notifies the application locationListener once the
+        // location changes.
+        locationManager.requestLocationUpdates("gps", 10000, 0, locationListener);
+        // Satellite listening. The statusListener is the response function.
+        locationManager.addGpsStatusListener(new GpsStatus.Listener() {
+            @Override
+            public void onGpsStatusChanged(int event) {
+                // Triggering event event
+                switch (event) {
+                    case GpsStatus.GPS_EVENT_STARTED:
+                        break;
+                    // First Positioning Time
+                    case GpsStatus.GPS_EVENT_FIRST_FIX:
+                        break;
+                    // Receives satellite information, invokes the DrawMap() function, parses satellite signals, and
+                    // displays them on the screen.
+                    case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
+                        logGPSResult(context);
+                        break;
+                    case GpsStatus.GPS_EVENT_STOPPED:
+                        break;
+                }
+            }
+        });
+        Log.i(TAG, "getGPSInfo end");
+    }
+
+    private static void removeLocation() {
+        if (locationManager != null) {
+            locationManager.removeUpdates(locationListener);
+        }
+    }
+
+    private static LocationListener locationListener = new LocationListener() {
+        @Override
+        public void onLocationChanged(Location location) {
+            // Obtain the location through GPS, place the new location information in location, and invoke the
+            // updateToNewLocation function to display the location information.
+            Log.i(TAG, "Longitude:" + location.getLongitude() + ",Latitude:" + location.getLatitude());
+        }
+
+        // Call the following function when the provider is unavailable
+        @Override
+        public void onProviderDisabled(String arg0) {
+        }
+
+        @Override
+        public void onProviderEnabled(String arg0) {
+        }
+
+        @Override
+        public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
+        }
+    };
+
+    private static void logGPSResult(Context context) {
+        // Obtains satellite information. gpsStatus is the satellite GpsStatus variable obtained in the satellite
+        // response function.
+        if (ActivityCompat.checkSelfPermission(context,
+            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+            Log.i(TAG + "-GPS", "checkSelfPermission ACCESS_FINE_LOCATION false ");
+            return;
+        }
+        GpsStatus gpsStatus = locationManager.getGpsStatus(null);
+        Iterable<GpsSatellite> allSatellites = gpsStatus.getSatellites();
+        // Traversal to obtain information about each satellite
+        for (GpsSatellite satellite : allSatellites) {
+            Log.i(TAG + "-GPS",
+                "[" + "mHasEphemeris=" + satellite.hasEphemeris() + ", mHasAlmanac=" + satellite.hasAlmanac()
+                    + ", mPrn=" + satellite.getPrn() + ", mSnr=" + satellite.getSnr() + ", mElevation="
+                    + satellite.getElevation() + ", mAzimuth=" + satellite.getAzimuth() + ']' + "\n");
+        }
+    }
+
+    private static boolean isRegisterReceiver = false;
+
+    /**
+     * Obtains the Wi-Fi name of the current connection.
+     *
+     * @param context context
+     */
+    private static void getWIFIInfo(Context context) {
+        Log.i(TAG, "getWIFIInfo start");
+        if (context.getApplicationContext().getSystemService(Context.WIFI_SERVICE) instanceof WifiInfo) {
+            wifiMgr = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+        }
+        if (wifiMgr == null) {
+            Log.i(TAG + "-WIFI", "WifiManager is null");
+            return;
+        }
+        IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
+        if (isRegisterReceiver) {
+            context.unregisterReceiver(wifiScanReceiver);
+        }
+        context.registerReceiver(wifiScanReceiver, intentFilter);
+        isRegisterReceiver = true;
+        boolean success = wifiMgr.startScan();
+        Log.i(TAG + "-WIFI", "wifi scan result is " + success);
+    }
+
+    private static void getCellInfo(Context context) {
+        Log.i(TAG + "-Cell", "getCellInfo start");
+        if (ActivityCompat.checkSelfPermission(context,
+            Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+            Log.i(TAG + "-Cell", "checkSelfPermission ACCESS_COARSE_LOCATION false ");
+            return;
+        }
+        TelephonyManager tel = null;
+        if (context.getSystemService(Context.TELEPHONY_SERVICE) instanceof TelephonyManager) {
+            tel = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+        }
+        if (tel == null || tel.getAllCellInfo() == null) {
+            Log.i(TAG + "-Cell", "getCellInfo fail TelephonyManager is null");
+            return;
+        }
+        for (CellInfo cellInfo : tel.getAllCellInfo()) {
+            Log.i(TAG + "-Cell", "[" + cellInfo.toString() + "]" + "\n");
+        }
+    }
+}

+ 88 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/NavigationContextStateActivity.java

@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hms.location.LocationEnhanceService;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.hms.location.NavigationRequest;
+import com.huawei.hms.location.NavigationResult;
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.logger.LocationLog;
+
+public class NavigationContextStateActivity extends LocationBaseActivity implements View.OnClickListener {
+    public static final String TAG = "GetNavigationContextStateActivity";
+
+    private LocationEnhanceService locationEnhanceService;
+
+    private EditText requestType;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_navigation_context_state);
+        findViewById(R.id.getNavigationContextState).setOnClickListener(this);
+        requestType = findViewById(R.id.typeText);
+        addLogFragment();
+        locationEnhanceService = LocationServices.getLocationEnhanceService(this);
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.getNavigationContextState:
+                    getNavigationContextState();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.i(TAG, "getNavigationContextState Exception:" + e);
+        }
+    }
+
+    private void getNavigationContextState() {
+        try {
+            int type = Integer.parseInt(requestType.getText().toString());
+            NavigationRequest request = new NavigationRequest(type);
+            locationEnhanceService.getNavigationState(request)
+                .addOnSuccessListener(new OnSuccessListener<NavigationResult>() {
+                    @Override
+                    public void onSuccess(NavigationResult result) {
+                        LocationLog.i(TAG, "get NavigationResult sucess, State is :" + result.getState()
+                            + " , Possibility is : " + result.getPossibility());
+                    }
+                })
+                .addOnFailureListener(new OnFailureListener() {
+                    @Override
+                    public void onFailure(Exception e) {
+                        LocationLog.i(TAG, "get NavigationResult fail " + e.getMessage());
+                    }
+                });
+            LocationLog.i(TAG, "getNavigationContextStatecall finish");
+        } catch (Exception e) {
+            LocationLog.i(TAG, "getNavigationContextState exception:" + e.getMessage());
+        }
+    }
+}

+ 38 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/NoDoubleClickUtils.java

@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+/**
+ * NoDoubleClickUtils
+ *
+ * @since 2021-11-23
+ */
+public final class NoDoubleClickUtils {
+    private static final int SPACE_TIME = 500;
+
+    private static long lastClickTime;
+
+    public NoDoubleClickUtils() {
+    }
+
+    public static boolean isFastDoubleClick() {
+        long time = System.currentTimeMillis();
+        long timeD = time - lastClickTime;
+        lastClickTime = time;
+        return timeD <= SPACE_TIME;
+    }
+}

+ 96 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/RequestPermission.java

@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.util.Log;
+
+import androidx.core.app.ActivityCompat;
+
+import com.huawei.logger.LocationLog;
+
+public class RequestPermission {
+    public static final String TAG = "RequestPermission";
+
+    public static void requestLocationPermission(Context context) {
+        // check location permisiion
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
+            Log.i(TAG, "android sdk < 28 Q");
+            if (ActivityCompat.checkSelfPermission(context,
+                Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(context,
+                    Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+                String[] strings =
+                    {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
+                if (context instanceof Activity) {
+                    ActivityCompat.requestPermissions((Activity) context, strings, 1);
+                }
+            }
+        } else {
+            if (ActivityCompat.checkSelfPermission(context,
+                Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(context,
+                    Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(context,
+                    "android.permission.ACCESS_BACKGROUND_LOCATION") != PackageManager.PERMISSION_GRANTED) {
+                String[] strings = {Manifest.permission.ACCESS_FINE_LOCATION,
+                    Manifest.permission.ACCESS_COARSE_LOCATION, "android.permission.ACCESS_BACKGROUND_LOCATION"};
+                if (context instanceof Activity) {
+                    ActivityCompat.requestPermissions((Activity) context, strings, 2);
+                }
+            }
+        }
+    }
+
+    public static void requestActivityTransitionPermission(Context context) {
+        // check location permisiion
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
+            if (ActivityCompat.checkSelfPermission(context,
+                "com.huawei.hms.permission.ACTIVITY_RECOGNITION") != PackageManager.PERMISSION_GRANTED) {
+                String[] permissions = {"com.huawei.hms.permission.ACTIVITY_RECOGNITION"};
+                if (context instanceof Activity) {
+                    ActivityCompat.requestPermissions((Activity) context, permissions, 1);
+                }
+                LocationLog.i(TAG, "requestActivityTransitionButtonHandler: apply permission");
+            }
+        } else {
+            if (ActivityCompat.checkSelfPermission(context,
+                "android.permission.ACTIVITY_RECOGNITION") != PackageManager.PERMISSION_GRANTED) {
+                String[] permissions = {"android.permission.ACTIVITY_RECOGNITION"};
+                if (context instanceof Activity) {
+                    ActivityCompat.requestPermissions((Activity) context, permissions, 2);
+                }
+                LocationLog.i(TAG, "requestActivityTransitionButtonHandler: apply permission");
+            }
+        }
+    }
+
+    public static void requestBackgroundPermission(Context context) {
+        if (ActivityCompat.checkSelfPermission(context,
+            "android.permission.ACCESS_BACKGROUND_LOCATION") != PackageManager.PERMISSION_GRANTED) {
+            String[] permissions = {"android.permission.ACCESS_BACKGROUND_LOCATION"};
+            if (context instanceof Activity) {
+                ActivityCompat.requestPermissions((Activity) context, permissions, 0);
+            }
+            LocationLog.i(TAG, "android.permission.ACCESS_BACKGROUND_LOCATION");
+        }
+    }
+}

+ 128 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/WriteLogActivity.java

@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.EditText;
+
+import androidx.core.app.ActivityCompat;
+
+import com.huawei.hms.location.LocationServices;
+import com.huawei.hms.location.LogConfig;
+import com.huawei.hms.location.SettingsClient;
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.logger.LocationLog;
+
+import java.io.File;
+
+public class WriteLogActivity extends LocationBaseActivity {
+    private static final String TAG = "WriteLogActivity";
+
+    private SettingsClient settingsClient;
+
+    private EditText etFilePath;
+
+    private EditText etFileCount;
+
+    private EditText etFileSize;
+
+    private EditText etFileExpire;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_wirte_log);
+        settingsClient = LocationServices.getSettingsClient(this);
+
+        etFileCount = (EditText) findViewById(R.id.et_file_count);
+        etFileSize = (EditText) findViewById(R.id.et_file_size);
+        etFilePath = (EditText) findViewById(R.id.et_file_path);
+        etFileExpire = (EditText) findViewById(R.id.et_file_expire);
+        addLogFragment();
+        if (ActivityCompat.checkSelfPermission(this,
+                Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
+                && ActivityCompat.checkSelfPermission(this,
+                Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+            String[] strings = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE};
+            ActivityCompat.requestPermissions(this, strings, 1);
+        }
+        String absolutePath = getSDPath(this);
+        etFilePath.setText(absolutePath + "/log");
+    }
+
+
+    public void writeLog(View view) {
+        LogConfig logConfig = new LogConfig();
+        String fileSizeString = etFileSize.getText().toString().trim();
+        String fileCountString = etFileCount.getText().toString().trim();
+        String fileExpireString = etFileExpire.getText().toString().trim();
+        String filePath = etFilePath.getText().toString().trim();
+        int fileSize = 0;
+        int fileCount = 0;
+        int fileExpire = 0;
+        try {
+            if (!TextUtils.isEmpty(fileSizeString)) {
+                fileSize = Integer.parseInt(fileSizeString);
+            }
+            if (!TextUtils.isEmpty(fileCountString)) {
+                fileCount = Integer.parseInt(fileCountString);
+            }
+            if (!TextUtils.isEmpty(fileExpireString)) {
+                fileExpire = Integer.parseInt(fileExpireString);
+            }
+            logConfig.setFileSize(fileSize);
+            logConfig.setFileNum(fileCount);
+            logConfig.setFileExpiredTime(fileExpire);
+            logConfig.setLogPath(filePath);
+            settingsClient.setLogConfig(logConfig).addOnFailureListener(e -> LocationLog.i(TAG, "setLogConfig onFailure:" + e.getMessage()));
+            if (isLogFilePath(filePath)) {
+                LocationLog.i(TAG, "setLogConfig success");
+            }
+        } catch (NumberFormatException e) {
+            LocationLog.e(TAG, "setLogConfig onFailure:" + e.getMessage());
+        }
+    }
+
+    private boolean isLogFilePath(String logPath) {
+        File folder = new File(logPath);
+        return folder.exists();
+    }
+
+    public static String getSDPath(Context context) {
+        File sdDir = null;
+        // Check whether the SD card exists.
+        boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
+        if (sdCardExist) {
+            if (Build.VERSION.SDK_INT >= 29) {
+                // Android10
+                sdDir = context.getExternalFilesDir(null);
+            } else {
+                sdDir = Environment.getExternalStorageDirectory();
+            }
+        } else {
+            sdDir = Environment.getRootDirectory();
+        }
+        return sdDir.toString();
+    }
+}

+ 260 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/activity/ActivityConversionActivity.java

@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.activity;
+
+import android.annotation.SuppressLint;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.CheckBox;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.ActivityConversionInfo;
+import com.huawei.hms.location.ActivityConversionRequest;
+import com.huawei.hms.location.ActivityIdentification;
+import com.huawei.hms.location.ActivityIdentificationService;
+import com.huawei.locationsample6.R;
+import com.huawei.locationsample6.RequestPermission;
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.locationsample6.location.fusedlocation.LocationBroadcastReceiver;
+import com.huawei.logger.LocationLog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ActivityConversionActivity extends LocationBaseActivity implements View.OnClickListener {
+    public static final String TAG = "ActivityTransitionConvert";
+
+    public ActivityIdentificationService activityIdentificationService;
+
+    public ActivityConversionRequest activityTransitionRequest;
+
+    public List<ActivityConversionInfo> transitions;
+
+    private CheckBox cbInVehicleIn;
+
+    private CheckBox cbWalkingIn;
+
+    private CheckBox cbWalkingOut;
+
+    private CheckBox cbInVehicleOut;
+
+    private CheckBox cbOnBicycleIn;
+
+    private CheckBox cbOnBicycleOut;
+
+    private CheckBox cbOnFootIn;
+
+    private CheckBox cbOnFootOut;
+
+    private CheckBox cbStillIn;
+
+    private CheckBox cbStillOut;
+
+    private CheckBox cbRunningIn;
+
+    private CheckBox cbRunningOut;
+
+    private PendingIntent pendingIntent;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_transition);
+        activityIdentificationService = ActivityIdentification.getService(this);
+        RequestPermission.requestActivityTransitionPermission(this);
+        cbInVehicleIn = findViewById(R.id.IN_VEHICLE_IN);
+        cbInVehicleOut = findViewById(R.id.IN_VEHICLE_OUT);
+        cbOnBicycleIn = findViewById(R.id.ON_BICYCLE_IN);
+        cbOnBicycleOut = findViewById(R.id.ON_BICYCLE_OUT);
+        cbOnFootIn = findViewById(R.id.ON_FOOT_IN);
+        cbOnFootOut = findViewById(R.id.ON_FOOT_OUT);
+        cbStillIn = findViewById(R.id.STILL_IN);
+        cbStillOut = findViewById(R.id.STILL_OUT);
+        cbWalkingIn = findViewById(R.id.WALKING_IN);
+        cbWalkingOut = findViewById(R.id.WALKING_OUT);
+        cbRunningIn = findViewById(R.id.RUNNING_IN);
+        cbRunningOut = findViewById(R.id.RUNNING_OUT);
+        findViewById(R.id.btnSubmit).setOnClickListener(this);
+        findViewById(R.id.btnMove).setOnClickListener(this);
+        addLogFragment();
+    }
+
+    public void getRequest() {
+        transitions = new ArrayList<ActivityConversionInfo>();
+        ActivityConversionInfo.Builder activityTransition = new ActivityConversionInfo.Builder();
+        RequestValueResut requestValueResut = new RequestValueResut();
+        if (cbInVehicleIn.isChecked()) {
+            requestValueResut.addList(100, 0);
+        }
+        if (cbInVehicleOut.isChecked()) {
+            requestValueResut.addList(100, 1);
+        }
+        if (cbOnBicycleIn.isChecked()) {
+            requestValueResut.addList(101, 0);
+        }
+        if (cbOnBicycleOut.isChecked()) {
+            requestValueResut.addList(101, 1);
+        }
+        if (cbOnFootIn.isChecked()) {
+            requestValueResut.addList(102, 0);
+        }
+        if (cbOnFootOut.isChecked()) {
+            requestValueResut.addList(102, 1);
+        }
+        if (cbStillIn.isChecked()) {
+            requestValueResut.addList(103, 0);
+        }
+        if (cbStillOut.isChecked()) {
+            requestValueResut.addList(103, 1);
+        }
+        if (cbWalkingIn.isChecked()) {
+            requestValueResut.addList(107, 0);
+        }
+        if (cbWalkingOut.isChecked()) {
+            requestValueResut.addList(107, 1);
+        }
+        if (cbRunningIn.isChecked()) {
+            requestValueResut.addList(108, 0);
+        }
+        if (cbRunningOut.isChecked()) {
+            requestValueResut.addList(108, 1);
+        }
+        ArrayList<RequestValue> result = requestValueResut.result;
+        for (int i = 0; i < result.size(); i++) {
+            RequestValue temp = result.get(i);
+            activityTransition.setActivityType(temp.activityType);
+            activityTransition.setConversionType(temp.activityTransition);
+            transitions.add(activityTransition.build());
+        }
+        Log.d(TAG, "transitions size is " + transitions.size());
+    }
+
+    public void requestActivityTransitionUpdate() {
+        try {
+            if (pendingIntent != null) {
+                removeActivityTransitionUpdates();
+            }
+            LocationBroadcastReceiver.addConversionListener();
+            pendingIntent = getPendingIntent();
+            activityTransitionRequest = new ActivityConversionRequest(transitions);
+            Task<Void> task =
+                activityIdentificationService.createActivityConversionUpdates(activityTransitionRequest, pendingIntent);
+            task.addOnSuccessListener(new OnSuccessListener<Void>() {
+                @Override
+                public void onSuccess(Void aVoid) {
+                    LocationLog.i(TAG, "createActivityConversionUpdates onSuccess");
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "createActivityConversionUpdates onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "createActivityConversionUpdates exception:" + e.getMessage());
+        }
+    }
+
+    public void removeActivityTransitionUpdates() {
+        try {
+            LocationBroadcastReceiver.removeConversionListener();
+            activityIdentificationService.deleteActivityConversionUpdates(pendingIntent)
+                .addOnSuccessListener(new OnSuccessListener<Void>() {
+                    @Override
+                    public void onSuccess(Void aVoid) {
+                        LocationLog.i(TAG, "deleteActivityConversionUpdates onSuccess");
+                    }
+                })
+                .addOnFailureListener(new OnFailureListener() {
+                    @Override
+                    public void onFailure(Exception e) {
+                        LocationLog.e(TAG, "deleteActivityConversionUpdates onFailure:" + e.getMessage());
+                    }
+                });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "removeActivityTransitionUpdates exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        if (pendingIntent != null) {
+            removeActivityTransitionUpdates();
+        }
+        super.onDestroy();
+    }
+
+    @SuppressLint("WrongConstant")
+    private PendingIntent getPendingIntent() {
+        Intent intent = new Intent(this, LocationBroadcastReceiver.class);
+        intent.setAction(LocationBroadcastReceiver.ACTION_PROCESS_LOCATION);
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
+            return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+        } else {
+            // For Android 12 or later devices, proactively configure the pendingIntent variability.
+            // The default value is PendingIntent.FLAG_MUTABLE. If compileSDKVersion is 30 or less, set this parameter
+            // to 1<<25.
+            return PendingIntent.getBroadcast(this, 0, intent,
+                PendingIntent.FLAG_UPDATE_CURRENT | (1<<25));
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.btnSubmit:
+                    getRequest();
+                    requestActivityTransitionUpdate();
+                    break;
+                case R.id.btnMove:
+                    removeActivityTransitionUpdates();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            LocationLog.e(TAG, "RequestLocationUpdatesWithCallbackActivity Exception:" + e);
+        }
+    }
+
+    class RequestValue {
+        public int activityType;
+
+        public int activityTransition;
+
+        RequestValue(int a, int b) {
+            this.activityType = a;
+            this.activityTransition = b;
+        }
+    }
+
+    class RequestValueResut {
+        public ArrayList<RequestValue> result = new ArrayList<RequestValue>();
+
+        public void addList(int activityType, int activityTransition) {
+            RequestValue temp = new RequestValue(activityType, activityTransition);
+            result.add(temp);
+        }
+    }
+}

+ 277 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/activity/ActivityIdentificationActivity.java

@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.activity;
+
+import android.annotation.SuppressLint;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hms.location.ActivityIdentification;
+import com.huawei.hms.location.ActivityIdentificationData;
+import com.huawei.hms.location.ActivityIdentificationService;
+import com.huawei.locationsample6.R;
+import com.huawei.locationsample6.RequestPermission;
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.locationsample6.location.fusedlocation.LocationBroadcastReceiver;
+import com.huawei.logger.LocationLog;
+
+import java.util.List;
+
+public class ActivityIdentificationActivity extends LocationBaseActivity implements View.OnClickListener {
+    private static final int PROGRESS_BAR_ORIGIN_WIDTH = 100;
+
+    private static final int ENLARGE = 6;
+
+    private static LinearLayout.LayoutParams type0;
+
+    private static LinearLayout.LayoutParams type1;
+
+    private static LinearLayout.LayoutParams type2;
+
+    private static LinearLayout.LayoutParams type3;
+
+    private static LinearLayout.LayoutParams type4;
+
+    private static LinearLayout.LayoutParams type7;
+
+    private static LinearLayout.LayoutParams type8;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityInVehicle;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityOnBicycle;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityOnFoot;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityStill;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityUnknown;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityWalking;
+
+    @SuppressLint("StaticFieldLeak")
+    private static LinearLayout activityRunning;
+
+    public ActivityIdentificationService activityIdentificationService;
+
+    public static final String TAG = "ActivityTransitionUpdate";
+
+    private PendingIntent pendingIntent;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_transition_type);
+        activityIdentificationService = ActivityIdentification.getService(this);
+        RequestPermission.requestActivityTransitionPermission(this);
+        findViewById(R.id.requestActivityTransitionUpdate).setOnClickListener(this);
+        findViewById(R.id.removeActivityTransitionUpdate).setOnClickListener(this);
+        activityInVehicle = findViewById(R.id.activity_in_vehicle);
+        if (activityInVehicle.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type0 = (LinearLayout.LayoutParams) activityInVehicle.getLayoutParams();
+        }
+        activityOnBicycle = findViewById(R.id.activity_on_bicycle);
+        if (activityOnBicycle.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type1 = (LinearLayout.LayoutParams) activityOnBicycle.getLayoutParams();
+        }
+        activityOnFoot = findViewById(R.id.activity_on_foot);
+        if (activityOnFoot.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type2 = (LinearLayout.LayoutParams) activityOnFoot.getLayoutParams();
+        }
+        activityStill = findViewById(R.id.activity_still);
+        if (activityStill.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type3 = (LinearLayout.LayoutParams) activityStill.getLayoutParams();
+        }
+        activityUnknown = findViewById(R.id.activity_unknown);
+        if (activityUnknown.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type4 = (LinearLayout.LayoutParams) activityUnknown.getLayoutParams();
+        }
+        activityWalking = findViewById(R.id.activity_walking);
+        if (activityWalking.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type7 = (LinearLayout.LayoutParams) activityWalking.getLayoutParams();
+        }
+        activityRunning = findViewById(R.id.activity_running);
+        if (activityRunning.getLayoutParams() instanceof LinearLayout.LayoutParams) {
+            type8 = (LinearLayout.LayoutParams) activityRunning.getLayoutParams();
+        }
+        addLogFragment();
+        reSet();
+    }
+
+    public void requestActivityUpdates(long detectionIntervalMillis) {
+        try {
+            if (pendingIntent != null) {
+                removeActivityUpdates();
+            }
+            pendingIntent = getPendingIntent();
+            LocationBroadcastReceiver.addIdentificationListener();
+            activityIdentificationService.createActivityIdentificationUpdates(detectionIntervalMillis, pendingIntent)
+                .addOnSuccessListener(new OnSuccessListener<Void>() {
+                    @Override
+                    public void onSuccess(Void aVoid) {
+                        LocationLog.i(TAG, "createActivityIdentificationUpdates onSuccess");
+                    }
+                })
+                .addOnFailureListener(new OnFailureListener() {
+                    @Override
+                    public void onFailure(Exception e) {
+                        LocationLog.e(TAG, "createActivityIdentificationUpdates onFailure:" + e.getMessage());
+                    }
+                });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "createActivityIdentificationUpdates exception:" + e.getMessage());
+        }
+    }
+
+    public void removeActivityUpdates() {
+        reSet();
+        try {
+            LocationBroadcastReceiver.removeIdentificationListener();
+            Log.i(TAG, "start to removeActivityUpdates");
+            activityIdentificationService.deleteActivityIdentificationUpdates(pendingIntent)
+                .addOnSuccessListener(new OnSuccessListener<Void>() {
+                    @Override
+                    public void onSuccess(Void aVoid) {
+                        LocationLog.i(TAG, "deleteActivityIdentificationUpdates onSuccess");
+                    }
+                })
+                .addOnFailureListener(new OnFailureListener() {
+                    @Override
+                    public void onFailure(Exception e) {
+                        LocationLog.e(TAG, "deleteActivityIdentificationUpdates onFailure:" + e.getMessage());
+                    }
+                });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "removeActivityUpdates exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.requestActivityTransitionUpdate:
+                    requestActivityUpdates(5000);
+                    break;
+                case R.id.removeActivityTransitionUpdate:
+                    removeActivityUpdates();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            LocationLog.e(TAG, "RequestLocationUpdatesWithCallbackActivity Exception:" + e);
+        }
+    }
+
+    @SuppressLint("WrongConstant")
+    private PendingIntent getPendingIntent() {
+        Intent intent = new Intent(this, LocationBroadcastReceiver.class);
+        intent.setAction(LocationBroadcastReceiver.ACTION_PROCESS_LOCATION);
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
+            return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+        } else {
+            // For Android 12 or later devices, proactively configure the pendingIntent variability.
+            // The default value is PendingIntent.FLAG_MUTABLE. If compileSDKVersion is 30 or less, set this parameter
+            // to 1<<25.
+            return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | (1 << 25));
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        if (pendingIntent != null) {
+            removeActivityUpdates();
+        }
+        super.onDestroy();
+    }
+
+    public static void setData(List<ActivityIdentificationData> list) {
+        reSet();
+        for (int i = 0; i < list.size(); i++) {
+            int type = list.get(i).getIdentificationActivity();
+            int value = list.get(i).getPossibility();
+            try {
+                switch (type) {
+                    case ActivityIdentificationData.VEHICLE:
+                        type0.width = type0.width + value * ENLARGE;
+                        activityInVehicle.setLayoutParams(type0);
+                        break;
+                    case ActivityIdentificationData.BIKE:
+                        type1.width = type1.width + value * ENLARGE;
+                        activityOnBicycle.setLayoutParams(type1);
+                        break;
+                    case ActivityIdentificationData.FOOT:
+                        type2.width = type2.width + value * ENLARGE;
+                        activityOnFoot.setLayoutParams(type2);
+                        break;
+                    case ActivityIdentificationData.STILL:
+                        type3.width = type3.width + value * ENLARGE;
+                        activityStill.setLayoutParams(type3);
+                        break;
+                    case ActivityIdentificationData.OTHERS:
+                        type4.width = type4.width + value * ENLARGE;
+                        activityUnknown.setLayoutParams(type4);
+                        break;
+                    case ActivityIdentificationData.WALKING:
+                        type7.width = type7.width + value * ENLARGE;
+                        activityWalking.setLayoutParams(type7);
+                        break;
+                    case ActivityIdentificationData.RUNNING:
+                        type8.width = type8.width + value * ENLARGE;
+                        activityRunning.setLayoutParams(type8);
+                        break;
+                    default:
+                        break;
+                }
+            } catch (RuntimeException e) {
+                throw e;
+            } catch (Exception e) {
+                LocationLog.e("ActivityTransitionUpdate", "setdata Exception");
+            }
+        }
+    }
+
+    public static void reSet() {
+        type0.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityInVehicle.setLayoutParams(type0);
+        type1.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityOnBicycle.setLayoutParams(type1);
+        type2.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityOnFoot.setLayoutParams(type2);
+        type3.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityStill.setLayoutParams(type3);
+        type4.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityUnknown.setLayoutParams(type4);
+        type7.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityWalking.setLayoutParams(type7);
+        type8.width = PROGRESS_BAR_ORIGIN_WIDTH;
+        activityRunning.setLayoutParams(type8);
+    }
+}

+ 302 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/geofence/GeoFenceActivity.java

@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.geofence;
+
+import android.location.Location;
+import android.os.Bundle;
+import android.os.Looper;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.Geofence;
+import com.huawei.hms.location.LocationAvailability;
+import com.huawei.hms.location.LocationCallback;
+import com.huawei.hms.location.LocationRequest;
+import com.huawei.hms.location.LocationResult;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.hms.location.LocationSettingsRequest;
+import com.huawei.hms.location.LocationSettingsResponse;
+import com.huawei.hms.location.SettingsClient;
+import com.huawei.locationsample6.R;
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.logger.LocationLog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GeoFenceActivity extends LocationBaseActivity implements View.OnClickListener {
+    public static final String TAG = "GeoFenceActivity";
+
+    LocationCallback mLocationCallbacks;
+
+    LocationRequest mLocationRequest;
+
+    private EditText setlatitude;
+
+    private EditText setlongitude;
+
+    private EditText setradius;
+
+    private EditText setUniqueId;
+
+    private EditText setConversions;
+
+    private EditText setValidContinueTime;
+
+    private EditText setDwellDelayTime;
+
+    private EditText setNotificationInterval;
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    private SettingsClient mSettingsClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_geo_fence);
+        setlatitude = findViewById(R.id.setlatitude);
+        setlongitude = findViewById(R.id.setlongitude);
+        setradius = findViewById(R.id.setradius);
+        setUniqueId = findViewById(R.id.setUniqueId);
+        setConversions = findViewById(R.id.setConversions);
+        setValidContinueTime = findViewById(R.id.setValidContinueTime);
+        setDwellDelayTime = findViewById(R.id.setDwellDelayTime);
+        setNotificationInterval = findViewById(R.id.setNotificationInterval);
+        findViewById(R.id.getCurrentLocation).setOnClickListener(this);
+        findViewById(R.id.geofence_btn).setOnClickListener(this);
+        findViewById(R.id.showGeoList).setOnClickListener(this);
+        addLogFragment();
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+        mSettingsClient = LocationServices.getSettingsClient(this);
+        mLocationRequest = new LocationRequest();
+        // Sets the interval for location update (unit: Millisecond)
+        mLocationRequest.setInterval(5000);
+        // Sets the priority
+        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
+        if (null == mLocationCallbacks) {
+            mLocationCallbacks = new LocationCallback() {
+                @Override
+                public void onLocationResult(LocationResult locationResult) {
+                    if (locationResult != null) {
+                        List<Location> locations = locationResult.getLocations();
+                        if (!locations.isEmpty()) {
+                            for (Location location : locations) {
+                                LocationLog.i(TAG,
+                                    "onLocationResult location[Longitude,Latitude,Accuracy]:" + location.getLongitude()
+                                        + "," + location.getLatitude() + "," + location.getAccuracy());
+                                setlatitude.setText(String.valueOf(location.getLatitude()));
+                                setlongitude.setText(String.valueOf(location.getLongitude()));
+                                removeGeoFenceLocationUpdatesWith();
+                            }
+                        }
+                    }
+                }
+
+                @Override
+                public void onLocationAvailability(LocationAvailability locationAvailability) {
+                    if (locationAvailability != null) {
+                        boolean flag = locationAvailability.isLocationAvailable();
+                        LocationLog.i(TAG, "GeoFence onLocationAvailability isLocationAvailable:" + flag);
+                    }
+                }
+            };
+        }
+    }
+
+    public void getText() {
+        Data temp = new Data();
+        temp.longitude = Double.parseDouble(setlongitude.getText().toString());
+        temp.latitude = Double.parseDouble(setlatitude.getText().toString());
+        temp.radius = Float.parseFloat(setradius.getText().toString());
+        temp.uniqueId = setUniqueId.getText().toString();
+        temp.conversions = Integer.parseInt(setConversions.getText().toString());
+        temp.validContinueTime = Long.parseLong(setValidContinueTime.getText().toString());
+        temp.dwellDelayTime = Integer.parseInt(setDwellDelayTime.getText().toString());
+        temp.notificationInterval = Integer.parseInt(setNotificationInterval.getText().toString());
+        GeoFenceData.addGeofence(temp);
+    }
+
+    public void getLocation() {
+        geoFence();
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.geofence_btn:
+                    getText();
+                    break;
+                case R.id.showGeoList:
+                    GeoFenceData.show();
+                    break;
+                case R.id.getCurrentLocation:
+                    getLocation();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            LocationLog.e(TAG, "GeoFenceActivity Exception:" + e);
+        }
+    }
+
+    private void geoFence() {
+        try {
+            LocationSettingsRequest.Builder builders = new LocationSettingsRequest.Builder();
+            builders.addLocationRequest(mLocationRequest);
+            LocationSettingsRequest locationSettingsRequest = builders.build();
+            // Before requesting location update, invoke checkLocationSettings to check device settings.
+            Task<LocationSettingsResponse> locationSettingsResponseTasks =
+                mSettingsClient.checkLocationSettings(locationSettingsRequest);
+            locationSettingsResponseTasks.addOnSuccessListener(new OnSuccessListener<LocationSettingsResponse>() {
+                @Override
+                public void onSuccess(LocationSettingsResponse locationSettingsResponse) {
+                    Log.i(TAG, "check location settings success");
+                    mFusedLocationProviderClient
+                        .requestLocationUpdates(mLocationRequest, mLocationCallbacks, Looper.getMainLooper())
+                        .addOnSuccessListener(new OnSuccessListener<Void>() {
+                            @Override
+                            public void onSuccess(Void aVoid) {
+                                LocationLog.i(TAG, "geoFence onSuccess");
+                            }
+                        })
+                        .addOnFailureListener(new OnFailureListener() {
+                            @Override
+                            public void onFailure(Exception e) {
+                                LocationLog.e(TAG, "geoFence onFailure:" + e.getMessage());
+                            }
+                        });
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "checkLocationSetting onFailures:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "geoFence exception:" + e.getMessage());
+        }
+    }
+
+    private void removeGeoFenceLocationUpdatesWith() {
+        try {
+            Task<Void> voidTask = mFusedLocationProviderClient.removeLocationUpdates(mLocationCallbacks);
+            voidTask.addOnSuccessListener(new OnSuccessListener<Void>() {
+                @Override
+                public void onSuccess(Void aVoid) {
+                    LocationLog.i(TAG, "removeGeoFenceLocationUpdatesWith onSuccess");
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "removeGeoFenceLocationUpdatesWith onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "removeGeoFenceLocationUpdatesWith exception:" + e.getMessage());
+        }
+    }
+
+    protected void onDestroy() {
+        // Removed when the location update is no longer required.
+        super.onDestroy();
+    }
+
+}
+
+class Data {
+    public double latitude;
+
+    public double longitude;
+
+    public float radius;
+
+    public String uniqueId;
+
+    public int conversions;
+
+    public long validContinueTime;
+
+    public int dwellDelayTime;
+
+    public int notificationInterval;
+}
+
+class GeoFenceData {
+    static ArrayList<Geofence> geofences = new ArrayList<Geofence>();
+
+    static Geofence.Builder geoBuild = new Geofence.Builder();
+
+    private static int requestCode = 0;
+
+    public static void addGeofence(Data data) {
+        if (!checkStyle(geofences, data.uniqueId)) {
+            LocationLog.d("GeoFenceActivity", "not unique ID!");
+            LocationLog.i("GeoFenceActivity", "addGeofence failed!");
+            return;
+        }
+        geoBuild.setRoundArea(data.latitude, data.longitude, data.radius);
+        geoBuild.setUniqueId(data.uniqueId);
+        geoBuild.setConversions(data.conversions);
+        geoBuild.setValidContinueTime(data.validContinueTime);
+        geoBuild.setDwellDelayTime(data.dwellDelayTime);
+        geoBuild.setNotificationInterval(data.notificationInterval);
+        geofences.add(geoBuild.build());
+        LocationLog.i("GeoFenceActivity", "addGeofence success!");
+    }
+
+    public static void createNewList() {
+        geofences = new ArrayList<Geofence>();
+    }
+
+    public static boolean checkStyle(ArrayList<Geofence> geofences, String id) {
+        for (int i = 0; i < geofences.size(); i++) {
+            if (geofences.get(i).getUniqueId().equals(id)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static ArrayList<Geofence> returnList() {
+        return geofences;
+    }
+
+    public static void show() {
+        if (geofences.isEmpty()) {
+            LocationLog.d("GeoFenceActivity", "no GeoFence Data!");
+        }
+        for (int i = 0; i < geofences.size(); i++) {
+            LocationLog.d("GeoFenceActivity", "Unique ID is " + (geofences.get(i)).getUniqueId());
+        }
+    }
+
+    public static void newRequest() {
+        requestCode++;
+    }
+
+    public static int getRequestCode() {
+        return requestCode;
+    }
+}

+ 74 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/geofence/GeoFenceBroadcastReceiver.java

@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.geofence;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.location.Location;
+
+import com.huawei.hms.location.Geofence;
+import com.huawei.hms.location.GeofenceData;
+import com.huawei.logger.LocationLog;
+
+import java.util.ArrayList;
+
+/**
+ * location broadcast receiver
+ *
+ * @since 2020-5-11
+ */
+public class GeoFenceBroadcastReceiver extends BroadcastReceiver {
+    public static final String ACTION_PROCESS_LOCATION =
+        "com.huawei.hmssample.geofence.GeoFenceBroadcastReceiver.ACTION_PROCESS_LOCATION";
+
+    private static final String TAG = "GeoFenceReceiver";
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        if (intent != null) {
+            final String action = intent.getAction();
+            StringBuilder sb = new StringBuilder();
+            String next = "\n";
+            if (ACTION_PROCESS_LOCATION.equals(action)) {
+                GeofenceData geofenceData = GeofenceData.getDataFromIntent(intent);
+                if (geofenceData != null) {
+                    int errorCode = geofenceData.getErrorCode();
+                    int conversion = geofenceData.getConversion();
+                    ArrayList<Geofence> list = new ArrayList<>();
+                    if (geofenceData.getConvertingGeofenceList() instanceof ArrayList) {
+                        list = (ArrayList<Geofence>) geofenceData.getConvertingGeofenceList();
+                    }
+                    Location myLocation = geofenceData.getConvertingLocation();
+                    sb.append("errorcode: " + errorCode + next);
+                    sb.append("conversion: " + conversion + next);
+                    if (list != null) {
+                        for (int i = 0; i < list.size(); i++) {
+                            sb.append("geoFence id :" + list.get(i).getUniqueId() + next);
+                        }
+                    }
+                    if (myLocation != null) {
+                        sb.append("location is :" + myLocation.getLongitude() + " " + myLocation.getLatitude() + next);
+                    }
+                    boolean status = geofenceData.isSuccess();
+                    sb.append("is successful :" + status);
+                    LocationLog.i(TAG, sb.toString());
+                }
+            }
+        }
+    }
+}

+ 390 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/geofence/OperateGeoFenceActivity.java

@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.geofence;
+
+import android.annotation.SuppressLint;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.huawei.hmf.tasks.OnCompleteListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.Geofence;
+import com.huawei.hms.location.GeofenceRequest;
+import com.huawei.hms.location.GeofenceService;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.locationsample6.R;
+import com.huawei.locationsample6.location.fusedlocation.LocationBaseActivity;
+import com.huawei.logger.LocationLog;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class OperateGeoFenceActivity extends LocationBaseActivity implements View.OnClickListener {
+    public static final ArrayList<RequestList> REQUEST_LIST = new ArrayList<RequestList>();
+
+    public static final String TAG = "operateGeoFenceActivity";
+
+    public GeofenceService geofenceService;
+
+    private TextView geoFenceData;
+
+    private TextView geoRequestData;
+
+    private EditText removeWithPendingIntentInput;
+
+    private EditText removeWithIDInput;
+
+    private EditText trigger;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_operate_geo_fence);
+        findViewById(R.id.getGeoFenceData).setOnClickListener(this);
+        findViewById(R.id.CreateGeofence).setOnClickListener(this);
+        findViewById(R.id.sendRequest).setOnClickListener(this);
+        findViewById(R.id.sendRequestWithNew).setOnClickListener(this);
+        findViewById(R.id.GetRequestMessage).setOnClickListener(this);
+        findViewById(R.id.removeGeofence).setOnClickListener(this);
+        findViewById(R.id.removeWithID).setOnClickListener(this);
+        findViewById(R.id.removeWithIntent).setOnClickListener(this);
+        removeWithPendingIntentInput = findViewById(R.id.removeWithPendingIntentInput);
+        removeWithIDInput = findViewById(R.id.removeWithIDInput);
+        trigger = findViewById(R.id.trigger);
+        geoFenceData = findViewById(R.id.GeoFenceData);
+        geoRequestData = findViewById(R.id.GeoRequestData);
+        geofenceService = LocationServices.getGeofenceService(this);
+        addLogFragment();
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.CreateGeofence:
+                    Intent geoFenceIntent = new Intent();
+                    geoFenceIntent.setClass(this, GeoFenceActivity.class);
+                    geoFenceIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                    startActivity(geoFenceIntent);
+                    break;
+                case R.id.removeGeofence:
+                    GeoFenceData.createNewList();
+                    break;
+                case R.id.getGeoFenceData:
+                    getData();
+                    break;
+                case R.id.sendRequest:
+                    requestGeoFenceWithIntent();
+                    break;
+                case R.id.sendRequestWithNew:
+                    requestGeoFenceWithNewIntent();
+                    break;
+                case R.id.GetRequestMessage:
+                    getRequestMessage();
+                    break;
+                case R.id.removeWithIntent:
+                    removeWithIntent();
+                    break;
+                case R.id.removeWithID:
+                    removeWithID();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            LocationLog.e(TAG, "operateGeoFenceActivity Exception:" + e);
+        }
+    }
+
+    public void requestGeoFenceWithNewIntent() {
+        if (GeoFenceData.returnList().isEmpty()) {
+            geoRequestData.setText("no new request to add!");
+            return;
+        }
+        if (checkUniqueID()) {
+            geoRequestData.setText("ID already exist,please remove and add it agagin!");
+            return;
+        }
+        GeofenceRequest.Builder geofenceRequest = new GeofenceRequest.Builder();
+        geofenceRequest.createGeofenceList(GeoFenceData.returnList());
+        if (trigger.getText() != null) {
+            int trigGer = Integer.parseInt(trigger.getText().toString());
+            geofenceRequest.setInitConversions(trigGer);
+            LocationLog.d(TAG, "trigger is " + trigGer);
+        } else {
+            geofenceRequest.setInitConversions(5);
+            LocationLog.d(TAG, "default trigger is 5");
+        }
+
+        final PendingIntent pendingIntent = getPendingIntent();
+        try {
+            geofenceService.createGeofenceList(geofenceRequest.build(), pendingIntent)
+                .addOnCompleteListener(new OnCompleteListener<Void>() {
+                    @Override
+                    public void onComplete(Task<Void> task) {
+                        if (task.isSuccessful()) {
+                            LocationLog.i(TAG, "add geofence success!");
+                            setList(pendingIntent, GeoFenceData.getRequestCode(), GeoFenceData.returnList());
+                            GeoFenceData.createNewList();
+                        } else {
+                            // Get the status code for the error and log it using a user-friendly message.
+                            LocationLog.w(TAG, "add geofence failed : " + task.getException().getMessage());
+                        }
+                    }
+                });
+        } catch (Exception e) {
+            LocationLog.i(TAG, "add geofence error:" + e.getMessage());
+        }
+    }
+
+    public PendingIntent findIntentByID(int a) {
+        PendingIntent intent = null;
+        for (int i = REQUEST_LIST.size() - 1; i >= 0; i--) {
+            if (REQUEST_LIST.get(i).requestCode == a) {
+                intent = REQUEST_LIST.get(i).pendingIntent;
+                REQUEST_LIST.remove(i);
+            }
+        }
+        return intent;
+    }
+
+    public void removeWithIntent() {
+        int s = Integer.parseInt(removeWithPendingIntentInput.getText().toString());
+        PendingIntent intent = findIntentByID(s);
+        if (intent == null) {
+            geoRequestData.setText("no such intent!");
+            return;
+        }
+        try {
+            geofenceService.deleteGeofenceList(intent).addOnCompleteListener(new OnCompleteListener<Void>() {
+                @Override
+                public void onComplete(Task<Void> task) {
+                    if (task.isSuccessful()) {
+                        LocationLog.i(TAG, "delete geofence with intent success!");
+                    } else {
+                        // Get the status code for the error and log it using a user-friendly message.
+                        LocationLog.w(TAG, "delete geofence with intent failed ");
+                    }
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.i(TAG, "delete geofence error:" + e.getMessage());
+        }
+    }
+
+    public void removeWithID() {
+        String s = removeWithIDInput.getText().toString();
+        String[] str = s.split(" ");
+        List<String> list = new ArrayList<>();
+        List<String> geofenceList = new ArrayList<>();
+        Collections.addAll(list, str);
+        for (int i = 0; i < REQUEST_LIST.size(); i++) {
+            for (int j = 0; j < REQUEST_LIST.get(i).geofences.size(); j++) {
+                geofenceList.add(REQUEST_LIST.get(i).geofences.get(j).getUniqueId());
+            }
+        }
+        for (int i = 0; i < list.size(); i++) {
+            if (!geofenceList.contains(list.get(i))) {
+                LocationLog.i(TAG, "delete ID not found.");
+                return;
+            }
+        }
+        try {
+            geofenceService.deleteGeofenceList(list).addOnCompleteListener(new OnCompleteListener<Void>() {
+                @Override
+                public void onComplete(Task<Void> task) {
+                    if (task.isSuccessful()) {
+                        LocationLog.i(TAG, "delete geofence with ID success!");
+                    } else {
+                        // Get the status code for the error and log it using a user-friendly message.
+                        LocationLog.w(TAG, "delete geofence with ID failed ");
+                    }
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.i(TAG, "delete ID error:" + e.getMessage());
+        }
+        listRemoveID(str);
+    }
+
+    public void listRemoveID(String[] str) {
+        for (int i = 0; i < REQUEST_LIST.size(); i++) {
+            REQUEST_LIST.get(i).removeID(str);
+        }
+    }
+
+    public void requestGeoFenceWithIntent() {
+        if (GeoFenceData.returnList().isEmpty()) {
+            geoRequestData.setText("no new request to add!");
+            return;
+        }
+        if (REQUEST_LIST.isEmpty()) {
+            geoRequestData.setText("no pengdingIntent to send!");
+            return;
+        }
+        if (checkUniqueID()) {
+            geoRequestData.setText("ID already exist,please remove and add it agagin!");
+            return;
+        }
+        checkUniqueID();
+        GeofenceRequest.Builder geofenceRequest = new GeofenceRequest.Builder();
+        geofenceRequest.createGeofenceList(GeoFenceData.returnList());
+        if (trigger.getText() != null) {
+            int trigGer = Integer.parseInt(trigger.getText().toString());
+            geofenceRequest.setInitConversions(trigGer);
+            LocationLog.d(TAG, "trigger is " + trigGer);
+        } else {
+            geofenceRequest.setInitConversions(5);
+            LocationLog.d(TAG, "default trigger is 5");
+        }
+        RequestList temp = REQUEST_LIST.get(REQUEST_LIST.size() - 1);
+        PendingIntent pendingIntent = temp.pendingIntent;
+        try {
+            geofenceService.createGeofenceList(geofenceRequest.build(), pendingIntent)
+                .addOnCompleteListener(new OnCompleteListener<Void>() {
+                    @Override
+                    public void onComplete(Task<Void> task) {
+                        if (task.isSuccessful()) {
+                            LocationLog.i(TAG, "add geofence success!");
+                        } else {
+                            // Get the status code for the error and log it using a user-friendly message.
+                            LocationLog.w(TAG, "add geofence failed : " + task.getException().getMessage());
+                        }
+                    }
+                });
+            setList(pendingIntent, temp.requestCode, GeoFenceData.returnList());
+            GeoFenceData.createNewList();
+        } catch (Exception e) {
+            LocationLog.i(TAG, "add geofence error:" + e.getMessage());
+        }
+    }
+
+    public boolean checkUniqueID() {
+        for (int i = 0; i < REQUEST_LIST.size(); i++) {
+            if (REQUEST_LIST.get(i).checkID()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void getData() {
+        ArrayList<Geofence> geofences = GeoFenceData.returnList();
+        StringBuilder buf = new StringBuilder();
+        String s = "";
+        if (geofences.isEmpty()) {
+            buf.append("no GeoFence Data!");
+        }
+        for (int i = 0; i < geofences.size(); i++) {
+            buf.append("Unique ID is " + geofences.get(i).getUniqueId() + "\n");
+        }
+        s = buf.toString();
+        geoFenceData.setText(s);
+    }
+
+    public void setList(PendingIntent intent, int code, ArrayList<Geofence> geofences) {
+        RequestList temp = new RequestList(intent, code, geofences);
+        REQUEST_LIST.add(temp);
+    }
+
+    public void getRequestMessage() {
+        StringBuilder buf = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < REQUEST_LIST.size(); i++) {
+            buf.append(REQUEST_LIST.get(i).show());
+        }
+        s = buf.toString();
+        if (s.equals("")) {
+            s = "no request!";
+        }
+        geoRequestData.setText(s);
+    }
+
+    @SuppressLint("WrongConstant")
+    private PendingIntent getPendingIntent() {
+        Intent intent = new Intent(this, GeoFenceBroadcastReceiver.class);
+        intent.setAction(GeoFenceBroadcastReceiver.ACTION_PROCESS_LOCATION);
+        Log.d(TAG, "new request");
+        GeoFenceData.newRequest();
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
+            return PendingIntent.getBroadcast(this, GeoFenceData.getRequestCode(), intent,
+                PendingIntent.FLAG_UPDATE_CURRENT);
+        } else {
+            // For Android 12 or later devices, proactively configure the pendingIntent variability.
+            // The default value is PendingIntent.FLAG_MUTABLE. If compileSDKVersion is 30 or less, set this parameter
+            // to 1<<25.
+            return PendingIntent.getBroadcast(this, GeoFenceData.getRequestCode(), intent,
+                PendingIntent.FLAG_UPDATE_CURRENT | (1 << 25));
+        }
+    }
+}
+
+class RequestList {
+    public PendingIntent pendingIntent;
+
+    public int requestCode;
+
+    public ArrayList<Geofence> geofences;
+
+    RequestList(PendingIntent pendingIntent, int requestCode, ArrayList<Geofence> geofences) {
+        this.pendingIntent = pendingIntent;
+        this.requestCode = requestCode;
+        this.geofences = geofences;
+    }
+
+    public String show() {
+        StringBuilder buf = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < geofences.size(); i++) {
+            buf.append("PendingIntent: " + requestCode + " UniqueID: " + geofences.get(i).getUniqueId() + "\n");
+        }
+        s = buf.toString();
+        return s;
+    }
+
+    public boolean checkID() {
+        ArrayList<Geofence> list = GeoFenceData.returnList();
+        for (int j = 0; j < list.size(); j++) {
+            String s = list.get(j).getUniqueId();
+            for (int i = 0; i < geofences.size(); i++) {
+                if (s.equals(geofences.get(i).getUniqueId())) {
+                    return true;
+                    // id already exist
+                }
+            }
+        }
+        return false;
+    }
+
+    public void removeID(String[] str) {
+        for (int i = 0; i < str.length; i++) {
+            String s = str[i];
+            for (int j = geofences.size() - 1; j >= 0; j--) {
+                if (s.equals(geofences.get(j).getUniqueId())) {
+                    geofences.remove(j);
+                }
+            }
+        }
+    }
+}

+ 189 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/CheckSettingActivity.java

@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TableLayout;
+
+import com.huawei.hmf.tasks.OnCompleteListener;
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.LocationRequest;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.hms.location.LocationSettingsRequest;
+import com.huawei.hms.location.LocationSettingsResponse;
+import com.huawei.hms.location.LocationSettingsStates;
+import com.huawei.hms.location.SettingsClient;
+import com.huawei.location.lite.common.util.ExecutorUtil;
+import com.huawei.locationsample6.JsonDataUtil;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+public class CheckSettingActivity extends LocationBaseActivity {
+    private static final String TAG = "CheckSettingActivity";
+
+    private SettingsClient settingsClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_check_setting);
+        settingsClient = LocationServices.getSettingsClient(this);
+        TableLayout tableLayout = findViewById(R.id.check_setting_table_layout_show);
+        String settingJson = JsonDataUtil.getJson(this, "CheckLocationSettings.json", true);
+        initDataDisplayView(TAG, tableLayout, settingJson);
+        addLogFragment();
+    }
+
+
+    public void checkSettings(View view) {
+        ExecutorUtil.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    CheckSettingsRequest checkSettingsRequest = new CheckSettingsRequest();
+                    LocationRequest locationRequest = new LocationRequest();
+                    checkSettingsRequest.setLocationRequest(locationRequest);
+                    checkSettingsRequest.setAlwaysShow(false);
+                    checkSettingsRequest.setNeedBle(false);
+                    LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
+                        .addLocationRequest(checkSettingsRequest.getLocationRequest())
+                        .setAlwaysShow(checkSettingsRequest.isAlwaysShow())
+                        .setNeedBle(checkSettingsRequest.isNeedBle());
+                    settingsClient.checkLocationSettings(builder.build())
+                        .addOnCompleteListener(new OnCompleteListener<LocationSettingsResponse>() {
+                            @Override
+                            public void onComplete(Task<LocationSettingsResponse> task) {
+                                if (task != null && task.isSuccessful()) {
+                                    LocationSettingsResponse response = task.getResult();
+                                    if (response == null) {
+                                        return;
+                                    }
+                                    LocationSettingsStates locationSettingsStates =
+                                        response.getLocationSettingsStates();
+                                    StringBuilder stringBuilder = new StringBuilder();
+                                    stringBuilder.append("\nisBlePresent=")
+                                        .append(locationSettingsStates.isBlePresent());
+                                    stringBuilder.append(",\nisBleUsable=")
+                                        .append(locationSettingsStates.isBleUsable());
+                                    stringBuilder.append(",\nisGnssPresent=")
+                                        .append(locationSettingsStates.isGnssPresent());
+                                    stringBuilder.append(",\nisGnssUsable=")
+                                        .append(locationSettingsStates.isGnssUsable());
+                                    stringBuilder.append(",\nisLocationPresent=")
+                                        .append(locationSettingsStates.isLocationPresent());
+                                    stringBuilder.append(",\nisLocationUsable=")
+                                        .append(locationSettingsStates.isLocationUsable());
+                                    stringBuilder.append(",\nisNetworkLocationUsable=")
+                                        .append(locationSettingsStates.isNetworkLocationUsable());
+                                    stringBuilder.append(",\nisNetworkLocationPresent=")
+                                        .append(locationSettingsStates.isNetworkLocationPresent());
+                                    stringBuilder.append(",\nisHMSLocationUsable=")
+                                        .append(locationSettingsStates.isHMSLocationUsable());
+                                    stringBuilder.append(",\nisHMSLocationPresent=")
+                                        .append(locationSettingsStates.isHMSLocationPresent());
+                                    LocationLog.i(TAG, "checkLocationSetting onComplete:" + stringBuilder.toString());
+                                }
+                            }
+                        })
+                        .addOnFailureListener(new OnFailureListener() {
+                            @Override
+                            public void onFailure(Exception e) {
+                                LocationLog.i(TAG, "checkLocationSetting onFailure:" + e.getMessage());
+                            }
+                        });
+                } catch (Exception e) {
+                    LocationLog.i(TAG, "checkLocationSetting exception:" + e.getMessage());
+                }
+            }
+        });
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (null == data) {
+            return;
+        }
+        LocationSettingsStates locationSettingsStates = LocationSettingsStates.fromIntent(data);
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append("\nisBlePresent=").append(locationSettingsStates.isBlePresent());
+        stringBuilder.append(",\nisBleUsable=").append(locationSettingsStates.isBleUsable());
+        stringBuilder.append(",\nisGnssPresent=").append(locationSettingsStates.isGnssPresent());
+        stringBuilder.append(",\nisGnssUsable=").append(locationSettingsStates.isGnssUsable());
+        stringBuilder.append(",\nisLocationPresent=").append(locationSettingsStates.isLocationPresent());
+        stringBuilder.append(",\nisLocationUsable=").append(locationSettingsStates.isLocationUsable());
+        stringBuilder.append(",\nisNetworkLocationPresent=").append(locationSettingsStates.isNetworkLocationPresent());
+        stringBuilder.append(",\nisNetworkLocationUsable=").append(locationSettingsStates.isNetworkLocationUsable());
+        stringBuilder.append(",\nisHMSLocationUsable=").append(locationSettingsStates.isHMSLocationUsable());
+        stringBuilder.append(",\nisHMSLocationPresent=").append(locationSettingsStates.isHMSLocationPresent());
+        LocationLog.i(TAG, "checkLocationSetting onComplete:" + stringBuilder.toString());
+        switch (requestCode) {
+            // Check for the integer request code originally supplied to startResolutionForResult().
+            case 0:
+                switch (resultCode) {
+                    case Activity.RESULT_OK:
+                        LocationLog.i(TAG, "User agreed to make required location settings changes.");
+                        // Nothing to do. startLocationupdates() gets called in onResume again.
+                        break;
+                    case Activity.RESULT_CANCELED:
+                        LocationLog.i(TAG, "User chose not to make required location settings changes.");
+                        break;
+                    default:
+                        break;
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+    private class CheckSettingsRequest {
+        private LocationRequest locationRequest;
+
+        private boolean alwaysShow;
+
+        private boolean needBle;
+
+        public LocationRequest getLocationRequest() {
+            return locationRequest;
+        }
+
+        public void setLocationRequest(LocationRequest locationRequest) {
+            this.locationRequest = locationRequest;
+        }
+
+        public boolean isAlwaysShow() {
+            return alwaysShow;
+        }
+
+        public void setAlwaysShow(boolean alwaysShow) {
+            this.alwaysShow = alwaysShow;
+        }
+
+        public boolean isNeedBle() {
+            return needBle;
+        }
+
+        public void setNeedBle(boolean needBle) {
+            this.needBle = needBle;
+        }
+    }
+}

+ 96 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/GetLastLocationActivity.java

@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.location.Location;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+/**
+ * getLastLocation Example
+ *
+ * @since 2020-5-11
+ */
+public class GetLastLocationActivity extends LocationBaseActivity implements OnClickListener {
+    public static final String TAG = "HuaweiPushActivity";
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location_get_last_location);
+        // Button click listeners
+        findViewById(R.id.location_getLastLocation).setOnClickListener(this);
+        addLogFragment();
+        // Creating a Location Service Client
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(getBaseContext());
+    }
+
+    /**
+     * Obtain the last known location
+     */
+    private void getLastLocation() {
+        try {
+            Task<Location> lastLocation = mFusedLocationProviderClient.getLastLocation();
+            lastLocation.addOnSuccessListener(new OnSuccessListener<Location>() {
+                @Override
+                public void onSuccess(Location location) {
+                    if (location == null) {
+                        LocationLog.i(TAG, "getLastLocation onSuccess location is null");
+                        return;
+                    }
+                    LocationLog.i(TAG, "getLastLocation onSuccess location[Longitude,Latitude]:"
+                        + location.getLongitude() + "," + location.getLatitude());
+                    return;
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "getLastLocation onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "getLastLocation exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_getLastLocation:
+                    getLastLocation();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "GetLastLocationActivity Exception:" + e);
+        }
+    }
+}

+ 92 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/GetLocationAvailabilityActivity.java

@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.LocationAvailability;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+/**
+ * getLocationAvailability Example
+ *
+ * @since 2020-5-11
+ */
+public class GetLocationAvailabilityActivity extends LocationBaseActivity implements OnClickListener {
+    public static final String TAG = "LocationAvailability";
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location_get_location_availability);
+        // Button click listeners
+        findViewById(R.id.location_getLocationAvailability).setOnClickListener(this);
+        addLogFragment();
+
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+    }
+
+    /**
+     * Obtaining Location Availability
+     */
+    private void getLocationAvailability() {
+        try {
+            Task<LocationAvailability> locationAvailability = mFusedLocationProviderClient.getLocationAvailability();
+            locationAvailability.addOnSuccessListener(new OnSuccessListener<LocationAvailability>() {
+                @Override
+                public void onSuccess(LocationAvailability locationAvailability) {
+                    if (locationAvailability != null) {
+                        LocationLog.i(TAG, "getLocationAvailability onSuccess:" + locationAvailability.toString());
+                    }
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "getLocationAvailability onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "getLocationAvailability exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_getLocationAvailability:
+                    getLocationAvailability();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "getLocationAvailability Exception:" + e);
+        }
+    }
+}

+ 94 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/LocationBaseActivity.java

@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.app.FragmentTransaction;
+import android.graphics.Color;
+import android.text.InputType;
+import android.util.Log;
+import android.widget.EditText;
+import android.widget.TableLayout;
+import android.widget.TableRow;
+import android.widget.TextView;
+
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+import com.huawei.logger.LogFragment;
+import com.huawei.logger.LoggerActivity;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * add addLogFragment() method, if you want to show log on the screen
+ *
+ * @since 2020-5-11
+ */
+public class LocationBaseActivity extends LoggerActivity {
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+    }
+
+    /**
+     * print log on the screen
+     */
+    protected void addLogFragment() {
+        final FragmentTransaction transaction = getFragmentManager().beginTransaction();
+        final LogFragment fragment = new LogFragment();
+        if (transaction != null) {
+            transaction.replace(R.id.framelog, fragment);
+            transaction.commit();
+        } else {
+            LocationLog.e("LocationBaseActivity", "addLogFragment error !");
+        }
+    }
+
+    public void initDataDisplayView(String tag, TableLayout tableLayout, String json) {
+        try {
+            JSONObject jsonObject = new JSONObject(json);
+            Iterator iterator = jsonObject.keys();
+            while (iterator.hasNext()) {
+                String key = (String) iterator.next();
+                TableRow tableRow = new TableRow(getBaseContext());
+                TextView textView = new TextView(getBaseContext());
+                textView.setText(key);
+                textView.setTextColor(Color.GRAY);
+                textView.setId(getBaseContext().getResources()
+                    .getIdentifier(key + "_key", "id", getBaseContext().getPackageName()));
+                tableRow.addView(textView);
+                EditText editText = new EditText(getBaseContext());
+                String value = jsonObject.getString(key);
+                editText.setText(value);
+                editText.setId(getBaseContext().getResources()
+                    .getIdentifier(key + "_value", "id", getBaseContext().getPackageName()));
+                editText.setTextColor(Color.DKGRAY);
+                if (!key.equals("isFastestIntervalExplicitlySet") && !key.equals("needAddress")
+                    && !key.equals("language") && !key.equals("countryCode") && !key.equals("alwaysShow")
+                    && !key.equals("needble")) {
+                    editText.setInputType(InputType.TYPE_CLASS_NUMBER);
+                }
+                tableRow.addView(editText);
+                tableLayout.addView(tableRow);
+            }
+        } catch (JSONException e) {
+            Log.e(tag, "initDataDisplayView JSONException:" + e.getMessage());
+        }
+    }
+}

+ 130 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/LocationBroadcastReceiver.java

@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.location.Location;
+import android.util.Log;
+
+import com.huawei.hms.location.ActivityConversionData;
+import com.huawei.hms.location.ActivityConversionResponse;
+import com.huawei.hms.location.ActivityIdentificationData;
+import com.huawei.hms.location.ActivityIdentificationResponse;
+import com.huawei.hms.location.LocationAvailability;
+import com.huawei.hms.location.LocationResult;
+import com.huawei.locationsample6.activity.ActivityIdentificationActivity;
+import com.huawei.logger.LocationLog;
+
+import java.util.List;
+
+/**
+ * location broadcast receiver
+ *
+ * @since 2020-5-11
+ */
+public class LocationBroadcastReceiver extends BroadcastReceiver {
+    private static final String TAG = "LocationReceiver";
+
+    public static final String ACTION_PROCESS_LOCATION = "com.huawei.hms.location.ACTION_PROCESS_LOCATION";
+
+    public static boolean isListenActivityIdentification = false;
+
+    public static boolean isListenActivityConversion = false;
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        if (intent != null) {
+            final String action = intent.getAction();
+            StringBuilder sb = new StringBuilder();
+            if (ACTION_PROCESS_LOCATION.equals(action)) {
+                // Processing LocationResult information
+                Log.i(TAG, "null != intent");
+                String messageBack = "";
+                StringBuffer buf = new StringBuffer();
+                ActivityConversionResponse activityTransitionResult =
+                    ActivityConversionResponse.getDataFromIntent(intent);
+                if (activityTransitionResult != null && isListenActivityConversion) {
+                    List<ActivityConversionData> list = activityTransitionResult.getActivityConversionDatas();
+                    for (int i = 0; i < list.size(); i++) {
+                        Log.i(TAG, "activityTransitionEvent[" + i + "]" + list.get(i));
+                        buf.append(list.get(i) + "\n");
+                    }
+                    messageBack = buf.toString();
+                    LocationLog.d("TAG", messageBack);
+                }
+
+                ActivityIdentificationResponse activityRecognitionResult =
+                    ActivityIdentificationResponse.getDataFromIntent(intent);
+                if (activityRecognitionResult != null && isListenActivityIdentification) {
+                    LocationLog.i(TAG, "activityRecognitionResult:" + activityRecognitionResult);
+                    List<ActivityIdentificationData> list = activityRecognitionResult.getActivityIdentificationDatas();
+                    ActivityIdentificationActivity.setData(list);
+                }
+                if (LocationResult.hasResult(intent)) {
+                    LocationResult result = LocationResult.extractResult(intent);
+                    if (result != null) {
+                        List<Location> locations = result.getLocations();
+                        if (!locations.isEmpty()) {
+                            sb.append("requestLocationUpdatesWithIntent[Longitude,Latitude,Accuracy]:");
+                            sb.append((char) 13).append((char) 10);
+                            for (Location location : locations) {
+                                sb.append(location.getLongitude())
+                                    .append(",")
+                                    .append(location.getLatitude())
+                                    .append(",")
+                                    .append(location.getAccuracy())
+                                    .append((char) 13)
+                                    .append((char) 10);
+                            }
+                        }
+                    }
+                }
+
+                // Processing LocationAvailability information
+                if (LocationAvailability.hasLocationAvailability(intent)) {
+                    LocationAvailability locationAvailability =
+                        LocationAvailability.extractLocationAvailability(intent);
+                    if (locationAvailability != null) {
+                        sb.append("[locationAvailability]:" + locationAvailability.isLocationAvailable());
+                        sb.append((char) 13).append((char) 10);
+                    }
+                }
+            }
+            if (!"".equals(sb.toString())) {
+                LocationLog.i(TAG, sb.toString());
+            }
+        }
+    }
+
+    public static void addConversionListener() {
+        isListenActivityConversion = true;
+    }
+
+    public static void removeConversionListener() {
+        isListenActivityConversion = false;
+    }
+
+    public static void addIdentificationListener() {
+        isListenActivityIdentification = true;
+    }
+
+    public static void removeIdentificationListener() {
+        isListenActivityIdentification = false;
+    }
+}

+ 420 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/RequestLocationUpdatesHDWithCallbackActivity.java

@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.content.pm.PackageManager;
+import android.location.Location;
+import android.os.Bundle;
+import android.os.Looper;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TableLayout;
+import android.widget.TableRow;
+
+import androidx.core.app.ActivityCompat;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.HWLocation;
+import com.huawei.hms.location.LocationAvailability;
+import com.huawei.hms.location.LocationCallback;
+import com.huawei.hms.location.LocationRequest;
+import com.huawei.hms.location.LocationResult;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.location.lite.common.util.ExecutorUtil;
+import com.huawei.locationsample6.JsonDataUtil;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class RequestLocationUpdatesHDWithCallbackActivity extends LocationBaseActivity implements View.OnClickListener {
+    private static final String TAG = "LocationWithHd";
+
+    LocationCallback mLocationHDCallback;
+
+    LocationCallback mLocationIndoorCallback;
+
+    private FusedLocationProviderClient fusedLocationProviderClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_hms_hd);
+        fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+        TableLayout tableLayout = findViewById(R.id.callback_table_layout_show);
+        String locationRequestJson = JsonDataUtil.getJson(this, "LocationRequest.json", true);
+        initDataDisplayView(TAG, tableLayout, locationRequestJson);
+        findViewById(R.id.btn_remove_hd).setOnClickListener(this);
+        findViewById(R.id.btn_hd).setOnClickListener(this);
+        findViewById(R.id.btn_remove_indoorHd).setOnClickListener(this);
+        findViewById(R.id.btn_indoorHd).setOnClickListener(this);
+        findViewById(R.id.btn_remove_indoorHdAndHigh).setOnClickListener(this);
+        findViewById(R.id.btn_indoorHdAndHigh).setOnClickListener(this);
+        addLogFragment();
+        if (ActivityCompat.checkSelfPermission(this,
+            android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+            && ActivityCompat.checkSelfPermission(this,
+                android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+            String[] strings =
+                {android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION};
+            ActivityCompat.requestPermissions(this, strings, 1);
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()) {
+            case R.id.btn_hd:
+                getLocationWithHd();
+                break;
+            case R.id.btn_remove_hd:
+                removeLocationHd();
+                break;
+            case R.id.btn_indoorHd:
+                getLocationWithIndoor();
+                break;
+            case R.id.btn_remove_indoorHd:
+                removeLocationIndoor();
+                break;
+            case R.id.btn_indoorHdAndHigh:
+                getLocationWithIndoor();
+                break;
+            case R.id.btn_remove_indoorHdAndHigh:
+                removeLocationIndoor();
+                break;
+            default:
+                break;
+        }
+    }
+
+    private void removeLocationHd() {
+        ExecutorUtil.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    fusedLocationProviderClient.removeLocationUpdates(mLocationHDCallback)
+                        .addOnSuccessListener(new OnSuccessListener<Void>() {
+                            @Override
+                            public void onSuccess(Void aVoid) {
+                                LocationLog.i(TAG, "removeLocationHd onSuccess");
+                            }
+                        })
+                        .addOnFailureListener(new OnFailureListener() {
+                            @Override
+                            public void onFailure(Exception e) {
+                                LocationLog.i(TAG, "removeLocationHd onFailure:" + e.getMessage());
+                            }
+                        });
+                } catch (Exception e) {
+                    LocationLog.e(TAG, "removeLocationHd exception:" + e.getMessage());
+                }
+            }
+        });
+        Log.i(TAG, "call removeLocationUpdatesWithCallback success.");
+    }
+
+    private void removeLocationIndoor() {
+        ExecutorUtil.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    fusedLocationProviderClient.removeLocationUpdates(mLocationIndoorCallback)
+                        .addOnSuccessListener(new OnSuccessListener<Void>() {
+                            @Override
+                            public void onSuccess(Void aVoid) {
+                                LocationLog.i(TAG, "removeLocationIndoor onSuccess");
+                            }
+                        })
+                        .addOnFailureListener(new OnFailureListener() {
+                            @Override
+                            public void onFailure(Exception e) {
+                                LocationLog.i(TAG, "removeLocationIndoor onFailure:" + e.getMessage());
+                            }
+                        });
+                } catch (Exception e) {
+                    LocationLog.e(TAG, "removeLocationIndoor exception:" + e.getMessage());
+                }
+            }
+        });
+        Log.i(TAG, "call removeLocationUpdatesWithCallback success.");
+    }
+
+    private void getLocationWithHd() {
+        ExecutorUtil.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    LocationRequest locationRequest = new LocationRequest();
+                    setLocationRequest(locationRequest);
+                    // Sets the type of the returned coordinate:
+                    // COORDINATE_TYPE_WGS84 Indicates that the 84 coordinate is returned.
+                    // COORDINATE_TYPE_GCJ02 Indicates that the 02 coordinate is returned. The default value is
+                    // COORDENATE_TYPE_WGS84.
+                    // If a high-precision coordinate is returned, no conversion is performed.
+                    locationRequest.setCoordinateType(LocationRequest.COORDINATE_TYPE_WGS84);
+                    if (null == mLocationHDCallback) {
+                        mLocationHDCallback = new LocationCallback() {
+                            @Override
+                            public void onLocationResult(LocationResult locationRequest) {
+                                Log.i(TAG, "getLocationWithHd callback onLocationResult print");
+                                logResult(locationRequest);
+                            }
+
+                            @Override
+                            public void onLocationAvailability(LocationAvailability locationAvailability) {
+                                Log.i(TAG, "getLocationWithHd callback onLocationAvailability print");
+                                if (locationAvailability != null) {
+                                    boolean flag = locationAvailability.isLocationAvailable();
+                                    LocationLog.i(TAG, "onLocationAvailability isLocationAvailable:" + flag);
+                                }
+                            }
+                        };
+                    }
+                    fusedLocationProviderClient
+                        .requestLocationUpdatesEx(locationRequest, mLocationHDCallback, Looper.getMainLooper())
+                        .addOnSuccessListener(new OnSuccessListener<Void>() {
+                            @Override
+                            public void onSuccess(Void aVoid) {
+                                LocationLog.i(TAG, "getLocationWithHd onSuccess");
+                            }
+                        })
+                        .addOnFailureListener(new OnFailureListener() {
+                            @Override
+                            public void onFailure(Exception e) {
+                                LocationLog.i(TAG, "getLocationWithHd onFailure:" + e.getMessage());
+                            }
+                        });
+                } catch (Exception e) {
+                    LocationLog.i(TAG, "getLocationWithHd exception :" + e.getMessage());
+                }
+            }
+        });
+    }
+
+    private void getLocationWithIndoor() {
+        ExecutorUtil.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    LocationRequest locationRequest = new LocationRequest();
+                    setLocationRequest(locationRequest);
+                    // Sets the type of the returned coordinate:
+                    // COORDINATE_TYPE_WGS84 Indicates that the 84 coordinate is returned.
+                    // COORDINATE_TYPE_GCJ02 Indicates that the 02 coordinate is returned. The default value is
+                    // COORDENATE_TYPE_WGS84.
+                    locationRequest.setCoordinateType(LocationRequest.COORDINATE_TYPE_WGS84);
+                    if (null == mLocationIndoorCallback) {
+                        mLocationIndoorCallback = new LocationCallback() {
+                            @Override
+                            public void onLocationResult(LocationResult locationResult) {
+                                Log.i(TAG, "getLocationWithIndoor callback onLocationResult print");
+                                logResultIndoor(locationResult);
+                            }
+
+                            @Override
+                            public void onLocationAvailability(LocationAvailability locationAvailability) {
+                                Log.i(TAG, "getLocationWithIndoor callback onLocationAvailability print");
+                                if (locationAvailability != null) {
+                                    boolean flag = locationAvailability.isLocationAvailable();
+                                    LocationLog.i(TAG, "onLocationAvailability isLocationAvailable:" + flag);
+                                }
+                            }
+                        };
+                    }
+                    fusedLocationProviderClient
+                        .requestLocationUpdatesEx(locationRequest, mLocationIndoorCallback, Looper.getMainLooper())
+                        .addOnSuccessListener(new OnSuccessListener<Void>() {
+                            @Override
+                            public void onSuccess(Void aVoid) {
+                                LocationLog.i(TAG, "getLocationWithIndoor onSuccess");
+                            }
+                        })
+                        .addOnFailureListener(new OnFailureListener() {
+                            @Override
+                            public void onFailure(Exception e) {
+                                LocationLog.i(TAG, "getLocationWithIndoor onFailure:" + e.getMessage());
+                            }
+                        });
+                } catch (Exception e) {
+                    LocationLog.i(TAG, "getLocationWithIndoor exception :" + e.getMessage());
+                }
+            }
+        });
+    }
+
+    private void logResult(LocationResult locationRequest) {
+        if (locationRequest != null) {
+            Log.i(TAG, "getLocationWithHd callback  onLocationResult locationResult is not null");
+            logLocation(locationRequest.getLocations());
+            logHwLocation(locationRequest.getHWLocationList());
+        }
+    }
+
+    private void logResultIndoor(LocationResult locationResult) {
+        if (locationResult != null) {
+            Log.i(TAG, "getLocationWithHd callback  onLocationResult locationResult is not null");
+            logLocationIndoor(locationResult.getLocations());
+            logHwLocationIndoor(locationResult.getHWLocationList());
+        }
+    }
+
+    private void setLocationRequest(LocationRequest locationRequest) {
+        TableLayout tableLayout = findViewById(R.id.callback_table_layout_show);
+        ArrayList<String> paramList = new ArrayList<String>();
+        TableRow[] rows = new TableRow[tableLayout.getChildCount()];
+        for (int i = 0; i < rows.length; i++) {
+            if (tableLayout.getChildAt(i) instanceof TableRow) {
+                rows[i] = (TableRow) tableLayout.getChildAt(i);
+                if (rows[i].getChildAt(1) instanceof EditText) {
+                    EditText editText = (EditText) rows[i].getChildAt(1);
+                    paramList.add(editText.getText().toString());
+                }
+            }
+        }
+        if (!paramList.isEmpty()) {
+            locationRequest.setPriority(Integer.parseInt("".equals(paramList.get(0)) ? "200" : paramList.get(0)));
+            locationRequest.setInterval(Long.parseLong("".equals(paramList.get(1)) ? "5000" : paramList.get(1)));
+            locationRequest.setFastestInterval(Long.parseLong("".equals(paramList.get(2)) ? "5000" : paramList.get(2)));
+            locationRequest.setExpirationTime(
+                Long.parseLong("".equals(paramList.get(4)) ? "9223372036854775807" : paramList.get(4)));
+            locationRequest.setExpirationDuration(
+                Long.parseLong("".equals(paramList.get(5)) ? "9223372036854775807" : paramList.get(5)));
+            locationRequest
+                .setNumUpdates(Integer.parseInt("".equals(paramList.get(6)) ? "2147483647" : paramList.get(6)));
+            locationRequest
+                .setSmallestDisplacement(Float.parseFloat("".equals(paramList.get(7)) ? "0" : paramList.get(7)));
+            locationRequest.setMaxWaitTime(Long.parseLong("".equals(paramList.get(8)) ? "0" : paramList.get(8)));
+        }
+    }
+
+    private void logHwLocation(List<HWLocation> hwLocations) {
+        if (hwLocations == null || hwLocations.isEmpty()) {
+            Log.i(TAG, "getLocationWithHd callback hwLocations is empty");
+            return;
+        }
+        for (HWLocation hwLocation : hwLocations) {
+            if (hwLocation == null) {
+                Log.i(TAG, "getLocationWithHd callback hwLocation is empty");
+                return;
+            }
+            LocationLog.i(TAG,
+                "[new]location result : " + "\n" + "Longitude = " + hwLocation.getLongitude() + "\n" + "Latitude = "
+                    + hwLocation.getLatitude() + "\n" + "Accuracy = " + hwLocation.getAccuracy() + "\n"
+                    + hwLocation.getCountryName() + "," + hwLocation.getState() + "," + hwLocation.getCity() + ","
+                    + hwLocation.getCounty() + "," + hwLocation.getFeatureName());
+        }
+    }
+
+    private void logLocation(List<Location> locations) {
+        if (locations == null || locations.isEmpty()) {
+            Log.i(TAG, "getLocationWithHd callback locations is empty");
+            return;
+        }
+        for (Location location : locations) {
+            if (location == null) {
+                Log.i(TAG, "getLocationWithHd callback location is empty");
+                return;
+            }
+            LocationLog.i(TAG, "[old]location result : " + "\n" + "Longitude = " + location.getLongitude() + "\n"
+                + "Latitude = " + location.getLatitude() + "\n" + "Accuracy = " + location.getAccuracy());
+        }
+    }
+
+    private void logHwLocationIndoor(List<HWLocation> hwLocations) {
+        if (hwLocations == null || hwLocations.isEmpty()) {
+            Log.i(TAG, "getLocationWithHd callback hwLocations is empty");
+            return;
+        }
+        for (HWLocation hwLocation : hwLocations) {
+            if (hwLocation == null) {
+                Log.i(TAG, "getLocationWithHd callback hwLocation is empty");
+                return;
+            }
+            LocationLog.i(TAG,
+                "[new]location result : " + "Longitude = " + hwLocation.getLongitude() + System.lineSeparator()
+                    + "Latitude = " + hwLocation.getLatitude() + System.lineSeparator() + "Accuracy = "
+                    + hwLocation.getAccuracy());
+            Map<String, Object> maps = hwLocation.getExtraInfo();
+            parseIndoorLocation(maps);
+        }
+    }
+
+    private void logLocationIndoor(List<Location> locations) {
+        if (locations == null || locations.isEmpty()) {
+            Log.i(TAG, "getLocationWithHd callback locations is empty");
+            return;
+        }
+        for (Location location : locations) {
+            if (location == null) {
+                Log.i(TAG, "getLocationWithHd callback location is empty");
+                return;
+            }
+            LocationLog.i(TAG,
+                "[old]location result : " + System.lineSeparator() + "Longitude = " + location.getLongitude()
+                    + System.lineSeparator() + "Latitude = " + location.getLatitude() + System.lineSeparator()
+                    + "Accuracy = " + location.getAccuracy());
+            Bundle extraInfo = location.getExtras();
+            parseIndoorLocation(extraInfo);
+        }
+    }
+
+    // Parsing Indoor Location Result Information
+    public void parseIndoorLocation(Map<String, Object> maps) {
+        if (maps != null && !maps.isEmpty()) {
+            if (maps.containsKey("isHdNlpLocation")) {
+                Object object = maps.get("isHdNlpLocation");
+                if (object instanceof Boolean) {
+                    boolean isIndoorLocation = (boolean) object;
+                    if (isIndoorLocation) {
+                        // floor:Floor ID
+                        // (For example, 1 corresponds to F1. The mapping varies with buildings. For details, contact
+                        // the operation personnel.)
+                        int floor = (int) maps.get("floor");
+                        // floorAcc:Floor confidence (value range: 0-100)
+                        int floorAcc = (int) maps.get("floorAcc");
+                        LocationLog.i(TAG, "[new]location result : " + System.lineSeparator() + System.lineSeparator()
+                            + "floor = " + floor + System.lineSeparator() + "floorAcc = " + floorAcc);
+                    }
+                }
+            }
+        }
+    }
+
+    // Parsing Indoor Location Result Information
+    public void parseIndoorLocation(Bundle extraInfo) {
+        if (extraInfo == null) {
+            return;
+        }
+        if (extraInfo.getBoolean("isHdNlpLocation", false)) {
+            // Parsing Indoor Location Result Information
+            // floor:Floor ID
+            // (For example, 1 corresponds to F1. The mapping varies with buildings. For details, contact
+            // the operation personnel.)
+            int floor = extraInfo.getInt("floor", Integer.MIN_VALUE);
+            // floorAcc:Floor confidence (value range: 0-100)
+            int floorAcc = extraInfo.getInt("floorAcc", Integer.MIN_VALUE);
+            LocationLog.i(TAG, "[old]location result : " + System.lineSeparator() + System.lineSeparator() + "floor = "
+                + floor + System.lineSeparator() + "floorAcc = " + floorAcc);
+
+        }
+    }
+}

+ 228 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/RequestLocationUpdatesWithCallbackActivity.java

@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import java.util.List;
+
+import android.location.Location;
+import android.os.Bundle;
+import android.os.Looper;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.LocationAvailability;
+import com.huawei.hms.location.LocationCallback;
+import com.huawei.hms.location.LocationRequest;
+import com.huawei.hms.location.LocationResult;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.hms.location.LocationSettingsRequest;
+import com.huawei.hms.location.LocationSettingsResponse;
+import com.huawei.hms.location.SettingsClient;
+import com.huawei.locationsample6.LogInfoUtil;
+import com.huawei.locationsample6.R;
+import com.huawei.locationsample6.util.NotificationUtil;
+import com.huawei.logger.LocationLog;
+
+/**
+ * Example of Using requestLocationUpdates and removeLocationUpdates.
+ * Requests a location update and calls back on the specified Looper thread. This method requires that the requester
+ * process exist for continuous callback.
+ * If you still want to receive the callback after the process is killed, see requestLocationUpdates (LocationRequest
+ * request,PendingIntent callbackIntent)
+ *
+ * @since 2020-5-11
+ */
+public class RequestLocationUpdatesWithCallbackActivity extends LocationBaseActivity implements OnClickListener {
+    public static final String TAG = "LocationUpdatesCallback";
+
+    LocationCallback mLocationCallback;
+
+    LocationRequest mLocationRequest;
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    private SettingsClient mSettingsClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location_request_location_updates_callback);
+        // Button click listeners
+        findViewById(R.id.location_requestLocationUpdatesWithCallback).setOnClickListener(this);
+        findViewById(R.id.location_removeLocationUpdatesWithCallback).setOnClickListener(this);
+        findViewById(R.id.location_enableBackgroundLocation).setOnClickListener(this);
+        findViewById(R.id.location_disableBackgroundLocation).setOnClickListener(this);
+        addLogFragment();
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+        mSettingsClient = LocationServices.getSettingsClient(this);
+        mLocationRequest = new LocationRequest();
+        // Sets the interval for location update (unit: Millisecond)
+        mLocationRequest.setInterval(5000);
+        // Sets the priority
+        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
+        // Sets the type of the returned coordinate:
+        // COORDINATE_TYPE_WGS84 Indicates that the 84 coordinate is returned.
+        // COORDINATE_TYPE_GCJ02 Indicates that the 02 coordinate is returned. The default value is COORDENATE_TYPE_WGS84.
+        mLocationRequest.setCoordinateType(LocationRequest. COORDINATE_TYPE_WGS84);
+        if (null == mLocationCallback) {
+            mLocationCallback = new LocationCallback() {
+                @Override
+                public void onLocationResult(LocationResult locationResult) {
+                    if (locationResult != null) {
+                        List<Location> locations = locationResult.getLocations();
+                        if (!locations.isEmpty()) {
+                            for (Location location : locations) {
+                                LocationLog.i(TAG,
+                                    "onLocationResult location[Longitude,Latitude,Accuracy]:" + location.getLongitude()
+                                        + "," + location.getLatitude() + "," + location.getAccuracy());
+                            }
+                        }
+                    }
+                }
+
+                @Override
+                public void onLocationAvailability(LocationAvailability locationAvailability) {
+                    if (locationAvailability != null) {
+                        boolean flag = locationAvailability.isLocationAvailable();
+                        LocationLog.i(TAG, "onLocationAvailability isLocationAvailable:" + flag);
+                    }
+                }
+            };
+        }
+    }
+
+    /**
+     * Requests a location update and calls back on the specified Looper thread.
+     */
+    private void requestLocationUpdatesWithCallback() {
+        Log.i(TAG, "requestLocationUpdatesWithCallback");
+        LogInfoUtil.getLogInfo(this);
+        try {
+            LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
+            builder.addLocationRequest(mLocationRequest);
+            LocationSettingsRequest locationSettingsRequest = builder.build();
+            // Before requesting location update, invoke checkLocationSettings to check device settings.
+            Task<LocationSettingsResponse> locationSettingsResponseTask =
+                mSettingsClient.checkLocationSettings(locationSettingsRequest);
+            locationSettingsResponseTask.addOnSuccessListener(locationSettingsResponse -> {
+                Log.i(TAG, "check location settings success");
+                mFusedLocationProviderClient
+                    .requestLocationUpdates(mLocationRequest, mLocationCallback, Looper.getMainLooper())
+                    .addOnSuccessListener(aVoid -> {
+                        LocationLog.i(TAG, "requestLocationUpdatesWithCallback onSuccess");
+                    })
+                    .addOnFailureListener(e -> {
+                        LocationLog.e(TAG, "requestLocationUpdatesWithCallback onFailure:" + e.getMessage());
+                    });
+            }).addOnFailureListener(e -> LocationLog.e(TAG, "checkLocationSetting onFailure:" + e.getMessage()));
+        } catch (Exception e) {
+            LocationLog.e(TAG, "requestLocationUpdatesWithCallback exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        // Removed when the location update is no longer required.
+        removeLocationUpdatesWithCallback();
+        disableBackgroundLocation();
+        super.onDestroy();
+    }
+
+    /**
+     * Removed when the location update is no longer required.
+     */
+    private void removeLocationUpdatesWithCallback() {
+        try {
+            Task<Void> voidTask = mFusedLocationProviderClient.removeLocationUpdates(mLocationCallback);
+            voidTask.addOnSuccessListener(new OnSuccessListener<Void>() {
+                @Override
+                public void onSuccess(Void aVoid) {
+                    LocationLog.i(TAG, "removeLocationUpdatesWithCallback onSuccess");
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "removeLocationUpdatesWithCallback onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "removeLocationUpdatesWithCallback exception:" + e.getMessage());
+        }
+    }
+
+    private void enableBackgroundLocation() {
+        mFusedLocationProviderClient
+                .enableBackgroundLocation(NotificationUtil.NOTIFICATION_ID, NotificationUtil.getNotification(this))
+                .addOnSuccessListener(new OnSuccessListener<Void>() {
+                    @Override
+                    public void onSuccess(Void aVoid) {
+                        LocationLog.i(TAG, "enableBackgroundLocation onSuccess");
+                    }
+                })
+                .addOnFailureListener(new OnFailureListener() {
+                    @Override
+                    public void onFailure(Exception e) {
+                        LocationLog.e(TAG, "enableBackgroundLocation onFailure:" + e.getMessage());
+                    }
+                });
+    }
+
+    private void disableBackgroundLocation() {
+        mFusedLocationProviderClient.disableBackgroundLocation()
+                .addOnSuccessListener(new OnSuccessListener<Void>() {
+                    @Override
+                    public void onSuccess(Void aVoid) {
+                        LocationLog.i(TAG, "disableBackgroundLocation onSuccess");
+                    }
+                })
+                .addOnFailureListener(new OnFailureListener() {
+                    @Override
+                    public void onFailure(Exception e) {
+                        LocationLog.e(TAG, "disableBackgroundLocation onFailure:" + e.getMessage());
+                    }
+                });
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_requestLocationUpdatesWithCallback:
+                    requestLocationUpdatesWithCallback();
+                    break;
+                case R.id.location_removeLocationUpdatesWithCallback:
+                    removeLocationUpdatesWithCallback();
+                    break;
+                case R.id.location_enableBackgroundLocation:
+                    enableBackgroundLocation();
+                    break;
+                case R.id.location_disableBackgroundLocation:
+                    disableBackgroundLocation();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "RequestLocationUpdatesWithCallbackActivity Exception:" + e);
+        }
+    }
+}

+ 162 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/RequestLocationUpdatesWithIntentActivity.java

@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.annotation.SuppressLint;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.LocationRequest;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.hms.location.LocationSettingsRequest;
+import com.huawei.hms.location.LocationSettingsResponse;
+import com.huawei.hms.location.SettingsClient;
+import com.huawei.locationsample6.LogInfoUtil;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+/**
+ * Example of Using requestLocationUpdates and removeLocationUpdates
+ * Use the PendingIntent mode to continuously request the location update.
+ * The location update result LocationResult and LocationAvailability are encapsulated in the Intent, and the send() of
+ * the transferred PendingIntent is invoked to send the result to the requester.
+ * If the requester process is killed, use this method to continue to call back.
+ * If the requester does not want to receive the location update result when the process is killed, see
+ * requestLocationUpdates (LocationRequest request,LocationCallback callback,Looper looper).
+ *
+ * @since 2020-5-11
+ */
+public class RequestLocationUpdatesWithIntentActivity extends LocationBaseActivity implements OnClickListener {
+    public static final String TAG = "LocationUpdatesIntent";
+
+    LocationRequest mLocationRequest;
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    private SettingsClient mSettingsClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location_request_location_updates_intent);
+        // Button click listeners
+        findViewById(R.id.location_requestLocationUpdatesWithIntent).setOnClickListener(this);
+        findViewById(R.id.location_removeLocationUpdatesWithIntent).setOnClickListener(this);
+        addLogFragment();
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+        mSettingsClient = LocationServices.getSettingsClient(this);
+        mLocationRequest = new LocationRequest();
+        // Sets the interval for location update (unit: Millisecond)
+        mLocationRequest.setInterval(10000);
+        // Sets the priority
+        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
+    }
+
+    @Override
+    protected void onDestroy() {
+        // Removed when the location update is no longer required.
+        removeLocationUpdatesWithIntent();
+        super.onDestroy();
+    }
+
+    /**
+     * Request for location update
+     */
+    private void requestLocationUpdatesWithIntent() {
+        LogInfoUtil.getLogInfo(this);
+        try {
+            LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
+            builder.addLocationRequest(mLocationRequest);
+            LocationSettingsRequest locationSettingsRequest = builder.build();
+            // Before requesting location update, invoke checkLocationSettings to check device settings.
+            Task<LocationSettingsResponse> locationSettingsResponseTask =
+                mSettingsClient.checkLocationSettings(locationSettingsRequest);
+            locationSettingsResponseTask.addOnSuccessListener(locationSettingsResponse -> {
+                Log.i(TAG, "check location settings success");
+                mFusedLocationProviderClient.requestLocationUpdates(mLocationRequest, getPendingIntent())
+                    .addOnSuccessListener(aVoid -> LocationLog.i(TAG, "requestLocationUpdatesWithIntent onSuccess"))
+                    .addOnFailureListener(
+                        e -> LocationLog.e(TAG, "requestLocationUpdatesWithIntent onFailure:" + e.getMessage()));
+            }).addOnFailureListener(e -> LocationLog.e(TAG, "checkLocationSetting onFailure:" + e.getMessage()));
+        } catch (Exception e) {
+            LocationLog.e(TAG, "requestLocationUpdatesWithIntent exception:" + e.getMessage());
+        }
+    }
+
+    /**
+     * Remove Location Update
+     */
+    private void removeLocationUpdatesWithIntent() {
+        try {
+            Task<Void> voidTask = mFusedLocationProviderClient.removeLocationUpdates(getPendingIntent());
+            voidTask.addOnSuccessListener(new OnSuccessListener<Void>() {
+                @Override
+                public void onSuccess(Void aVoid) {
+                    LocationLog.i(TAG, "removeLocationUpdatesWithIntent onSuccess");
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "removeLocationUpdatesWithIntent onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "removeLocationUpdatesWithIntent exception:" + e.getMessage());
+        }
+    }
+
+    @SuppressLint("WrongConstant")
+    private PendingIntent getPendingIntent() {
+        Intent intent = new Intent(this, LocationBroadcastReceiver.class);
+        intent.setAction(LocationBroadcastReceiver.ACTION_PROCESS_LOCATION);
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
+            return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+        } else {
+            // For Android 12 or later devices, proactively configure the pendingIntent variability.
+            // The default value is PendingIntent.FLAG_MUTABLE. If compileSDKVersion is 30 or less, set this parameter
+            // to 1<<25.
+            return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | (1 << 25));
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_requestLocationUpdatesWithIntent:
+                    requestLocationUpdatesWithIntent();
+                    break;
+                case R.id.location_removeLocationUpdatesWithIntent:
+                    removeLocationUpdatesWithIntent();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "RequestLocationUpdatesWithIntentActivity Exception:" + e);
+        }
+    }
+}

+ 99 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/SetMockLocationActivity.java

@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.location.Location;
+import android.location.LocationManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+/**
+ * setMockLocation Usage Example
+ * Set the specific analog position. You must call setMockMode(boolean) before calling this method and set it to true.
+ * Enable the mobile phone to allow mock location.
+ *
+ * @since 2020-5-11
+ */
+public class SetMockLocationActivity extends LocationBaseActivity implements OnClickListener {
+    public static final String TAG = "SetMockLocationActivity";
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location_set_mock_location);
+        // Button click listeners
+        findViewById(R.id.location_setMockLocation).setOnClickListener(this);
+        addLogFragment();
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+    }
+
+    /**
+     * Set the specific mock location.
+     */
+    private void setMockLocation() {
+        try {
+            // Fill in the information sources such as gps and network based on the application situation.
+            final Location mockLocation = new Location(LocationManager.GPS_PROVIDER);
+            mockLocation.setLongitude(118.76);
+            mockLocation.setLatitude(31.98);
+            // Note: To enable the mock function, enable the android.permission.ACCESS_MOCK_LOCATION permission in the
+            // AndroidManifest.xml file,
+            // and set the application to the mock location app in the device setting.
+            Task<Void> voidTask = mFusedLocationProviderClient.setMockLocation(mockLocation);
+            voidTask.addOnSuccessListener(new OnSuccessListener<Void>() {
+                @Override
+                public void onSuccess(Void aVoid) {
+                    LocationLog.i(TAG, "setMockLocation onSuccess ");
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "setMockLocation onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "setMockLocation exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_setMockLocation:
+                    setMockLocation();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "setMockLocation Exception:" + e);
+        }
+    }
+}

+ 111 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/location/fusedlocation/SetMockModeActivity.java

@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.location.fusedlocation;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.OnSuccessListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.location.FusedLocationProviderClient;
+import com.huawei.hms.location.LocationServices;
+import com.huawei.locationsample6.R;
+import com.huawei.logger.LocationLog;
+
+/**
+ * setMockMode Usage Example
+ * Enable the mobile phone to allow mock location.
+ *
+ * @since 2020-5-11
+ */
+public class SetMockModeActivity extends LocationBaseActivity
+    implements OnClickListener, RadioGroup.OnCheckedChangeListener {
+    public static final String TAG = "SetMockModeActivity";
+
+    // the mockMode flag
+    private boolean mMockFlag;
+
+    private RadioGroup mRadioGroupSetMockMode;
+
+    private FusedLocationProviderClient mFusedLocationProviderClient;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location_set_mock_mode);
+        // Button click listeners
+        findViewById(R.id.location_setMockMode).setOnClickListener(this);
+        mRadioGroupSetMockMode = findViewById(R.id.radioGroup_mockMode);
+        mRadioGroupSetMockMode.setOnCheckedChangeListener(this);
+        addLogFragment();
+        mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
+    }
+
+    /**
+     * Setting the mock Mode
+     */
+    private void setMockMode() {
+        try {
+            Log.i(TAG, "setMockMode mock mode is " + mMockFlag);
+            // Note: To enable the mock function, enable the android.permission.ACCESS_MOCK_LOCATION permission in the
+            // AndroidManifest.xml file,
+            // and set the application to the mock location app in the device setting.
+            Task<Void> voidTask = mFusedLocationProviderClient.setMockMode(mMockFlag);
+            voidTask.addOnSuccessListener(new OnSuccessListener<Void>() {
+                @Override
+                public void onSuccess(Void aVoid) {
+                    LocationLog.i(TAG, "setMockMode onSuccess");
+                }
+            }).addOnFailureListener(new OnFailureListener() {
+                @Override
+                public void onFailure(Exception e) {
+                    LocationLog.e(TAG, "setMockMode onFailure:" + e.getMessage());
+                }
+            });
+        } catch (Exception e) {
+            LocationLog.e(TAG, "setMockMode exception:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            switch (v.getId()) {
+                case R.id.location_setMockMode:
+                    setMockMode();
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "setMockMode Exception:" + e);
+        }
+    }
+
+    @Override
+    public void onCheckedChanged(RadioGroup group, int checkedId) {
+        // If you do not need to simulate a location, set mode to false. Otherwise, other applications cannot use the
+        // positioning function of Huawei location service.
+        RadioButton radioButton = group.findViewById(checkedId);
+        mMockFlag = Boolean.valueOf(radioButton.getText().toString());
+    }
+}

+ 79 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/util/CoordinateConverterUtil.java

@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ */
+
+package com.huawei.locationsample6.util;
+
+import com.huawei.hms.location.LocationUtils;
+import com.huawei.hms.support.api.entity.location.coordinate.LonLat;
+
+/**
+ * CoordinateConverterUtil
+ *
+ * @since 2020-08-22
+ */
+public class CoordinateConverterUtil {
+    private static final int SIXTY = 60;
+
+    private static final int ONE_HUNDRED_EIGHTY = 180;
+
+    private static final double DISTANCE_ONE = 1.1515d;
+
+    private static final double DISTANCE_TWO = 1.60934d;
+
+    private static final int DISTANCE_THREE = 1000;
+
+    /**
+     * Coordinate conversion
+     *
+     * @param latitude latitude
+     * @param longitude longitude
+     * @param coordType Coordinate Type
+     * @return Concatenation of result strings after conversion
+     */
+    public static String change(double latitude, double longitude, int coordType) {
+        StringBuilder buffer = new StringBuilder(0);
+        long currentTimeMillisBefore = System.currentTimeMillis();
+
+        LonLat convertLatlon = LocationUtils.convertCoord(latitude, longitude, coordType);
+        long currentTimeMillisAfter = System.currentTimeMillis();
+        buffer.append("conversion time:")
+            .append(System.lineSeparator())
+            .append(currentTimeMillisAfter - currentTimeMillisBefore)
+            .append(" milliseconds");
+        buffer.append(System.lineSeparator());
+        if (convertLatlon == null) {
+            buffer.append("converted LatLon is null");
+        } else {
+            buffer.append("we convert the coordinates after 02[Longitude,Latitude]:")
+                .append(System.lineSeparator())
+                .append(convertLatlon.getLongitude())
+                .append(",")
+                .append(convertLatlon.getLatitude());
+            buffer.append(System.lineSeparator());
+            double distance = distance(latitude, longitude, convertLatlon.getLatitude(), convertLatlon.getLongitude());
+            buffer.append("difference between the converted 02 and the original gps:")
+                .append(System.lineSeparator())
+                .append(distance)
+                .append("m");
+        }
+        return buffer.toString();
+    }
+
+    static double distance(double lat1, double lon1, double lat2, double lon2) {
+        double theta = lon1 - lon2;
+        double dist = Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2))
+            + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.cos(deg2rad(theta));
+        dist = Math.acos(dist);
+        dist = rad2deg(dist);
+        return dist * SIXTY * DISTANCE_ONE * DISTANCE_TWO * DISTANCE_THREE;
+    }
+
+    static double deg2rad(double degree) {
+        return degree / ONE_HUNDRED_EIGHTY * Math.PI;
+    }
+
+    static double rad2deg(double radian) {
+        return radian * ONE_HUNDRED_EIGHTY / Math.PI;
+    }
+}

+ 57 - 0
locationkit-java-sample/app/src/main/java/com/huawei/locationsample6/util/NotificationUtil.java

@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.locationsample6.util;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.content.Context;
+import android.os.Build;
+
+import com.huawei.locationsample6.R;
+
+import static android.content.Context.NOTIFICATION_SERVICE;
+
+public class NotificationUtil {
+    public static final int NOTIFICATION_ID = 1;
+
+    public static Notification getNotification(Context context) {
+        Notification.Builder builder;
+        Notification notification;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            NotificationManager notificationManager =
+                (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
+            String channelId = context.getPackageName();
+            NotificationChannel notificationChannel =
+                new NotificationChannel(channelId, "LOCATION", NotificationManager.IMPORTANCE_LOW);
+            notificationManager.createNotificationChannel(notificationChannel);
+            builder = new Notification.Builder(context, channelId);
+        } else {
+            builder = new Notification.Builder(context);
+        }
+        builder.setSmallIcon(R.drawable.ic_launcher)
+            .setContentTitle("Location SDK")
+            .setContentText("Running in the background")
+            .setWhen(System.currentTimeMillis());
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+            notification = builder.build();
+        } else {
+            notification = builder.getNotification();
+        }
+        return notification;
+    }
+}

+ 89 - 0
locationkit-java-sample/app/src/main/java/com/huawei/logger/LocationLog.java

@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.logger;
+
+/**
+ * util
+ *
+ * @since 2020-5-11
+ */
+public class LocationLog {
+    public static final int DEBUG = android.util.Log.DEBUG;
+
+    public static final int INFO = android.util.Log.INFO;
+
+    public static final int WARN = android.util.Log.WARN;
+
+    public static final int ERROR = android.util.Log.ERROR;
+
+    private static LogNode mLogNode;
+
+    public static LogNode getLogNode() {
+        return mLogNode;
+    }
+
+    public static void setLogNode(LogNode node) {
+        mLogNode = node;
+    }
+
+    public static void d(String tag, String msg, Throwable tr) {
+        println(DEBUG, tag, msg, tr);
+    }
+
+    public static void d(String tag, String msg) {
+        d(tag, msg, null);
+    }
+
+    public static void i(String tag, String msg, Throwable tr) {
+        println(INFO, tag, msg, tr);
+    }
+
+    public static void i(String tag, String msg) {
+        i(tag, msg, null);
+    }
+
+    public static void w(String tag, String msg, Throwable tr) {
+        println(WARN, tag, msg, tr);
+    }
+
+    public static void w(String tag, String msg) {
+        w(tag, msg, null);
+    }
+
+    public static void w(String tag, Throwable tr) {
+        w(tag, null, tr);
+    }
+
+    public static void e(String tag, String msg, Throwable tr) {
+        println(ERROR, tag, msg, tr);
+    }
+
+    public static void e(String tag, String msg) {
+        e(tag, msg, null);
+    }
+
+    public static void println(int priority, String tag, String msg, Throwable tr) {
+        if (mLogNode != null) {
+            mLogNode.println(priority, tag, msg, tr);
+        }
+    }
+
+    public static void println(int priority, String tag, String msg) {
+        println(priority, tag, msg, null);
+    }
+
+}

+ 49 - 0
locationkit-java-sample/app/src/main/java/com/huawei/logger/LogCatWrapper.java

@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.logger;
+
+/**
+ * used to print next log info
+ *
+ * @since 2020-5-11
+ */
+public class LogCatWrapper implements LogNode {
+    private LogNode mNext;
+
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        String useMsg = msg;
+        if (useMsg == null) {
+            useMsg = "";
+        }
+        if (tr != null) {
+            useMsg += System.lineSeparator() + android.util.Log.getStackTraceString(tr);
+        }
+        android.util.Log.println(priority, tag, useMsg);
+        if (mNext != null) {
+            mNext.println(priority, tag, msg, tr);
+        }
+    }
+}

+ 118 - 0
locationkit-java-sample/app/src/main/java/com/huawei/logger/LogFragment.java

@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.logger;
+
+import android.annotation.SuppressLint;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.GestureDetector;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnTouchListener;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+import com.huawei.locationsample6.Constant;
+
+/**
+ * the fragment will be used to show log info, the useful info will print on screen.
+ *
+ * @since 2020-5-11
+ */
+
+public class LogFragment extends Fragment {
+    private LogView mLogView;
+
+    private ScrollView mScrollView;
+
+    public LogFragment() {
+    }
+
+    /**
+     * load view
+     *
+     * @return View
+     */
+    private View inflateViews() {
+        mScrollView = new ScrollView(getActivity());
+
+        mScrollView.setLayoutParams(
+            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
+        mLogView = new LogView(getActivity());
+        mLogView.setClickable(true);
+
+        mScrollView.addView(mLogView,
+            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+        if (Constant.IS_LOG == 0) {
+            mScrollView.setVisibility(View.GONE);
+        }
+        return mScrollView;
+    }
+
+    @SuppressWarnings("deprecation")
+    @SuppressLint("ClickableViewAccessibility")
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        View result = inflateViews();
+
+        mLogView.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                mScrollView.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+                    }
+                });
+            }
+
+        });
+
+        /**
+         * double click on the TextView,the application will clean the info window
+         */
+        final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
+            public boolean onDoubleTap(MotionEvent e) {
+                mLogView.setText("");
+                return true;
+            }
+        });
+        mLogView.setOnTouchListener(new OnTouchListener() {
+            public boolean onTouch(View v, MotionEvent event) {
+                return gestureDetector.onTouchEvent(event);
+            }
+        });
+        return result;
+    }
+
+    public LogView getLogView() {
+        return mLogView;
+    }
+
+}

+ 29 - 0
locationkit-java-sample/app/src/main/java/com/huawei/logger/LogNode.java

@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.logger;
+
+public interface LogNode {
+    /**
+     * Node
+     *
+     * @param priority priority
+     * @param tag tag
+     * @param msg msg
+     * @param tr tr
+     */
+    void println(int priority, String tag, String msg, Throwable tr);
+}

+ 103 - 0
locationkit-java-sample/app/src/main/java/com/huawei/logger/LogView.java

@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.logger;
+
+import android.app.Activity;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.TextView;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * LogView is used to show LocationLog info
+ *
+ * @since 2020-5-11
+ */
+public class LogView extends TextView implements LogNode {
+    private LogNode mNext;
+
+    public LogView(Context context) {
+        super(context);
+    }
+
+    public LogView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public LogView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        String priorityStr = null;
+        switch (priority) {
+            case LocationLog.DEBUG:
+                priorityStr = "D";
+                break;
+            case LocationLog.INFO:
+                priorityStr = "I";
+                break;
+            case LocationLog.WARN:
+                priorityStr = "W";
+                break;
+            case LocationLog.ERROR:
+                priorityStr = "E";
+                break;
+            default:
+                break;
+        }
+        String exceptionStr = null;
+        if (tr != null) {
+            exceptionStr = android.util.Log.getStackTraceString(tr);
+        }
+        final StringBuilder outputBuilder = new StringBuilder();
+        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
+        Date curDate = new Date(System.currentTimeMillis());
+        String str = formatter.format(curDate);
+        outputBuilder.append(str);
+        outputBuilder.append(" ");
+        outputBuilder.append(msg);
+        outputBuilder.append((char) 13).append((char) 10);
+        if (getContext() instanceof Activity) {
+            Activity activity = (Activity) getContext();
+            activity.runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    appendToLog(outputBuilder.toString());
+                }
+            });
+        }
+        if (mNext != null) {
+            mNext.println(priority, tag, msg, tr);
+        }
+    }
+
+    public void appendToLog(String s) {
+        append("\n" + s);
+    }
+}

+ 50 - 0
locationkit-java-sample/app/src/main/java/com/huawei/logger/LoggerActivity.java

@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.huawei.logger;
+
+import android.app.Activity;
+
+import com.huawei.locationsample6.R;
+
+/**
+ * the activity is used to attach LogFragment
+ *
+ * @since 2020-5-11
+ */
+public class LoggerActivity extends Activity {
+    @Override
+    protected void onStart() {
+        super.onStart();
+        initializeLogging();
+    }
+
+    /**
+     * initialize log info
+     */
+    private void initializeLogging() {
+        LogFragment logFragment = null;
+        if (getFragmentManager().findFragmentById(R.id.framelog) instanceof LogFragment) {
+            logFragment = (LogFragment) getFragmentManager().findFragmentById(R.id.framelog);
+        }
+
+        LogCatWrapper logcat = new LogCatWrapper();
+        if (logFragment != null) {
+            logcat.setNext(logFragment.getLogView());
+        }
+        LocationLog.setLogNode(logcat);
+    }
+}

二進制
locationkit-java-sample/app/src/main/res/drawable-hdpi/ic_launcher.png


二進制
locationkit-java-sample/app/src/main/res/drawable-mdpi/ic_launcher.png


+ 9 - 0
locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_blue_circle_side.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="5dp" />
+
+    <stroke
+        android:width="1dp"
+        android:color="@android:color/holo_blue_light" />
+    <solid android:color="@android:color/transparent" />
+</shape>

+ 6 - 0
locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_btn_selector.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@drawable/bg_white_circle" android:state_pressed="false" />
+    <item android:drawable="@drawable/bg_white_pressed_circle" android:state_pressed="true" />
+
+</selector>

+ 8 - 0
locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_white_circle.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners
+        android:radius="5dp"/>
+    <solid
+        android:color="@color/btn_white"/>
+
+</shape>

+ 8 - 0
locationkit-java-sample/app/src/main/res/drawable-xhdpi/bg_white_pressed_circle.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners
+        android:radius="5dp"/>
+    <solid
+        android:color="@color/btn_white_pressed"/>
+
+</shape>

二進制
locationkit-java-sample/app/src/main/res/drawable-xhdpi/huawei_logo.png


二進制
locationkit-java-sample/app/src/main/res/drawable-xhdpi/ic_launcher.png


二進制
locationkit-java-sample/app/src/main/res/drawable-xhdpi/ic_push_notification.png


二進制
locationkit-java-sample/app/src/main/res/drawable-xxhdpi/ic_launcher.png


+ 55 - 0
locationkit-java-sample/app/src/main/res/layout/activity_check_setting.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context="com.huawei.locationsample6.location.fusedlocation.CheckSettingActivity">
+
+    <Button
+        android:layout_margin="10dp"
+        android:id="@+id/checkLocationSetting"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:onClick="checkSettings"
+        android:text="checkLocationSetting"/>
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:orientation="vertical">
+
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#123456"/>
+
+            <TableLayout
+                android:id="@+id/check_setting_table_layout_show"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:stretchColumns="1"/>
+
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#123456"/>
+
+            <FrameLayout
+                android:id="@+id/framelog"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginTop="5dp"/>
+        </LinearLayout>
+    </ScrollView>
+
+</LinearLayout>

+ 101 - 0
locationkit-java-sample/app/src/main/res/layout/activity_coordinate_converter.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
+  -->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:paddingLeft="@dimen/activity_horizontal_margin"
+        android:paddingTop="@dimen/activity_vertical_margin"
+        android:paddingRight="@dimen/activity_horizontal_margin"
+        android:paddingBottom="@dimen/activity_vertical_margin">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="longitude"
+                android:textSize="14sp" />
+
+            <EditText
+                android:id="@+id/et_lon"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="2"
+                android:hint="longitude"
+                android:textSize="14sp" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="latitude"
+                android:textSize="14sp" />
+
+            <EditText
+                android:id="@+id/et_lat"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="2"
+                android:hint="latitude"
+                android:textSize="14sp" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="转换类型"
+                android:textSize="14sp" />
+
+            <EditText
+                android:id="@+id/et_transform_type"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="2"
+                android:text="1"
+                android:textSize="14sp" />
+
+        </LinearLayout>
+
+        <Button
+            android:id="@+id/do_transform"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="TRANSFORM" />
+
+        <TextView
+            android:id="@+id/tv_result_show"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+
+        <FrameLayout
+            android:id="@+id/framelog"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="5dp" />
+    </LinearLayout>
+
+</ScrollView>

+ 249 - 0
locationkit-java-sample/app/src/main/res/layout/activity_geo_fence.xml

@@ -0,0 +1,249 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingTop="10dp"
+        android:layout_gravity="center"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:text="AddGeoFence" />
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:paddingLeft="20dp"
+            android:paddingRight="20dp"
+            android:orientation="vertical">
+    <LinearLayout
+            android:paddingTop="10dp"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:layout_weight="4"
+            android:paddingTop="10dp"
+            android:text="RoundArea" />
+            <LinearLayout
+                android:paddingLeft="10dp"
+                android:layout_width="0dp"
+                android:layout_weight="11"
+                android:layout_height="wrap_content"
+                android:orientation="vertical">
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:gravity="center"
+                    android:layout_gravity="center"
+                    android:text="latitude([-90,90])" />
+                <EditText
+                    android:id="@+id/setlatitude"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:inputType="numberSigned|numberDecimal"/>
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:gravity="center"
+                    android:layout_weight="1"
+                    android:layout_gravity="center"
+                    android:text="longitude([-180,180])" />
+                <EditText
+                    android:id="@+id/setlongitude"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:inputType="numberSigned|numberDecimal"/>
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:gravity="center"
+                    android:layout_weight="1"
+                    android:layout_gravity="center"
+                    android:text="radius" />
+                <EditText
+                    android:id="@+id/setradius"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:text="60"
+                    android:inputType="numberDecimal"/>
+            </LinearLayout>
+        </LinearLayout>
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_weight="4"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="UniqueId"
+                     />
+                <LinearLayout
+                    android:paddingTop="10dp"
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="11"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+                    <EditText
+                        android:id="@+id/setUniqueId"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:inputType="text"/>
+                </LinearLayout>
+            </LinearLayout>
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:layout_weight="4"
+                    android:paddingTop="10dp"
+                    android:text="Conversions"
+                     />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="11"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/setConversions"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:text="5"
+                        android:inputType="number" />
+                </LinearLayout>
+            </LinearLayout>
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_weight="4"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="ValidContinueTime"
+                     />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="11"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+                    <EditText
+                        android:id="@+id/setValidContinueTime"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:text="1000000"
+                        android:inputType="number" />
+                </LinearLayout>
+            </LinearLayout>
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_weight="4"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="DwellDelayTime"
+                     />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="11"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/setDwellDelayTime"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:text="10000"
+                        android:inputType="number" />
+                </LinearLayout>
+            </LinearLayout>
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_weight="4"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="NotificationInterval"
+                    />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="11"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/setNotificationInterval"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:text="100"
+                        android:inputType="number" />
+                </LinearLayout>
+            </LinearLayout>
+            <Button
+                android:id="@+id/getCurrentLocation"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="get Current Location" />
+            <Button
+                android:id="@+id/geofence_btn"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="Create Geofence" />
+            <Button
+                android:id="@+id/showGeoList"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="show GeoList" />
+
+            <FrameLayout
+                android:id="@+id/framelog"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginTop="5dp"/>
+        </LinearLayout>
+    </ScrollView>
+
+
+
+</LinearLayout>

+ 87 - 0
locationkit-java-sample/app/src/main/res/layout/activity_hms_hd.xml

@@ -0,0 +1,87 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:focusable="true"
+    android:focusableInTouchMode="true"
+    android:orientation="vertical"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingBottom="@dimen/activity_vertical_margin">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:orientation="vertical">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="hd test" />
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#123456" />
+
+            <Button
+                android:id="@+id/btn_hd"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="HD_HW" />
+
+            <Button
+                android:id="@+id/btn_remove_hd"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="removeLocationHd" />
+
+            <Button
+                android:id="@+id/btn_indoorHd"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="IndoorHD_HW" />
+
+            <Button
+                android:id="@+id/btn_remove_indoorHd"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="removeLocationIndoorHd" />
+
+            <Button
+                android:id="@+id/btn_indoorHdAndHigh"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="IndoorHDAndHigh_HW" />
+
+            <Button
+                android:id="@+id/btn_remove_indoorHdAndHigh"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="removeLocationIndoorHdAndHigh" />
+
+            <TableLayout
+                android:id="@+id/callback_table_layout_show"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:stretchColumns="1"></TableLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#123456" />
+
+            <FrameLayout
+                android:id="@+id/framelog"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginTop="5dp" />
+        </LinearLayout>
+    </ScrollView>
+</LinearLayout>

+ 91 - 0
locationkit-java-sample/app/src/main/res/layout/activity_huaweilocation.xml

@@ -0,0 +1,91 @@
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:tools="http://schemas.android.com/tools"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+    <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:paddingLeft="@dimen/activity_title_margin"
+            android:paddingTop="@dimen/activity_title_margin"
+            android:paddingRight="@dimen/activity_title_margin"
+            tools:context=".HuaweiLocationActivity">
+
+        <TextView
+                style="@style/TitleStyle"
+                android:text="@string/sample_hwlocation_description" />
+
+        <Button
+                android:id="@+id/location_requestLocationUpdatesWithIntent"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_requestLocationUpdatesWithIntent" />
+
+
+        <Button
+                android:id="@+id/location_requestLocationUpdatesWithCallback"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_requestLocationUpdatesWithCallback" />
+
+        <Button
+                android:id="@+id/location_setMockMode"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_setMockMode" />
+
+        <Button
+                android:id="@+id/location_setMockLocation"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_setMockLocation" />
+
+        <Button
+                android:id="@+id/location_getLocationAvailability"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_getLocationAvailability" />
+
+        <Button
+                android:id="@+id/location_getLastLocation"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_getLastLocation" />
+
+        <Button
+                android:id="@+id/location_activity_update"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_activity" />
+
+        <Button
+                android:id="@+id/location_activity_transition_update"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_activity_transition" />
+
+        <Button
+                android:id="@+id/GeoFence"
+                style="@style/ButtonStyle"
+                android:text="GeoFence" />
+
+        <Button
+                android:id="@+id/locationHD"
+                style="@style/ButtonStyle"
+                android:text="LocationHD" />
+
+        <Button
+                android:id="@+id/getNavigationContextState"
+                style="@style/ButtonStyle"
+                android:text="GetNavigationContextState" />
+
+         <Button
+                android:id="@+id/check_setting"
+                style="@style/ButtonStyle"
+                android:text="CheckSetting" />
+
+        <Button
+            android:id="@+id/write_log"
+            style="@style/ButtonStyle"
+            android:text="WriteLog" />
+
+        <Button
+            android:id="@+id/coordinate_converter"
+            style="@style/ButtonStyle"
+            android:text="CoordinateConverter" />
+
+    </LinearLayout>
+</ScrollView>

+ 26 - 0
locationkit-java-sample/app/src/main/res/layout/activity_location_get_last_location.xml

@@ -0,0 +1,26 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingLeft="@dimen/activity_title_margin"
+    android:paddingTop="@dimen/activity_title_margin"
+    android:paddingRight="@dimen/activity_title_margin"
+    tools:context="com.huawei.locationsample6.location.fusedlocation.GetLastLocationActivity">
+
+    <TextView
+        style="@style/TitleStyle"
+        android:text="@string/hwlocation_getLastLocation" />
+
+
+    <Button
+        android:id="@+id/location_getLastLocation"
+        style="@style/ButtonStyle"
+        android:text="@string/hwlocation_getLastLocation" />
+
+    <FrameLayout
+        android:id="@+id/framelog"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="5dp"></FrameLayout>
+</LinearLayout>

+ 27 - 0
locationkit-java-sample/app/src/main/res/layout/activity_location_get_location_availability.xml

@@ -0,0 +1,27 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingLeft="@dimen/activity_title_margin"
+    android:paddingTop="@dimen/activity_title_margin"
+    android:paddingRight="@dimen/activity_title_margin"
+    tools:context=".location.fusedlocation.GetLocationAvailabilityActivity">
+
+    <TextView
+        style="@style/TitleStyle"
+        android:text="@string/hwlocation_getLocationAvailability" />
+
+
+    <Button
+        android:id="@+id/location_getLocationAvailability"
+        style="@style/ButtonStyle"
+        android:text="@string/hwlocation_getLocationAvailability" />
+
+
+    <FrameLayout
+        android:id="@+id/framelog"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="5dp"></FrameLayout>
+</LinearLayout>

+ 51 - 0
locationkit-java-sample/app/src/main/res/layout/activity_location_request_location_updates_callback.xml

@@ -0,0 +1,51 @@
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+  -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:focusable="true"
+              android:focusableInTouchMode="true"
+              android:orientation="vertical"
+              android:paddingLeft="@dimen/activity_title_margin"
+              android:paddingTop="@dimen/activity_title_margin"
+              android:paddingRight="@dimen/activity_title_margin"
+
+              tools:context=".location.fusedlocation.RequestLocationUpdatesWithCallbackActivity">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:orientation="vertical">
+
+            <TextView
+               style="@style/TitleStyle"
+                android:text="@string/hwlocation_locationupdates"/>
+
+            <Button
+                android:id="@+id/location_requestLocationUpdatesWithCallback"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_requestLocationUpdatesWithCallback"/>
+
+            <Button
+                android:id="@+id/location_removeLocationUpdatesWithCallback"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_removeLocationUpdatesWithCallback"/>
+
+            <include layout="@layout/item_background_location" />
+
+            <FrameLayout
+                android:id="@+id/framelog"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginTop="5dp"/>
+        </LinearLayout>
+    </ScrollView>
+</LinearLayout>

+ 50 - 0
locationkit-java-sample/app/src/main/res/layout/activity_location_request_location_updates_intent.xml

@@ -0,0 +1,50 @@
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:focusable="true"
+    android:focusableInTouchMode="true"
+    android:orientation="vertical"
+    android:paddingLeft="@dimen/activity_title_margin"
+    android:paddingTop="@dimen/activity_title_margin"
+    android:paddingRight="@dimen/activity_title_margin"
+    tools:context=".location.fusedlocation.RequestLocationUpdatesWithIntentActivity">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:orientation="vertical">
+
+            <TextView
+                style="@style/TitleStyle"
+                android:text="@string/hwlocation_locationupdates" />
+
+            <Button
+                android:id="@+id/location_requestLocationUpdatesWithIntent"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_requestLocationUpdatesWithIntent" />
+
+            <Button
+                android:id="@+id/location_removeLocationUpdatesWithIntent"
+                style="@style/ButtonStyle"
+                android:text="@string/hwlocation_removeLocationUpdatesWithIntent" />
+
+
+            <FrameLayout
+                android:id="@+id/framelog"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginTop="5dp"></FrameLayout>
+        </LinearLayout>
+    </ScrollView>
+</LinearLayout>

+ 41 - 0
locationkit-java-sample/app/src/main/res/layout/activity_location_set_mock_location.xml

@@ -0,0 +1,41 @@
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+  -->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingLeft="@dimen/activity_title_margin"
+    android:paddingRight="@dimen/activity_title_margin"
+    android:paddingTop="@dimen/activity_title_margin"
+    android:focusable="true"
+    android:focusableInTouchMode="true"
+    tools:context=".location.fusedlocation.SetMockLocationActivity">
+
+    <TextView
+        style="@style/TitleStyle"
+        android:text="@string/hwlocation_setMockLocation"/>
+
+    <TextView
+        android:text="@string/hwlocation_mockWarning"
+        style="@style/WarningStyle"
+        />
+    <Button
+        android:id="@+id/location_setMockLocation"
+        style="@style/ButtonStyle"
+        android:text="@string/hwlocation_setMockLocation" />
+
+
+    <FrameLayout
+        android:id="@+id/framelog"
+        android:layout_marginTop="5dp"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        ></FrameLayout>
+</LinearLayout>
+</ScrollView>

+ 62 - 0
locationkit-java-sample/app/src/main/res/layout/activity_location_set_mock_mode.xml

@@ -0,0 +1,62 @@
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+  -->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:paddingLeft="@dimen/activity_title_margin"
+        android:paddingTop="@dimen/activity_title_margin"
+        android:paddingRight="@dimen/activity_title_margin"
+        tools:context=".location.fusedlocation.SetMockModeActivity">
+
+        <TextView
+            android:text="@string/hwlocation_setMockMode"
+            style="@style/TitleStyle"
+            />
+
+        <TextView
+            android:text="@string/hwlocation_mockWarning"
+            style="@style/WarningStyle"
+            />
+        <Button
+            android:id="@+id/location_setMockMode"
+            style="@style/ButtonStyle"
+            android:text="@string/hwlocation_setMockMode" />
+
+        <RadioGroup
+            android:id="@+id/radioGroup_mockMode"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:orientation="horizontal">
+
+            <RadioButton
+                android:id="@+id/radioGroup_mockMode_true"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="false"
+                android:text="true" />
+
+            <RadioButton
+                android:id="@+id/radioGroup_mockMode_false"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="10dp"
+                android:checked="true"
+                android:text="false" />
+        </RadioGroup>
+
+
+        <FrameLayout
+            android:id="@+id/framelog"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginTop="5dp"></FrameLayout>
+    </LinearLayout>
+</ScrollView>

+ 46 - 0
locationkit-java-sample/app/src/main/res/layout/activity_navigation_context_state.xml

@@ -0,0 +1,46 @@
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:tools="http://schemas.android.com/tools"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:paddingLeft="@dimen/activity_horizontal_margin"
+        android:paddingTop="@dimen/activity_vertical_margin"
+        android:paddingRight="@dimen/activity_horizontal_margin"
+        android:paddingBottom="@dimen/activity_vertical_margin"
+        tools:context=".NavigationContextStateActivity">
+
+    <TextView
+            style="@style/TitleStyle"
+            android:text="@string/hwlocation_getNavigationContextState" />
+
+    <Button
+            android:id="@+id/getNavigationContextState"
+            style="@style/ButtonStyle"
+            android:text="@string/hwlocation_getNavigationContextState" />
+
+    <EditText
+            android:id="@+id/typeText"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:hint="INPUT TYPE: 1 OVERPASS , 2 IS_SUPPORT_EX"
+            android:inputType="number"
+            android:textColorHint="#FF999999"
+            android:textSize="17sp" />
+
+    <TableLayout
+            android:id="@+id/getLastLocationEnhanceParam"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:stretchColumns="1" />
+
+    <FrameLayout
+            android:id="@+id/framelog"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginTop="5dp" />
+</LinearLayout>

+ 212 - 0
locationkit-java-sample/app/src/main/res/layout/activity_operate_geo_fence.xml

@@ -0,0 +1,212 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingTop="10dp"
+        android:layout_gravity="center"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:text="GeoFence" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:paddingLeft="20dp"
+            android:paddingRight="20dp"
+            android:orientation="vertical">
+
+            <ScrollView
+                android:layout_width="match_parent"
+                android:layout_height="100dp">
+                <TextView
+                    android:id="@+id/GeoFenceData"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_gravity="top"
+                    android:layout_weight="4"
+                    android:scrollbars="vertical"
+                    android:hint="see the Geofence which wait to add"
+                    android:paddingTop="10dp" />
+            </ScrollView>
+            <Button
+                android:id="@+id/CreateGeofence"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="Add Geofence" />
+            <Button
+                android:id="@+id/removeGeofence"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="remove all Geofence" />
+            <Button
+                android:id="@+id/getGeoFenceData"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="get GeoFence Data" />
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="Trigger" />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="3"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/trigger"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:inputType="number"
+                        android:hint="input trigger"/>
+                </LinearLayout>
+            </LinearLayout>
+            <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="120dp">
+                    <TextView
+                        android:hint="see the Geofence which already send the request"
+                        android:id="@+id/GeoRequestData"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="top"
+                        android:layout_weight="4"
+                        android:paddingTop="10dp" />
+            </ScrollView>
+            <ScrollView
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical">
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/sendRequest"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:text="Send Request with pendingIntent" />
+                <Button
+                    android:id="@+id/sendRequestWithNew"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:text="Send with new pendingIntent" />
+
+            </LinearLayout>
+
+            <Button
+                android:id="@+id/GetRequestMessage"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="Get Request Message" />
+
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_weight="1"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="removeWithPendingIntent"
+                    />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="3"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/removeWithPendingIntentInput"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:inputType="number"
+                        android:hint="input pengdingIntent"/>
+                </LinearLayout>
+            </LinearLayout>
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_weight="1"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:paddingTop="10dp"
+                    android:text="removeWithID"
+                    />
+                <LinearLayout
+                    android:paddingLeft="10dp"
+                    android:layout_width="0dp"
+                    android:layout_weight="3"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/removeWithIDInput"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:hint="Input fence ID"
+                        android:inputType="text" />
+                </LinearLayout>
+            </LinearLayout>
+            <LinearLayout
+                android:paddingTop="10dp"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/removeWithIntent"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:text="Remove With Intent" />
+                <Button
+                    android:id="@+id/removeWithID"
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:text="Remove With ID" />
+
+            </LinearLayout>
+                <FrameLayout
+                    android:id="@+id/framelog"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_marginTop="5dp"/>
+            </LinearLayout>
+            </ScrollView>
+            </LinearLayout>
+
+
+        </LinearLayout>

+ 70 - 0
locationkit-java-sample/app/src/main/res/layout/activity_request_activity_transition.xml

@@ -0,0 +1,70 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    android:focusable="true"
+    android:focusableInTouchMode="true" >
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/hwlocation_activity_sample_request_activity_transition"/>
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="#123456"/>
+
+    <!--   	<Button
+            android:id="@+id/location_getLastLocation"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/location_getLastLocation" />-->
+
+    <Button
+        android:id="@+id/request_activity_transition_updates_btn"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="requestActivityTransitionUpdates" />
+
+    <Button
+        android:id="@+id/remove_activity_transition_updates_btn"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="removeActivityTransitionUpdates" />
+
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="#123456" />
+
+    <EditText
+        android:id="@+id/transition_json_content"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:background="@android:drawable/edit_text"
+        android:enabled="true"
+        android:gravity="top"
+        android:inputType="textMultiLine"
+        android:minLines="8"
+        android:scrollbars="vertical"></EditText>
+
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="#123456" />
+
+    <FrameLayout
+        android:id="@+id/framelog"
+        android:layout_marginTop="5dp"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        ></FrameLayout>
+</LinearLayout>

+ 65 - 0
locationkit-java-sample/app/src/main/res/layout/activity_request_activity_updates.xml

@@ -0,0 +1,65 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    android:focusable="true"
+    android:focusableInTouchMode="true" >
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <Button
+            android:id="@+id/request_activity_updates_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentLeft="true"
+            android:layout_alignParentStart="true"
+            android:layout_marginTop="@dimen/narrow_space"
+            android:onClick="requestActivityUpdatesButtonHandler"
+            android:text="@string/hwlocation_activity_request_activity_updates" />
+
+        <Button
+            android:id="@+id/remove_activity_updates_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentEnd="true"
+            android:layout_alignParentRight="true"
+            android:layout_toRightOf="@id/request_activity_updates_button"
+            android:layout_toEndOf="@id/request_activity_updates_button"
+            android:layout_marginTop="@dimen/narrow_space"
+            android:onClick="removeActivityUpdatesButtonHandler"
+            android:text="@string/hwlocation_activity_remove_activity_updates" />
+    </RelativeLayout>
+
+    <EditText
+        android:id="@+id/detectionIntervalMillis"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:background="@android:drawable/edit_text"
+        android:enabled="true"
+        android:gravity="top"
+        android:maxLines="1"
+        android:hint="pls input callback time(millisecond) if data is empty it will be set as 300000"
+        android:scrollbars="vertical"></EditText>
+
+    <TextView
+        android:id="@+id/detected_activities_title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="@dimen/narrow_space"
+        android:layout_marginTop="@dimen/wide_space"
+        android:text="@string/hwlocation_activity_detected_activities_title"
+        android:textSize="@dimen/headline_text_size" />
+
+    <ListView
+        android:id="@+id/detected_activities_listview"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+</LinearLayout>

+ 388 - 0
locationkit-java-sample/app/src/main/res/layout/activity_transition.xml

@@ -0,0 +1,388 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:padding="@dimen/margin_l"
+    android:orientation="vertical">
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="@dimen/margin_m"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:text="Select the status of listening" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:weightSum="3"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingLeft="10dp"
+            android:paddingTop="5dp"
+            android:textSize="16sp"
+            android:textColor="@android:color/black"
+            android:text="ActivityType"
+            />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="2"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:textSize="16sp"
+            android:textColor="@android:color/black"
+            android:text="TransitionType" />
+
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/margin_m"
+        android:orientation="horizontal">
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="4"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center"
+            android:textColor="@android:color/black" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="4"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center"
+            android:textColor="@android:color/black"
+            android:text="IN(0)" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="4"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center"
+            android:textColor="@android:color/black"
+            android:text="OUT(1)" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center"
+            android:textColor="@android:color/black" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="2"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="VEHICLE[100]" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/IN_VEHICLE_IN"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/IN_VEHICLE_OUT"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="2"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="BIKE[101]" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/ON_BICYCLE_IN"
+            android:checked="false" />
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:layout_weight="1"
+            android:gravity="center" />
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/ON_BICYCLE_OUT"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="2"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="FOOT[102]" />
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/ON_FOOT_IN"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/ON_FOOT_OUT"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:layout_weight="2"
+            android:gravity="center"
+            android:text="STILL[103]" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/STILL_IN"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/STILL_OUT"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:layout_weight="2"
+            android:gravity="center"
+            android:text="WALKING[107]" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/WALKING_IN"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+        <CheckBox
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:paddingTop="5dp"
+            android:id="@+id/WALKING_OUT"
+            android:checked="false" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="2"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="RUNNING[108]" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+        <CheckBox
+            android:id="@+id/RUNNING_IN"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:checked="false"
+            android:paddingTop="5dp" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+        <CheckBox
+            android:id="@+id/RUNNING_OUT"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:checked="false"
+            android:paddingTop="5dp" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+    </LinearLayout>
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/margin_l"
+        android:weightSum="2"
+        android:orientation="vertical">
+        <Button
+            android:id="@+id/btnSubmit"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="requestActivityTransition" />
+        <Button
+            android:id="@+id/btnMove"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="removeActivityTransition" />
+    </LinearLayout>
+    <ScrollView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content">
+        <FrameLayout
+            android:id="@+id/framelog"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="5dp"/>
+
+    </ScrollView>
+</LinearLayout>

+ 242 - 0
locationkit-java-sample/app/src/main/res/layout/activity_transition_type.xml

@@ -0,0 +1,242 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:paddingLeft="10dp"
+        android:paddingTop="20dp">
+
+        <Button
+            android:id="@+id/requestActivityTransitionUpdate"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="requestActivityIdentificationUpdate" />
+
+        <Button
+            android:id="@+id/removeActivityTransitionUpdate"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="removeActivityIdentificationUpdate" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="VEHICLE[100]" />
+
+        <LinearLayout
+            android:id="@+id/activity_in_vehicle"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="#CD2626"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="BIKE[101]" />
+
+        <LinearLayout
+            android:id="@+id/activity_on_bicycle"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="#0000FF"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="FOOT[102]" />
+
+        <LinearLayout
+            android:id="@+id/activity_on_foot"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="@color/colorAccent"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="STILL[103]" />
+
+        <LinearLayout
+            android:id="@+id/activity_still"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="#7CFC00"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="OTHERS[104]" />
+
+        <LinearLayout
+            android:id="@+id/activity_unknown"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="@color/colorPrimaryDark"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="WALKING[107]" />
+
+        <LinearLayout
+            android:id="@+id/activity_walking"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="#EE00EE"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="20dp">
+
+        <TextView
+            android:layout_width="100dp"
+            android:layout_height="wrap_content"
+            android:paddingTop="10dp"
+            android:text="RUNNING[108]" />
+
+        <LinearLayout
+            android:id="@+id/activity_running"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ProgressBar
+                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginRight="20dp"
+                android:background="@color/blue_text_007dff"></ProgressBar>
+        </LinearLayout>
+    </LinearLayout>
+
+    <ScrollView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content">
+
+        <FrameLayout
+            android:id="@+id/framelog"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginTop="5dp" />
+
+    </ScrollView>
+</LinearLayout>

+ 134 - 0
locationkit-java-sample/app/src/main/res/layout/activity_wirte_log.xml

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:padding="@dimen/margin_l">
+
+    <Button
+        android:id="@+id/set_log_config"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:onClick="writeLog"
+        android:layout_margin="10dp"
+        android:text="setLogConfig" />
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:orientation="vertical">
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#123456" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="filePath"
+                    android:textSize="14sp" />
+
+                <EditText
+                    android:id="@+id/et_file_path"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="3"
+                    android:hint="required"
+                    android:textSize="14sp" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="fileNum"
+                    android:textSize="14sp" />
+
+                <EditText
+                    android:id="@+id/et_file_count"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="3"
+                    android:inputType="number"
+                    android:textSize="14sp" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="fileSize (M)"
+                    android:textSize="14sp" />
+
+                <EditText
+                    android:id="@+id/et_file_size"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="3"
+                    android:inputType="number"
+                    android:textSize="14sp" />
+
+            </LinearLayout>
+
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:text="fileExpiredTime"
+                    android:textSize="14sp" />
+
+                <EditText
+                    android:id="@+id/et_file_expire"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="3"
+                    android:inputType="number"
+                    android:hint="5 days by default"
+                    android:textSize="14sp" />
+
+            </LinearLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#123456" />
+
+            <FrameLayout
+                android:id="@+id/framelog"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="5dp" />
+        </LinearLayout>
+    </ScrollView>
+</LinearLayout>

+ 49 - 0
locationkit-java-sample/app/src/main/res/layout/detected_activity_layout.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2014 Google, Inc.
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <TextView
+            android:id="@+id/detected_activity_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/narrow_space"
+            android:text="@string/hwlocation_activity_still" />
+
+        <TextView
+            android:id="@+id/detected_activity_confidence_level"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_alignParentEnd="true"
+            android:layout_marginTop="@dimen/narrow_space" />
+    </RelativeLayout>
+
+    <ProgressBar
+        android:id="@+id/detected_activity_progress_bar"
+        style="@android:style/Widget.ProgressBar.Horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/progress_bar_top_margin"
+        android:minHeight="@dimen/progress_bar_min_height"
+        android:progress="1" />
+</LinearLayout>

+ 25 - 0
locationkit-java-sample/app/src/main/res/layout/item_background_location.xml

@@ -0,0 +1,25 @@
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal">
+
+    <Button
+        android:id="@+id/location_enableBackgroundLocation"
+        style="@style/ButtonStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="enableBackgroundLocation" />
+
+    <Button
+        android:id="@+id/location_disableBackgroundLocation"
+        style="@style/ButtonStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="disableBackgroundLocation" />
+</LinearLayout>

+ 18 - 0
locationkit-java-sample/app/src/main/res/layout/pending_intent_activity_layout.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/text_pending"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center"
+        android:text="hello"
+        android:textSize="20dp"/>
+
+</LinearLayout>

二進制
locationkit-java-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png


二進制
locationkit-java-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png


二進制
locationkit-java-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png


二進制
locationkit-java-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png


二進制
locationkit-java-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


+ 17 - 0
locationkit-java-sample/app/src/main/res/values/colors.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#3F51B5</color>
+    <color name="colorPrimaryDark">#303F9F</color>
+    <color name="colorAccent">#FF4081</color>
+    <color name="text_white">#fff</color>
+    <color name="text_black">#000</color>
+    <color name="warning_red">#F00505</color>
+    <color name="btn_white">#E3E4E5</color>
+    <color name="btn_white_pressed">#CACBCD</color>
+    <color name="blue_grey_500">#607D8B</color>
+    <color name="blue_grey_600">#546E7A</color>
+    <color name="blue_grey_700">#455A64</color>
+    <color name="blue_grey_800">#37474F</color>
+    <color name="blue_grey_900">#263238</color>
+    <color name="blue_text_007dff">#007dff</color>
+</resources>

+ 15 - 0
locationkit-java-sample/app/src/main/res/values/dimens.xml

@@ -0,0 +1,15 @@
+<resources>
+
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_title_margin">10dp</dimen>
+    <dimen name="logo_top_margin">50dp</dimen>
+    <dimen name="narrow_space">8dp</dimen>
+    <dimen name="progress_bar_min_height">6dp</dimen>
+    <dimen name="progress_bar_top_margin">4dp</dimen>
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+    <dimen name="margin_l">16dp</dimen>
+    <dimen name="margin_m">8dp</dimen>
+    <dimen name="wide_space">24dp</dimen>
+    <dimen name="headline_text_size">24sp</dimen>
+</resources>

+ 40 - 0
locationkit-java-sample/app/src/main/res/values/strings.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">LocationDemo</string>
+    <string name="sample_hwlocation_description">Huawei Location Demo</string>
+
+    <string name="hwlocation_getLastLocation">getLastLocation</string>
+    <string name="hwlocation_getLocationAvailability">getLocationAvailability</string>
+    <string name="hwlocation_locationupdates">location updates</string>
+    <string name="hwlocation_requestLocationUpdatesWithCallback">requestLocationUpdates with callback</string>
+    <string name="hwlocation_removeLocationUpdatesWithCallback">removeLocationUpdates with callback</string>
+    <string name="hwlocation_requestLocationUpdatesWithIntent">requestLocationUpdates with intent</string>
+    <string name="hwlocation_removeLocationUpdatesWithIntent">removeLocationUpdates with intent</string>
+    <string name="hwlocation_setMockLocation">setMockLocation</string>
+    <string name="hwlocation_setMockMode">setMockMode</string>
+    <string name="hwlocation_mockWarning">Enable the mobile phone to allow mock location \nand  set mockmode true</string>
+    <string name="hwlocation_activity">ActivityRecognition Update</string>
+    <string name="hwlocation_activity_transition">ActivityTransition Update</string>
+    <string name="hwlocation_getNavigationContextState">GetNavigationContextState</string>
+
+    <!-- Activity detection strings -->
+    <string name="hwlocation_activity_in_vehicle">In a vehicle</string>
+    <string name="hwlocation_activity_on_bicycle">On a bicycle</string>
+    <string name="hwlocation_activity_on_foot">On foot</string>
+    <string name="hwlocation_activity_running">Running</string>
+    <string name="hwlocation_activity_still">Still</string>
+    <string name="hwlocation_activity_tilting">Tilting</string>
+    <string name="hwlocation_activity_unknown">Unknown activity</string>
+    <string name="hwlocation_activity_walking">Walking</string>
+    <string name="hwlocation_activity_unidentifiable_activity">Unidentifiable activity: %1$d</string>
+    <string name="hwlocation_activity_detected_activities_title">Detected Activities</string>
+    <string name="hwlocation_activity_request_activity_updates">Request updates</string>
+    <string name="hwlocation_activity_remove_activity_updates">Remove updates</string>
+    <string name="hwlocation_activity_activity_updates_enabled">Activity updates enabled</string>
+    <string name="hwlocation_activity_activity_updates_not_enabled">Failed to enable activity updates</string>
+    <string name="hwlocation_activity_activity_updates_removed">Activity updates removed</string>
+    <string name="hwlocation_activity_activity_updates_not_removed">Failed to remove activity updates</string>
+    <string name="hwlocation_activity_percent">%1$d%%</string>
+    <string name="hwlocation_activity_sample_request_activity_transition">RequestActivityTransition Demo</string>
+</resources>

+ 60 - 0
locationkit-java-sample/app/src/main/res/values/styles.xml

@@ -0,0 +1,60 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light.NoTitleBar">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+    <style name="buoy_loading_activity_style" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor">
+        <item name="android:windowMinWidthMajor">100%</item>
+        <item name="android:windowMinWidthMinor">100%</item>
+    </style>
+    <!--Button style -->
+    <style name="ButtonStyle" parent="@android:style/Widget.Button">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:background">@drawable/bg_btn_selector</item>
+        <item name="android:textColor">@color/text_black</item>
+        <item name="android:padding">10dp</item>
+        <item name="android:layout_margin">5dp</item>
+        <item name="android:textSize">14sp</item>
+    </style>
+
+    <!--Title style -->
+    <style name="TitleStyle" parent="@android:style/Widget.TextView">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:gravity">center</item>
+        <item name="android:layout_marginBottom">10dp</item>
+        <item name="android:textSize">16sp</item>
+    </style>
+    <!--EditTextStyle -->
+    <style name="EditTextStyle" parent="@android:style/Widget.EditText">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_marginBottom">10dp</item>
+        <item name="android:textSize">14sp</item>
+    </style>
+    <!--WarningStyle -->
+    <style name="WarningStyle" parent="@android:style/Widget.TextView">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:gravity">center</item>
+        <item name="android:layout_marginBottom">10dp</item>
+        <item name="android:textSize">12sp</item>
+        <item name="android:textColor">@color/warning_red</item>
+    </style>
+
+</resources>

+ 27 - 0
locationkit-java-sample/build.gradle

@@ -0,0 +1,27 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    repositories {
+        maven { url 'https://developer.huawei.com/repo/' }
+	google()
+        jcenter()
+        mavenCentral()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:3.5.4'
+        classpath 'com.huawei.agconnect:agcp:1.6.0.300'
+    }
+}
+
+allprojects {
+    repositories {
+        maven { url 'https://developer.huawei.com/repo/' }
+	google()
+        jcenter()
+        mavenCentral()
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}

+ 19 - 0
locationkit-java-sample/gradle.properties

@@ -0,0 +1,19 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+android.enableJetifier=true
+android.useAndroidX=true
+org.gradle.jvmargs=-Xmx1536m
+android.jetifier.blacklist=bcprov-jdk15on
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true

二進制
locationkit-java-sample/gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
locationkit-java-sample/gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
+#Fri Sep 20 10:48:06 CST 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

+ 160 - 0
locationkit-java-sample/gradlew

@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90 - 0
locationkit-java-sample/gradlew.bat

@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

二進制
locationkit-java-sample/images/home.png


二進制
locationkit-java-sample/images/locationgetlast.png


二進制
locationkit-java-sample/images/locationhd.png


+ 1 - 0
locationkit-java-sample/settings.gradle

@@ -0,0 +1 @@
+include ':app'

Some files were not shown because too many files changed in this diff