// Use this for initialization void Start() { #if UNITY_IPHONE tokenSent = false; GTPushBinding.StartSDK(appId, appKey, appSecret); GTPushBinding.setListenerGameObject(this.gameObject.name); GTPushBinding.registerUserNotification(); #endif #if UNITY_ANDROID GTPushBinding.initPush(this.gameObject.name); #endif #if (UNITY_IPHONE || UNITY_ANDROID) Debug.Log("getui sdk version is : " + GTPushBinding.getVersion()); Debug.Log("isPushTurnOn is : " + GTPushBinding.isPushTurnOn()); #endif }
public void Init(string app_id, string app_key, string app_secret) { #if UNITY_IPHONE tokenSent = false; GTPushBinding.StartSDK(app_id, app_key, app_secret); GTPushBinding.setListenerGameObject(this.gameObject.name); GTPushBinding.registerUserNotification(); // 注册 VoIP 通知 GTPushBinding.voipRegistration(); #endif #if UNITY_ANDROID GTPushBinding.initPush(this.gameObject.name); #endif #if (UNITY_IPHONE || UNITY_ANDROID) Debug.Log("getui sdk version is : " + GTPushBinding.getVersion()); Debug.Log("isPushTurnOn is : " + GTPushBinding.isPushTurnOn()); #endif }
// Update is called once per frame void Update() { #if UNITY_IPHONE if (!tokenSent) { byte[] token = NotificationServices.deviceToken; if (token != null) { // send token to a provider tokenSent = true; string deviceToken = System.BitConverter.ToString(token).Replace("-", ""); GTPushBinding.registerDeviceToken(deviceToken); Debug.Log("deviceToken is : " + deviceToken + " cid is : " + GTPushBinding.getClientId() + " version is : " + GTPushBinding.getVersion()); } } #endif }
//------------------------------------------------------------------------- public void onReceiveClientId(string clientId) { Debug.Log("GeTuiSdkDidRegisterClient clientId : " + clientId); #if UNITY_IOS if (!tokenSent) { byte[] token = NotificationServices.deviceToken; if (token != null) { // send token to a provider tokenSent = true; string deviceToken = System.BitConverter.ToString(token).Replace("-", ""); GTPushBinding.registerDeviceToken(deviceToken); Debug.Log("deviceToken is : " + deviceToken + " cid is : " + GTPushBinding.getClientId() + " version is : " + GTPushBinding.getVersion()); } } #endif //#if (UNITY_IPHONE || UNITY_ANDROID) // GTPushBinding.setTag("ge,tui"); // GTPushBinding.bindAlias("getui"); // GTPushBinding.unBindAlias("getui"); //#endif }