Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add method to check if google services are available on device #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package io.cgisca.godot.gpgs

import android.app.Activity
import android.content.Intent
import com.google.android.gms.common.GoogleApiAvailability
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.auth.api.Auth
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInClient
Expand Down Expand Up @@ -86,6 +88,7 @@ class PlayGameServicesGodot(godot: Godot) : GodotPlugin(godot), AchievementsList

override fun getPluginMethods(): MutableList<String> {
return mutableListOf(
"isGooglePlayServicesAvailable",
"init",
"initWithSavedGames",
"signIn",
Expand Down Expand Up @@ -164,6 +167,11 @@ class PlayGameServicesGodot(godot: Godot) : GodotPlugin(godot), AchievementsList
}
}

fun isGooglePlayServicesAvailable() : Boolean {
val result: Int = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(godot as Activity)
return result == ConnectionResult.SUCCESS
}

fun init(enablePopups: Boolean) {
initialize(false, enablePopups, "DefaultGame")
}
Expand Down