Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c62ca07a
authored
Jun 07, 2024
by
han xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3.2.4
parent
5298ab57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
build.gradle
locationComponent/src/main/java/com/dayu/location/base/LocationUtils.java
build.gradle
View file @
c62ca07a
...
...
@@ -5,8 +5,8 @@ buildscript {
ext
.
build_tools_version
=
"29.0.2"
ext
.
min_sdk_version
=
21
ext
.
target_sdk_version
=
30
ext
.
version_code
=
32
3
ext
.
verson_name
=
"3.2.
3
"
ext
.
version_code
=
32
4
ext
.
verson_name
=
"3.2.
4
"
ext
.
gradle_version
=
'4.0.1'
ext
.
isReleaseMinify
=
false
ext
.
isDebugMinify
=
false
...
...
locationComponent/src/main/java/com/dayu/location/base/LocationUtils.java
View file @
c62ca07a
...
...
@@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
import
android.content.ActivityNotFoundException
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
android.location.Address
;
import
android.location.Criteria
;
import
android.location.Geocoder
;
...
...
@@ -153,12 +155,36 @@ public class LocationUtils {
// }
//
//
private
static
boolean
isInstallPackage
()
{
return
new
File
(
"/data/data/"
+
"com.autonavi.minimap"
).
exists
();
// private static boolean isInstallPackage() {
// return new File("/data/data/" + "com.autonavi.minimap").exists();
// }
private
static
boolean
isInstallPackage
(
Context
mContext
)
{
PackageManager
packageManager
=
mContext
.
getPackageManager
();
List
<
PackageInfo
>
installedPackages
=
packageManager
.
getInstalledPackages
(
0
);
boolean
isAMapInstalled
=
false
;
for
(
PackageInfo
packageInfo
:
installedPackages
)
{
String
packageName
=
packageInfo
.
packageName
;
if
(
packageName
.
equals
(
"com.autonavi.minimap"
))
{
isAMapInstalled
=
true
;
break
;
}
}
return
isAMapInstalled
;
// try {
// // 检查设备是否已安装高德地图应用
// packageManager.getPackageInfo("com.autonavi.minimap", 0);
// return true;
// } catch (PackageManager.NameNotFoundException e) {
// e.printStackTrace();
// return false;
// }
}
public
static
void
openMap
(
Context
mContext
,
String
address
,
OpenMarketListener
listener
)
{
if
(
isInstallPackage
())
{
if
(
isInstallPackage
(
mContext
))
{
Intent
intent
=
new
Intent
(
"android.intent.action.VIEW"
,
android
.
net
.
Uri
.
parse
(
"androidamap://poi?sourceApplication=softname&keywords="
+
address
));
intent
.
setPackage
(
"com.autonavi.minimap"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment