Skip to content

Commit e9e82fb

Browse files
committed
submit MapKit sample code
1 parent f126ca6 commit e9e82fb

File tree

88 files changed

+6997
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+6997
-0
lines changed

map-sample/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild

map-sample/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"agcgw": {
3+
"backurl": "connect-drcn.dbankcloud.cn",
4+
"url": "connect-drcn.hispace.hicloud.com"
5+
},
6+
"client": {
7+
"cp_id": "890086000000003273",
8+
"product_id": "98264260194363948",
9+
"client_id": "163593762738582528",
10+
"client_secret": "219DC9702F68864B0F9914578EA277C1305DBD0D13AC15D063BF4320C091846B",
11+
"app_id": "101276141",
12+
"package_name": "com.huawei.hms.maps.demo"
13+
},
14+
"service": {
15+
"analytics": {
16+
"collector_url": "datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
17+
"resource_id": "p1",
18+
"channel_id": ""
19+
}
20+
},
21+
"configuration_version": "1.0"
22+
}

map-sample/app/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'com.huawei.agconnect'
3+
android {
4+
compileSdkVersion 28
5+
buildToolsVersion "29.0.0"
6+
defaultConfig {
7+
applicationId "com.huawei.hms.maps.demo"
8+
minSdkVersion 19
9+
targetSdkVersion 28
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
signingConfigs {
15+
release {
16+
storeFile file("hmsmapdemo.keystore")
17+
storePassword "123456"
18+
keyAlias "androiddebugkey"
19+
keyPassword "123456"
20+
v2SigningEnabled true
21+
}
22+
}
23+
buildTypes {
24+
release {
25+
minifyEnabled false
26+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27+
signingConfig signingConfigs.release
28+
}
29+
debug {
30+
signingConfig signingConfigs.release
31+
}
32+
}
33+
}
34+
35+
dependencies {
36+
implementation fileTree(dir: 'libs', include: ['*.aar'])
37+
implementation 'androidx.appcompat:appcompat:1.0.2'
38+
implementation 'com.huawei.hms:maps:4.0.0.301'
39+
}

map-sample/app/hmsmapdemo.keystore

2.18 KB
Binary file not shown.

map-sample/app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.huawei.hms.maps.demo">
4+
5+
<uses-permission
6+
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
7+
android:maxSdkVersion="22" />
8+
<uses-permission
9+
android:name="android.permission.READ_EXTERNAL_STORAGE"
10+
android:maxSdkVersion="22" />
11+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
13+
<uses-permission android:name="android.permission.INTERNET" />
14+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
15+
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
16+
17+
<application
18+
android:allowBackup="false"
19+
android:icon="@mipmap/ic_launcher"
20+
android:label="@string/app_name"
21+
android:networkSecurityConfig="@xml/network_security_config"
22+
android:roundIcon="@mipmap/ic_launcher_round"
23+
android:supportsRtl="true"
24+
android:theme="@style/AppTheme">
25+
26+
<activity
27+
android:name=".MainActivity"
28+
android:label="@string/title_activity_main"
29+
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
30+
<intent-filter>
31+
<action android:name="android.intent.action.MAIN" />
32+
33+
<category android:name="android.intent.category.LAUNCHER" />
34+
</intent-filter>
35+
</activity>
36+
37+
<activity
38+
android:name=".CircleDemoActivity"
39+
android:label="CircleDemo" />
40+
<activity
41+
android:name=".ControlsDemoActivity"
42+
android:label="ControlsDemo" />
43+
<activity
44+
android:name=".GestureDemoActivity"
45+
android:label="GestureDemo" />
46+
<activity
47+
android:name=".GroundOverlayDemoActivity"
48+
android:label="GroundOverlayDemo" />
49+
<activity
50+
android:name=".LiteModeDemoActivity"
51+
android:label="LiteModeDemo" />
52+
<activity
53+
android:name=".MapFunctionsDemoActivity"
54+
android:label="MapFunctions" />
55+
<activity
56+
android:name=".MoreLanguageDemoActivity"
57+
android:label="MoreLanguageDemo" />
58+
<activity
59+
android:name=".PolygonDemoActivity"
60+
android:label="PolygonDemo" />
61+
<activity
62+
android:name=".PolylineDemoActivity"
63+
android:label="PolylineDemo" />
64+
<activity
65+
android:name=".LocationSourceDemoActivity"
66+
android:label="LocationSourceDemo" />
67+
<activity
68+
android:name=".MarkerDemoActivity"
69+
android:label="MarkerDemo" />
70+
<activity
71+
android:name=".CameraDemoActivity"
72+
android:label="CameraDemo" />
73+
<activity
74+
android:name=".BasicMapDemoActivity"
75+
android:label="BasicMapDemo" />
76+
<activity
77+
android:name=".MapFragmentDemoActivity"
78+
android:label="MapFragmentDemo" />
79+
<activity
80+
android:name=".MapViewDemoActivity"
81+
android:label="MapViewDemo" />
82+
<activity
83+
android:name=".SupportMapDemoActivity"
84+
android:label="SupportMapDemo" />
85+
<activity
86+
android:name=".SupportMapCodeDemoActivity"
87+
android:label="SupportMapCodeDemo" />
88+
<activity
89+
android:name=".MapViewCodeDemoActivity"
90+
android:label="MapViewCodeDemo" />
91+
<activity
92+
android:name=".MapFragmentCodeDemoActivity"
93+
android:label="MapFragmentCodeDemo" />
94+
<activity
95+
android:name=".StyleMapDemoActivity"
96+
android:label="StyleMapDemo" />
97+
<activity
98+
android:name=".EventsDemoActivity"
99+
android:label="EventsDemo" />
100+
101+
</application>
102+
103+
</manifest>
14.8 KB
Loading
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright (C) 2012 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* 2020.1.3-Changed modify the import classes type and add some map display demos.
17+
* Huawei Technologies Co., Ltd.
18+
*
19+
*/
20+
21+
package com.huawei.hms.maps.demo;
22+
23+
import com.huawei.hms.maps.CameraUpdate;
24+
import com.huawei.hms.maps.HuaweiMap;
25+
import com.huawei.hms.maps.OnMapReadyCallback;
26+
27+
import android.content.Intent;
28+
import android.os.Bundle;
29+
import android.util.Log;
30+
import android.view.View;
31+
32+
import androidx.appcompat.app.AppCompatActivity;
33+
34+
/**
35+
* This shows how we create a basic activity with a map.
36+
*/
37+
public class BasicMapDemoActivity extends AppCompatActivity implements OnMapReadyCallback {
38+
private static final String TAG = "BasicMapDemoActivity";
39+
40+
private HuaweiMap hmap;
41+
42+
@Override
43+
protected void onCreate(Bundle savedInstanceState) {
44+
Log.d(TAG, "onCreate: ");
45+
super.onCreate(savedInstanceState);
46+
setContentView(R.layout.activity_basic_demo);
47+
48+
}
49+
50+
@Override
51+
public void onMapReady(HuaweiMap map) {
52+
Log.d(TAG, "onMapReady: ");
53+
hmap = map;
54+
CameraUpdate c = null;
55+
c.getCameraUpdate();
56+
}
57+
58+
/**
59+
* Start the createMapView activity
60+
*/
61+
public void createMapView(View view) {
62+
Log.d(TAG, "createMapView: ");
63+
Intent i = new Intent(this, MapViewDemoActivity.class);
64+
startActivity(i);
65+
}
66+
67+
/**
68+
* Start the createMapViewCode activity
69+
*/
70+
public void createMapViewCode(View view) {
71+
Log.d(TAG, "createMapViewCode: ");
72+
Intent i = new Intent(this, MapViewCodeDemoActivity.class);
73+
startActivity(i);
74+
}
75+
76+
/**
77+
* Start the createMapFragment activity
78+
*/
79+
public void createMapFragment(View view) {
80+
Log.d(TAG, "createMapFragment: ");
81+
Intent i = new Intent(this, MapFragmentDemoActivity.class);
82+
startActivity(i);
83+
}
84+
85+
/**
86+
* Start the createMapFragmentCode activity
87+
*/
88+
public void createMapFragmentCode(View view) {
89+
Log.d(TAG, "createMapFragmentCode: ");
90+
Intent i = new Intent(this, MapFragmentCodeDemoActivity.class);
91+
startActivity(i);
92+
}
93+
94+
/**
95+
* Start the createSupportMapFragment activity
96+
*/
97+
public void createSupportMapFragment(View view) {
98+
Log.d(TAG, "createSupportMapFragment: ");
99+
Intent i = new Intent(this, SupportMapDemoActivity.class);
100+
startActivity(i);
101+
}
102+
103+
/**
104+
* Start the createSupportMapFragmentCode activity
105+
*/
106+
public void createSupportMapFragmentCode(View view) {
107+
Log.d(TAG, "createSupportMapFragmentCode: ");
108+
Intent i = new Intent(this, SupportMapCodeDemoActivity.class);
109+
startActivity(i);
110+
}
111+
}

0 commit comments

Comments
 (0)