Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ startLocationUpdates(interval: Int, maxWaitTime: Int)
stopLocationUpdates()

# Get last location
getLastKnowLocation()
getLastKnownLocation()

# Location updates signal
onLocationUpdates(location_data: Dictionary)
Expand Down Expand Up @@ -67,4 +67,4 @@ onLocationError(errorCode: Int, message: String)
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.
limitations under the License.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
compileSdkVersion 32
buildToolsVersion "32.0.0"

defaultConfig {
applicationId "com.cacaosd.locationplugin"
minSdkVersion 18
targetSdkVersion 29
minSdkVersion 19
targetSdkVersion 32
versionCode 1
versionName "1.0"

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.3.72"
ext.kotlin_version = "1.6.0"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 26 23:17:30 EET 2020
#Wed Nov 02 15:00:10 EDT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
13 changes: 6 additions & 7 deletions locationplugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
compileSdkVersion 32
buildToolsVersion "32.0.0"

defaultConfig {
minSdkVersion 18
targetSdkVersion 29
versionCode 1
versionName "1.0"
minSdkVersion 19
targetSdkVersion 32

consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -32,7 +30,8 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.0'
compileOnly fileTree(dir: "aars", include: ["godot-lib*.aar"])
implementation 'io.github.m4gr3d:godot:3.5.1.stable'
//impleme ntation fileTree(dir: "aars", include: ["godot-lib*.aar"])
implementation("com.google.android.gms:play-services-location:17.0.0")

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.godotengine.godot.Dictionary
import org.godotengine.godot.Godot
import org.godotengine.godot.plugin.GodotPlugin
import org.godotengine.godot.plugin.SignalInfo
import org.godotengine.godot.plugin.UsedByGodot

class LocationKotlinPlugin(godot: Godot) : GodotPlugin(godot) {

Expand Down Expand Up @@ -71,7 +72,7 @@ class LocationKotlinPlugin(godot: Godot) : GodotPlugin(godot) {
return listOf(
"startLocationUpdates",
"stopLocationUpdates",
"getLastKnowLocation"
"getLastKnownLocation"
)
}

Expand All @@ -94,7 +95,7 @@ class LocationKotlinPlugin(godot: Godot) : GodotPlugin(godot) {
}
}
}

@UsedByGodot
fun startLocationUpdates(interval: Int, maxWaitTime: Int) {
if (locationUpdatesStart) return
if (ContextCompat.checkSelfPermission(activity!!, Manifest.permission.ACCESS_FINE_LOCATION)
Expand All @@ -115,16 +116,16 @@ class LocationKotlinPlugin(godot: Godot) : GodotPlugin(godot) {
mFusedLocationClient!!.requestLocationUpdates(request, mLocationCallback, Looper.getMainLooper())
Log.d("GODOT", "Location update started.")
}

@UsedByGodot
fun stopLocationUpdates() {
if (locationUpdatesStart && mLocationCallback != null) {
locationUpdatesStart = false
mFusedLocationClient!!.removeLocationUpdates(mLocationCallback)
Log.d("GODOT", "Location update stopped.")
}
}

fun getLastKnowLocation() {
@UsedByGodot
fun getLastKnownLocation() {
if (ContextCompat.checkSelfPermission(activity!!, Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED
) {
Expand Down