0630 firebase + google analytics
2021. 6. 30. 10:59ㆍNode.js
firebase에 처음 로그인하면 뜨는 유니티 세팅 완료 후
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class App : MonoBehaviour
{
public Text txtVersion;
public Text txtId;
public Text txtUsername;
public Text txtState;
public Image thumb;
public Text txtAuthenticate;
// Start is called before the first frame update
void Start()
{
this.txtVersion.text = Application.version;
Debug.Log("================================= init GPGS =================================");
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.EnableSavedGames()
.RequestIdToken()
.Build();
PlayGamesPlatform.InitializeInstance(config);
// recommended for debugging:
PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
PlayGamesPlatform.Activate();
Debug.Log("================================= authenticate =================================");
// authenticate user:
PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptAlways, (result) => {
Debug.Log("================================= result =================================" + result);
Debug.Log("================================= local User =================================" + Social.localUser);
Debug.Log("================================= autenciated =================================" + Social.localUser.authenticated);
this.txtId.text = Social.localUser.id;
this.txtUsername.text = Social.localUser.userName;
this.txtState.text = Social.localUser.state.ToString();
this.txtAuthenticate.text = result.ToString();
if (result == SignInStatus.Success)
{
var localUser = (PlayGamesLocalUser)Social.localUser;
var googleIdToken = localUser.GetIdToken();
Debug.LogFormat("googleIdToken: {0}", googleIdToken);
Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
Firebase.Auth.Credential credential =
Firebase.Auth.GoogleAuthProvider.GetCredential(googleIdToken, null);
auth.SignInWithCredentialAsync(credential).ContinueWith(task => {
if (task.IsCanceled)
{
Debug.LogError("SignInWithCredentialAsync was canceled.");
return;
}
if (task.IsFaulted)
{
Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
return;
}
Firebase.Auth.FirebaseUser newUser = task.Result;
Debug.LogFormat("User signed in successfully: {0} ({1})",
newUser.DisplayName, newUser.UserId);
});
}
StartCoroutine(this.WaitforLoadThumb(() =>
{
Debug.Log(Social.localUser.image);
Debug.LogFormat("{0}{1}", Social.localUser.image.width, Social.localUser.image.height);
this.thumb.sprite = Sprite.Create(Social.localUser.image, new Rect(0, 0, Social.localUser.image.width, Social.localUser.image.height), Vector2.zero);
this.thumb.SetNativeSize();
}));
});
}
private IEnumerator WaitforLoadThumb(System.Action callback)
{
while (true)
{
if (Social.localUser.image != null)
{
break;
}
yield return null;
}
callback();
}
}
D:\Program Files\Nox\bin>adb connect 127.0.0.1:62001
unable to connect to 127.0.0.1:62001: cannot connect to 127.0.0.1:62001:
대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다. (10061)
위의 오류가 뜰 경우
netstat -ano 입력시
netstat -ano | find "62001"
Kill a process with process id:
We can use below command to kill a process using process id(pid).
taskkill /PID processId
출처:
https://www.windows-commandline.com/taskkill-kill-process/
'Node.js' 카테고리의 다른 글
유니티 연동 카카오 로그인 (0) | 2021.07.08 |
---|---|
0708 구글 애널리틱스 (0) | 2021.07.08 |
Naver login (0) | 2021.06.24 |
GPGS Achievement (0) | 2021.06.23 |
0617 GPGS (0) | 2021.06.17 |