Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Native Mobile Apps 2020 Fall
Course Materials
Commits
e92cd19c
Commit
e92cd19c
authored
Oct 09, 2020
by
Andres Käver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
location
parent
d9d872c4
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
1044 additions
and
0 deletions
+1044
-0
android/DBDemo/.idea/gradle.xml
android/DBDemo/.idea/gradle.xml
+1
-0
android/GPSMapDemo/.gitignore
android/GPSMapDemo/.gitignore
+14
-0
android/GPSMapDemo/.idea/.name
android/GPSMapDemo/.idea/.name
+1
-0
android/GPSMapDemo/.idea/codeStyles/Project.xml
android/GPSMapDemo/.idea/codeStyles/Project.xml
+138
-0
android/GPSMapDemo/.idea/codeStyles/codeStyleConfig.xml
android/GPSMapDemo/.idea/codeStyles/codeStyleConfig.xml
+5
-0
android/GPSMapDemo/.idea/gradle.xml
android/GPSMapDemo/.idea/gradle.xml
+20
-0
android/GPSMapDemo/.idea/jarRepositories.xml
android/GPSMapDemo/.idea/jarRepositories.xml
+25
-0
android/GPSMapDemo/.idea/misc.xml
android/GPSMapDemo/.idea/misc.xml
+9
-0
android/GPSMapDemo/.idea/runConfigurations.xml
android/GPSMapDemo/.idea/runConfigurations.xml
+12
-0
android/GPSMapDemo/.idea/vcs.xml
android/GPSMapDemo/.idea/vcs.xml
+6
-0
android/GPSMapDemo/app/.gitignore
android/GPSMapDemo/app/.gitignore
+1
-0
android/GPSMapDemo/app/build.gradle
android/GPSMapDemo/app/build.gradle
+38
-0
android/GPSMapDemo/app/proguard-rules.pro
android/GPSMapDemo/app/proguard-rules.pro
+21
-0
android/GPSMapDemo/app/src/androidTest/java/ee/taltech/mobile2020/gpsmapdemo/ExampleInstrumentedTest.kt
.../taltech/mobile2020/gpsmapdemo/ExampleInstrumentedTest.kt
+24
-0
android/GPSMapDemo/app/src/debug/res/values/google_maps_api.xml
...d/GPSMapDemo/app/src/debug/res/values/google_maps_api.xml
+24
-0
android/GPSMapDemo/app/src/main/AndroidManifest.xml
android/GPSMapDemo/app/src/main/AndroidManifest.xml
+43
-0
android/GPSMapDemo/app/src/main/java/ee/taltech/mobile2020/gpsmapdemo/MapsActivity.kt
...ain/java/ee/taltech/mobile2020/gpsmapdemo/MapsActivity.kt
+75
-0
android/GPSMapDemo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
.../app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+30
-0
android/GPSMapDemo/app/src/main/res/drawable/ic_launcher_background.xml
...Demo/app/src/main/res/drawable/ic_launcher_background.xml
+170
-0
android/GPSMapDemo/app/src/main/res/layout/activity_maps.xml
android/GPSMapDemo/app/src/main/res/layout/activity_maps.xml
+9
-0
android/GPSMapDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
...apDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+5
-0
android/GPSMapDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
.../app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+5
-0
android/GPSMapDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png
...d/GPSMapDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
...apDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png
...d/GPSMapDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
...apDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
.../GPSMapDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
...pDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
...GPSMapDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
...Demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
...PSMapDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+0
-0
android/GPSMapDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
...emo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
+0
-0
android/GPSMapDemo/app/src/main/res/values/colors.xml
android/GPSMapDemo/app/src/main/res/values/colors.xml
+6
-0
android/GPSMapDemo/app/src/main/res/values/strings.xml
android/GPSMapDemo/app/src/main/res/values/strings.xml
+4
-0
android/GPSMapDemo/app/src/main/res/values/styles.xml
android/GPSMapDemo/app/src/main/res/values/styles.xml
+10
-0
android/GPSMapDemo/app/src/release/res/values/google_maps_api.xml
...GPSMapDemo/app/src/release/res/values/google_maps_api.xml
+20
-0
android/GPSMapDemo/app/src/test/java/ee/taltech/mobile2020/gpsmapdemo/ExampleUnitTest.kt
.../java/ee/taltech/mobile2020/gpsmapdemo/ExampleUnitTest.kt
+17
-0
android/GPSMapDemo/build.gradle
android/GPSMapDemo/build.gradle
+26
-0
android/GPSMapDemo/gradle.properties
android/GPSMapDemo/gradle.properties
+21
-0
android/GPSMapDemo/gradle/wrapper/gradle-wrapper.jar
android/GPSMapDemo/gradle/wrapper/gradle-wrapper.jar
+0
-0
android/GPSMapDemo/gradle/wrapper/gradle-wrapper.properties
android/GPSMapDemo/gradle/wrapper/gradle-wrapper.properties
+6
-0
android/GPSMapDemo/gradlew
android/GPSMapDemo/gradlew
+172
-0
android/GPSMapDemo/gradlew.bat
android/GPSMapDemo/gradlew.bat
+84
-0
android/GPSMapDemo/settings.gradle
android/GPSMapDemo/settings.gradle
+2
-0
No files found.
android/DBDemo/.idea/gradle.xml
View file @
e92cd19c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"GradleMigrationSettings"
migrationVersion=
"1"
/>
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
...
...
android/GPSMapDemo/.gitignore
0 → 100644
View file @
e92cd19c
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
android/GPSMapDemo/.idea/.name
0 → 100644
View file @
e92cd19c
GPS Map Demo
\ No newline at end of file
android/GPSMapDemo/.idea/codeStyles/Project.xml
0 → 100644
View file @
e92cd19c
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<JetCodeStyleSettings>
<option
name=
"PACKAGES_TO_USE_STAR_IMPORTS"
>
<value>
<package
name=
"java.util"
alias=
"false"
withSubpackages=
"false"
/>
<package
name=
"kotlinx.android.synthetic"
alias=
"false"
withSubpackages=
"true"
/>
<package
name=
"io.ktor"
alias=
"false"
withSubpackages=
"true"
/>
</value>
</option>
<option
name=
"PACKAGES_IMPORT_LAYOUT"
>
<value>
<package
name=
""
alias=
"false"
withSubpackages=
"true"
/>
<package
name=
"java"
alias=
"false"
withSubpackages=
"true"
/>
<package
name=
"javax"
alias=
"false"
withSubpackages=
"true"
/>
<package
name=
"kotlin"
alias=
"false"
withSubpackages=
"true"
/>
<package
name=
""
alias=
"true"
withSubpackages=
"true"
/>
</value>
</option>
<option
name=
"CODE_STYLE_DEFAULTS"
value=
"KOTLIN_OFFICIAL"
/>
</JetCodeStyleSettings>
<codeStyleSettings
language=
"XML"
>
<indentOptions>
<option
name=
"CONTINUATION_INDENT_SIZE"
value=
"4"
/>
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>
xmlns:android
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
xmlns:.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*:id
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*:name
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
name
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
style
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
<order>
ANDROID_ATTRIBUTE_ORDER
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
.*
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings
language=
"kotlin"
>
<option
name=
"CODE_STYLE_DEFAULTS"
value=
"KOTLIN_OFFICIAL"
/>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
android/GPSMapDemo/.idea/codeStyles/codeStyleConfig.xml
0 → 100644
View file @
e92cd19c
<component
name=
"ProjectCodeStyleConfiguration"
>
<state>
<option
name=
"USE_PER_PROJECT_SETTINGS"
value=
"true"
/>
</state>
</component>
\ No newline at end of file
android/GPSMapDemo/.idea/gradle.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<option
name=
"testRunner"
value=
"PLATFORM"
/>
<option
name=
"distributionType"
value=
"DEFAULT_WRAPPED"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleJvm"
value=
"1.8"
/>
<option
name=
"modules"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
<option
value=
"$PROJECT_DIR$/app"
/>
</set>
</option>
<option
name=
"resolveModulePerSourceSet"
value=
"false"
/>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
android/GPSMapDemo/.idea/jarRepositories.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RemoteRepositoriesConfiguration"
>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Maven Central repository"
/>
<option
name=
"url"
value=
"https://repo1.maven.org/maven2"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"jboss.community"
/>
<option
name=
"name"
value=
"JBoss Community repository"
/>
<option
name=
"url"
value=
"https://repository.jboss.org/nexus/content/repositories/public/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"BintrayJCenter"
/>
<option
name=
"name"
value=
"BintrayJCenter"
/>
<option
name=
"url"
value=
"https://jcenter.bintray.com/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"Google"
/>
<option
name=
"name"
value=
"Google"
/>
<option
name=
"url"
value=
"https://dl.google.com/dl/android/maven2/"
/>
</remote-repository>
</component>
</project>
\ No newline at end of file
android/GPSMapDemo/.idea/misc.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
<option
name=
"id"
value=
"Android"
/>
</component>
</project>
\ No newline at end of file
android/GPSMapDemo/.idea/runConfigurations.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
android/GPSMapDemo/.idea/vcs.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/../.."
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
android/GPSMapDemo/app/.gitignore
0 → 100644
View file @
e92cd19c
/build
\ No newline at end of file
android/GPSMapDemo/app/build.gradle
0 → 100644
View file @
e92cd19c
apply
plugin:
'com.android.application'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android-extensions'
android
{
compileSdkVersion
29
buildToolsVersion
"30.0.2"
defaultConfig
{
applicationId
"ee.taltech.mobile2020.gpsmapdemo"
minSdkVersion
22
targetSdkVersion
29
versionCode
1
versionName
"1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes
{
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
}
dependencies
{
implementation
fileTree
(
dir:
"libs"
,
include:
[
"*.jar"
])
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation
'androidx.core:core-ktx:1.3.1'
implementation
'androidx.appcompat:appcompat:1.2.0'
implementation
'com.google.android.gms:play-services-maps:17.0.0'
implementation
'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.3.0'
}
\ No newline at end of file
android/GPSMapDemo/app/proguard-rules.pro
0 → 100644
View file @
e92cd19c
# Add project specific ProGuard rules here.
#
You
can
control
the
set
of
applied
configuration
files
using
the
#
proguardFiles
setting
in
build
.
gradle
.
#
#
For
more
details
,
see
#
http
://
developer
.
android
.
com
/
guide
/
developing
/
tools
/
proguard
.
html
#
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
*
;
#
}
#
Uncomment
this
to
preserve
the
line
number
information
for
#
debugging
stack
traces
.
#-
keepattributes
SourceFile
,
LineNumberTable
#
If
you
keep
the
line
number
information
,
uncomment
this
to
#
hide
the
original
source
file
name
.
#-
renamesourcefileattribute
SourceFile
\ No newline at end of file
android/GPSMapDemo/app/src/androidTest/java/ee/taltech/mobile2020/gpsmapdemo/ExampleInstrumentedTest.kt
0 → 100644
View file @
e92cd19c
package
ee.taltech.mobile2020.gpsmapdemo
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.ext.junit.runners.AndroidJUnit4
import
org.junit.Test
import
org.junit.runner.RunWith
import
org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith
(
AndroidJUnit4
::
class
)
class
ExampleInstrumentedTest
{
@Test
fun
useAppContext
()
{
// Context of the app under test.
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
assertEquals
(
"ee.taltech.mobile2020.gpsmapdemo"
,
appContext
.
packageName
)
}
}
\ No newline at end of file
android/GPSMapDemo/app/src/debug/res/values/google_maps_api.xml
0 → 100644
View file @
e92cd19c
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=DC:C1:08:9C:EF:77:D7:97:40:27:63:05:2C:47:D5:F9:0D:AA:CF:46%3Bee.taltech.mobile2020.gpsmapdemo
You can also add your credentials to an existing key, using these values:
Package name:
ee.taltech.mobile2020.gpsmapdemo
SHA-1 certificate fingerprint:
DC:C1:08:9C:EF:77:D7:97:40:27:63:05:2C:47:D5:F9:0D:AA:CF:46
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string
name=
"google_maps_key"
templateMergeStrategy=
"preserve"
translatable=
"false"
>
AIzaSyDWnPIWvnaq3KX_TbOg0EK_7jMdh04WziE
</string>
</resources>
\ No newline at end of file
android/GPSMapDemo/app/src/main/AndroidManifest.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"ee.taltech.mobile2020.gpsmapdemo"
>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the "MyLocation" functionality.
-->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name=
"com.google.android.geo.API_KEY"
android:value=
"@string/google_maps_key"
/>
<activity
android:name=
".MapsActivity"
android:label=
"@string/title_activity_maps"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
android/GPSMapDemo/app/src/main/java/ee/taltech/mobile2020/gpsmapdemo/MapsActivity.kt
0 → 100644
View file @
e92cd19c
package
ee.taltech.mobile2020.gpsmapdemo
import
android.Manifest
import
android.content.Context
import
android.content.pm.PackageManager
import
android.location.Criteria
import
android.location.Location
import
android.location.LocationManager
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
androidx.core.app.ActivityCompat
import
com.google.android.gms.maps.CameraUpdateFactory
import
com.google.android.gms.maps.GoogleMap
import
com.google.android.gms.maps.OnMapReadyCallback
import
com.google.android.gms.maps.SupportMapFragment
import
com.google.android.gms.maps.model.LatLng
import
com.google.android.gms.maps.model.MarkerOptions
class
MapsActivity
:
AppCompatActivity
(),
OnMapReadyCallback
{
private
lateinit
var
mMap
:
GoogleMap
private
lateinit
var
locationManager
:
LocationManager
;
private
var
provider
:
String
?
=
""
;
private
var
location
:
Location
?
=
null
;
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_maps
)
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
val
mapFragment
=
supportFragmentManager
.
findFragmentById
(
R
.
id
.
map
)
as
SupportMapFragment
mapFragment
.
getMapAsync
(
this
)
locationManager
=
getSystemService
(
Context
.
LOCATION_SERVICE
)
as
LocationManager
var
criteria
=
Criteria
()
provider
=
locationManager
.
getBestProvider
(
criteria
,
true
)
if
(
provider
!=
null
){
if
(
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
return
}
location
=
locationManager
.
getLastKnownLocation
(
provider
);
}
else
{
}
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
override
fun
onMapReady
(
googleMap
:
GoogleMap
)
{
Log
.
d
(
"onMapReady"
,
"---"
);
mMap
=
googleMap
var
markerLatLng
=
LatLng
(
0.0
,
0.0
)
// tallinn
if
(
location
!=
null
)
{
Log
.
d
(
"onMapReady"
,
"existing"
);
markerLatLng
=
LatLng
(
location
!!
.
latitude
,
location
!!
.
longitude
)
}
mMap
.
addMarker
(
MarkerOptions
().
position
(
markerLatLng
).
title
(
"Marker"
))
mMap
.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
markerLatLng
))
}
}
\ No newline at end of file
android/GPSMapDemo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
0 → 100644
View file @
e92cd19c
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:aapt=
"http://schemas.android.com/aapt"
android:width=
"108dp"
android:height=
"108dp"
android:viewportWidth=
"108"
android:viewportHeight=
"108"
>
<path
android:pathData=
"M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"
>
<aapt:attr
name=
"android:fillColor"
>
<gradient
android:endX=
"85.84757"
android:endY=
"92.4963"
android:startX=
"42.9492"
android:startY=
"49.59793"
android:type=
"linear"
>
<item
android:color=
"#44000000"
android:offset=
"0.0"
/>
<item
android:color=
"#00000000"
android:offset=
"1.0"
/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor=
"#FFFFFF"
android:fillType=
"nonZero"
android:pathData=
"M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth=
"1"
android:strokeColor=
"#00000000"
/>
</vector>
\ No newline at end of file
android/GPSMapDemo/app/src/main/res/drawable/ic_launcher_background.xml
0 → 100644
View file @
e92cd19c
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"108dp"
android:height=
"108dp"
android:viewportWidth=
"108"
android:viewportHeight=
"108"
>
<path
android:fillColor=
"#3DDC84"
android:pathData=
"M0,0h108v108h-108z"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M9,0L9,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M19,0L19,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M29,0L29,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M39,0L39,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M49,0L49,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M59,0L59,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M69,0L69,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M79,0L79,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M89,0L89,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M99,0L99,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M0,9L108,9"