### Getui SDK Initialization Debug Log Example (Logcat) Source: https://docs.getui.com/getui/mobile/android/androidstudio Example logcat output showing the Getui SDK initialization process. This includes messages about starting the SDK, service initialization, login success with a client ID (cid), and receiving the client ID. ```log [GT-PUSH] [PushManager]Start initializing sdk [GT-PUSH] [PushManager]start pushService = com.getui.demo.DemoPushServiceNew [GT-PUSH] [LOG-LogController] Sdk version = 3.0.1.0 [GT-PUSH] [PushManager]call registerPushIntentService [GT-PUSH] onHandleIntent() = get sdk service pid [GT-PUSH] ServiceManager start from initialize... [GT-PUSH] Start login appid = TI85ilD*******L89MFNV appkey = 1qNlp*******BP9COgYjA [GT-PUSH] Login successed with cid = e3f004e873f9a5d9e2e006c4a9ca2f5f [GT-PUSH] onHandleIntent() = received client id ``` -------------------------------- ### Android Project Structure Example Source: https://docs.getui.com/getui/mobile/android/androidstudio Illustrates a typical Android Studio project structure, highlighting the location of key files like build.gradle and the app module. ```text Getui_SDK_Demo_AS_official/ |- app/ (项目主模块) | |- libs/ (第三方库) | |- src/ (代码目录) | |- build.gradle (模块级 gradle 文件) |- gradle/ |- build.gradle (顶层 gradle 文件) |- settings.gradle | ...... ``` -------------------------------- ### Multi-Vendor Push Integration Guide Source: https://docs.getui.com/getui/dos/third_party This guide outlines the process of integrating with various push notification vendors through the Getui platform. It details the steps for application setup, understanding message delivery logic, configuring backend services, and important notes for a successful integration. ```APIDOC ## Multi-Vendor Push Integration Guide ### Description This document explains how to integrate with multiple push notification vendors using the Getui platform. It covers the entire process from initial setup to testing and troubleshooting. ### Integration Flow 1. **Create Getui Application:** Log in to the Getui developer platform and create an application. 2. **Create Vendor Applications:** Follow the integration documentation within the client multi-vendor SDK to apply for parameters on each vendor's platform. Configure these parameters in the Getui Developer Center under 'Message Push' -> 'App List' -> 'Registered App' -> 'Configuration Management' -> 'App Configuration'. 3. **App-Side Integration:** Integrate the SDK into your application according to the client multi-vendor SDK integration documentation. 4. **Server-Side Integration:** Configure Getui and vendor push parameters using the Getui Push Platform or server-side API interfaces. Refer to the RestAPI V2 documentation for API details. 5. **Push Testing:** Test push notifications using the SDK. Verify that messages are received through the Getui channel when the app is online and through vendor channels when offline. Ensure parameters are correctly passed. ### Message Delivery Logic **1. Message Delivery Process:** **2. Process Interpretation:** By default, messages are delivered through the Getui channel when the device application is online and through vendor channels when offline. Getui and vendor channels support five message types: * **Notification + Start App:** Supported by all. * **Notification + Web Page:** Supported by all. * **Notification + Intent:** Supported by all. * **Notification + Transparent Pass:** Not supported by Huawei, Honor, Oppo, Vivo. * **Pure Transparent Pass:** Not supported by Meizu, Oppo, Vivo. For Huawei and Xiaomi, messages are stored in the offline library and delivered when the SDK comes online within the message validity period. Honor is only effective when the app is online. > **Note:** It is recommended to use the 'Notification + Intent' method for vendor channels. ### Multi-Vendor Backend Push Settings **1. API Interface Push Settings:** Refer to the official RestAPI V2 documentation for details on setting up pushes via REST API. **Example Request Body:** ```json { "request_id": "Please fill in an ID between 10 and 32 characters", "audience": { "cid": [ "Please enter clientid" ] }, "settings": { "ttl": 3600000, "strategy": { "default": 1, "ios": 2 } }, "push_message": { "notification": { "title": "Please fill in the Android online title", "body": "Please fill in the Android online content", "click_type": "startapp" } }, "push_channel": { "android": { "ups": { "notification": { "title": "Android offline display title", "body": "Android offline display content", "click_type": "intent", "intent": "#Intent;component=your.package.name/your.activity.full.path;S.parm1=value1;S.parm2=value2;end" } } }, "ios": { "type": "notify", "payload": "Custom message", "aps": { "alert": { "title": "Apple offline display title", "body": "Apple offline display content" }, "content-available": 0, "sound": "default" }, "auto_badge": "+1" } } } ``` **2. Getui Platform Push Example:** Example: Getui -> Pure Transparent Pass, Vendor -> Notification + Intent. ### Multi-Vendor Push Integration Considerations * Ensure consistency in application package names and parameters across your app, the Getui platform, and vendor platforms. * When creating PUSH privileges on the Huawei platform, you must provide the SHA256 fingerprint certificate. Huawei message push requires a package signed with a formal signature. * After saving vendor parameters in the Getui platform, enable the channel switch, enable push compatibility, and disable the silent time. For further assistance with integration and push issues, please refer to the 'Common Problems with Multi-Vendor Push'. If you encounter any anomalies during the testing process, please contact Getui technical support promptly. **Contact Information:** Email: support@getui.com ``` -------------------------------- ### Android Project Structure Example Source: https://docs.getui.com/getui/mobile/android/androidstudio_id=doc-title-4 Illustrates a typical Android Studio project structure, highlighting the main app module, its subdirectories like 'libs' and 'src', and the location of Gradle build files. This provides context for where configuration files are typically found. ```text Getui_SDK_Demo_AS_official/ |- app/ (项目主模块) | |- libs/ (第三方库) | |- src/ (代码目录) | |- build.gradle (模块级 gradle 文件) |- gradle/ |- build.gradle (顶层 gradle 文件) |- settings.gradle | ...... ``` -------------------------------- ### Getui SDK Integration Error Log Example (Logcat) Source: https://docs.getui.com/getui/mobile/android/androidstudio Example logcat output showing a Getui SDK integration error. This typically appears as a stack trace with messages related to `GetuiPushException`, indicating potential issues with the SDK setup. ```log W/System.err: at com.getui.demo.GetuiSdkDemoActivity.test(GetuiSdkDemoActivity.java:115) W/System.err: at com.getui.demo.GetuiSdkDemoActivity.onCreate(GetuiSdkDemoActivity.java:25) ``` -------------------------------- ### Getui SDK preInit Call Example (Java) Source: https://docs.getui.com/geyan/mobile/android/api Provides an example of calling the preInit method of the Getui SDK using the application context. ```java GYManager.getInstance().preInit(this.getApplicationContext()); ``` -------------------------------- ### iOS SDK 初始化 (个推) Source: https://docs.getui.com/compliance 在iOS应用中,为满足合规要求,首次冷启动时,需在用户阅读并同意《隐私政策》后,调用`startSdkWithAppId:appKey:appSecret:delegate:launchingOptions:`方法初始化个推SDK。此方法会收集设备信息和网络信息并上报。后续冷启动时,仍需调用此初始化函数。 ```objectivec #import #import // ... 在 didFinishLaunchingWithOptions: 中调用 // [GeTuiSdk startSdkWithAppId:@"your_app_id" appKey:@"your_app_key" appSecret:@"your_app_secret" delegate:self launchingOptions:launchOptions]; ``` -------------------------------- ### Get Verify Token Example (Java) Source: https://docs.getui.com/geyan/mobile/android/api Example of how to get a verification token using GYManager. This involves calling getInstance().getVerifyToken with a phone number, timeout, and a GyCallBack. The callback handles success by parsing the response message for accessCode, processId, and operatorType, or failure by logging the error. ```java GYManager.getInstance().getVerifyToken(phone, 5000, new GyCallBack() { @Override public void onSuccess(final GYResponse response) { Log.d(TAG, "号码校验token成功 response:" + response); try { JSONObject jsonObject = new JSONObject(response.getMsg()); String accessCode = jsonObject.getString("accessCode"); String processId = jsonObject.getString("process_id"); int operatorType = jsonObject.getInt("operatorType"); String phone = jsonObject.getString("phone"); } catch (Throwable t) { t.printStackTrace(); } } @Override public void onFailed(GYResponse response) { Log.d(TAG, "号码校验token失败 response:" + response); showToast(response.toString()); } }); ``` -------------------------------- ### Example of Getting Current Authorization ViewController (Objective-C) Source: https://docs.getui.com/geyan/mobile/ios/api Shows how to get a reference to the current authorization ViewController using the `currentAuthViewController` method. Requires GeYanSdk.h. ```Objective-C [GeYanSdk currentAuthViewController]; ``` -------------------------------- ### Getui SDK init Call Example (Java) Source: https://docs.getui.com/geyan/mobile/android/api Illustrates how to call the init method of the Getui SDK with a configured GyConfig object. This example shows setting options like pre-login caching, debug modes, channel, and callback handlers. ```java GYManager.getInstance().init(GyConfig.with(this.getApplicationContext()) //预取号使用缓存,可以提高预取号的成功率,建议设置为true .preLoginUseCache(true) //个验debug调试模式 .debug(BuildConfig.DEBUG) //运营商debug调试模式 .eLoginDebug(BuildConfig.DEBUG) //应用渠道 .channel("xxxxxx") //成功失败回调 .callBack(new GyCallBack() { @Override public void onSuccess(GYResponse response) { Log.d(TAG, "初始化成功 response:" + response); } @Override public void onFailed(GYResponse response) { Log.e(TAG, "初始化失败 response:" + response); } }).build()); ``` -------------------------------- ### Get Authentication Token Request (JSON Example) Source: https://docs.getui.com/ido/server/token An example JSON payload for requesting an authentication token from the Getui API. It includes the necessary 'appkey', 'sign', and 'timestamp' parameters. ```json { "appkey":"YZkTKbz91l84HyM0TGlb38", "sign":"b66307af63a46d843aadfe1af5b05bc714074c9f9df45c0050e18d6176869769", "timestamp":1608172111917 } ``` -------------------------------- ### Android SDK 初始化 (个推) Source: https://docs.getui.com/compliance 在Android应用中,首次冷启动时,在用户同意隐私政策后,通过`PushManager.getInstance().preInit(Context context)`进行SDK的预初始化。随后,可以通过`PushManager.getInstance().init(Context context)`注册CID并生成个推唯一标识,此时SDK开始收集用户信息并上报数据。此方法耗时极少,不影响用户体验。 ```java import android.content.Context; import com.igexin.sdk.PushManager; // ... 在Application.onCreate()中调用 PushManager.getInstance().preInit(context); // ... 在获取用户授权后,可以调用 // PushManager.getInstance().init(context); ``` -------------------------------- ### Android SDK 初始化 Source: https://docs.getui.com/compliance/getui 在Android应用中,通过`PushManager.getInstance().preInit(Context context)`在`Application.onCreate`中进行预初始化。在用户同意隐私政策后,调用`PushManager.getInstance().initialize(Context context)`来注册CID并生成个推唯一标识,此时SDK开始收集用户信息。后续冷启动应继续调用`preInit`,并确保`init`方法被调用。 ```java com.igexin.sdk.PushManager.getInstance().preInit(Context context); com.igexin.sdk.PushManager.getInstance().initialize(Context context); ``` -------------------------------- ### Example of Getting Device Gyuid (Objective-C) Source: https://docs.getui.com/geyan/mobile/ios/api Demonstrates how to obtain the device's gyuid using the `gyuid` method. The example shows a direct call to the method. Requires GeYanSdk.h. ```Objective-C [GeYanSdk gyuid];//gtc_dbf8471ad1ef4681bf9928a446784aa535 ``` -------------------------------- ### Get Authentication Token Response (JSON Example) Source: https://docs.getui.com/ido/server/token An example JSON response received after successfully authenticating with the Getui API. It contains the 'token' for subsequent API calls and 'expireTime' indicating its validity period. ```json { "data": { "token": "deae177e7822dfb9e7fed7ebad058d4b", "expireTime": "1608172111917" }, "msg": "成功", "code": 0 } ``` -------------------------------- ### Initialize Getui SDK (HarmonyOS) Source: https://docs.getui.com/compliance/ido Initializes the Getui SDK for HarmonyOS. This asynchronous method should be called after obtaining user consent to the privacy policy. It returns a Promise that resolves with the GtcId upon successful initialization. ```javascript /// Initialize the operation tool SDK, initialize at the appropriate time: init(context: Context): Promise Ido.init(this.context).then((gtcId) => { hilog.info(0x0000, 'IDOAbility', 'IDO init Succeeded. GtcId: (%{public}s)', gtcId); }) ``` -------------------------------- ### Get SDK Service Status Source: https://docs.getui.com/getui/mobile/ios/api Retrieves the current status of the Getui SDK. Possible statuses include Starting, Started, Stopped, and Offline. This is useful for monitoring the SDK's operational state. ```Objective-C + (SdkStatus)status; ``` ```Objective-C [GeTuiSdk status]; ``` -------------------------------- ### ELoginThemeConfig Builder Example (Java) Source: https://docs.getui.com/geyan/mobile/android/elogin Shows how to create and configure an `ELoginThemeConfig` object using its builder pattern. This example demonstrates setting background images, status bar colors, and title bar layouts for the login interface. ```java ELoginThemeConfig.Builder builder = new ELoginThemeConfig.Builder(); //设置背景 builder.setAuthBGImgPath("login_bg") //设置状态栏颜色 字体颜色 .setStatusBar(Color.WHITE, Color.WHITE, true) //设置标题栏布局 .setAuthNavLayout(Color.WHITE, 49, true, false) ... return builder.build(); ``` -------------------------------- ### Android SDK Integration - Removed API Examples Source: https://docs.getui.com/geyan/mobile/android/init_id=3 Examples of API interfaces that have been removed in version 3.0.0.0 of the Getui Android SDK. These include functionalities related to animation verification and SMS verification. ```java picVerify nonSenseVerify smsCodeVerify verify checkLogin checkRegister ``` -------------------------------- ### Example of Getting Phone Verification Token (Objective-C) Source: https://docs.getui.com/geyan/mobile/ios/api Demonstrates how to call `getPhoneVerifyTokenCallback` to retrieve verification credentials. The example logs the received result, which includes a code, message, operator type, processID, and token. This requires GeYanSdk.h. ```Objective-C [GeYanSdk getPhoneVerifyTokenCallback:^(NSDictionary *result) { NSLog(@"getPhoneVerifyToken: %@", result); /// { /// code = 30000; /// msg = "操作成功"; /// operatorType = 3; /// processID = 0af5e43c1b06d1ca97f932725ae364ef; /// token = nm62ee17653a214872904a42671bf25ac3; /// } }]; ``` -------------------------------- ### Initialize Getui SDK (preInit) Source: https://docs.getui.com/geyan/mobile/android/init_id=1 Call `GYManager.getInstance().preInit(this.getApplicationContext())` in your Application's onCreate() method after the user has agreed to the privacy policy. This step ensures stable SDK service but does not enable functionality or generate GYUID yet. ```java GYManager.getInstance().preInit(this.getApplicationContext()); ``` -------------------------------- ### Getui API - Query Scheduled Task Status Example (cURL) Source: https://docs.getui.com/getui/server/rest_v2/push_id=doc-title-5 This cURL example shows how to query the status of a scheduled push task. It uses the GET HTTP method and requires the task ID in the URL. ```bash curl $BaseUrl/task/schedule/$taskid -X GET -H "token: $token" ``` -------------------------------- ### OneID SDK Initialization and Configuration Source: https://docs.getui.com/compliance/oneid Instructions and code examples for initializing the OneID SDK on different platforms, including enabling/disabling specific data collection features and handling user consent. ```APIDOC ## Android Initialization and Configuration ### Description Ensures compliance with regulatory requirements by initializing the OneID SDK after obtaining user consent for the privacy policy. This process involves collecting device, application, network, and location information. ### Method Call `com.getui.oneid.OneIDManager.initialize(Context context, OneCallback callback)` after user consent. ### Parameters - `context` (Context) - Required - The application's Context. - `callback` (OneCallback) - Required - Callback for initialization results. ### Enabling/Disabling AndroidID Collection #### Description Controls the collection of AndroidID for more accurate OneID services. #### Method `com.getui.oneid.OneIDManager.getInstance().setAndroidIdEnable(Context context, boolean enable)` #### Parameters - `context` (Context) - Required - The application's Context. - `enable` (boolean) - Required - `true` to enable, `false` to disable. ### Enabling/Disabling Wifi Collection #### Description Controls the collection of Wifi connection information for more accurate OneID services. #### Method `com.getui.oneid.OneIDManager.getInstance().setWifiEnable(Context context, boolean enable)` #### Parameters - `context` (Context) - Required - The application's Context. - `enable` (boolean) - Required - `true` to enable, `false` to disable. ## iOS Initialization ### Description Initializes the SDK on iOS after the user has read the Privacy Policy and given consent. The SDK collects device and network information. ### Method `[OneID startSdkWithAppId:@"appId" delegate:self];` ### Parameters - `appId` (NSString) - Required - The appId generated from the developer center. - `delegate` (id) - Required - The delegate object. ### Note Subsequent cold starts of the app should also call the initialization method after obtaining user authorization. ## HarmonyOS Initialization ### Description Initializes the SDK on HarmonyOS after the user has read the Privacy Policy and given consent. The SDK collects device and network information. ### Method ```javascript OneID.init(this.context) .then((ret) => { hilog.info(0x0000, 'testOneID', 'OneID.init %{public}s', ret) }) .catch((err: Error) => { hilog.info(0x0000, 'testOneID', 'OneID.init Error %{public}s', err.message) }) ``` ### Note Subsequent cold starts of the app should also call the initialization method after obtaining user authorization. ## User Consent and Privacy Policy ### Description Developers must ensure that the SDK is initiated only after obtaining explicit user consent. This involves presenting a privacy pop-up during the first run, which should include a summary of the privacy policy and a link to the full version, with clear options for the user to agree or disagree. ### Requirement - The App's Privacy Policy must include a section on "Sharing with Authorized Partners" that incorporates the Getui User Privacy Policy. - Clearly state the purpose, method, and scope of personal information collection and usage by the embedded SDKs to the end-user. ### Privacy Policy Template Information - **OneID SDK Data Collection:** - **Android:** Device information (platform, manufacturer, brand, model, OS version, OAID, operator, IP, DHCP), and optional information like IMEI, MAC, GAID, Serial Number, IMSI, ICCID, AndroidID, Wifi info, SSID, BSSID, base station info, location info, app list. - **iOS:** Device information (IDFA, IDFV, platform, manufacturer, brand, model, OS version, serial number) and network information (IP, Wifi info, SSID, BSSID, base station info, operator) and location info. - **HarmonyOS:** Device information (OAID, AAID, platform, manufacturer, brand, model, OS version, serial number) and network information (IP, Wifi info, SSID, BSSID, operator) and location info. - **Purpose:** To provide accurate OneID services, enhance user operations, risk control, and digital marketing, improving cross-platform user experience. - **Privacy Policy Link:** https://docs.getui.com/privacy ### Contact Information - **Support Email:** support@getui.com - **Phone:** 4006-808-606 ``` -------------------------------- ### Phone Number Verification Call Example Source: https://docs.getui.com/geyan/mobile/android/phoneVerify Demonstrates how to call the verifyPhoneNumber method using an anonymous GyCallBack implementation. This example shows how to handle success and failure callbacks, displaying messages to the user. ```java GYManager.getInstance().verifyPhoneNumber(accessCode, processId, phone, operatorType, new GyCallBack() { @Override public void onSuccess(GYResponse response) { showToast("校验成功"); } @Override public void onFailed(GYResponse response) { showToast("校验失败:" + response.getMsg()); } }); ``` -------------------------------- ### Full SDK Initialization (Android) Source: https://docs.getui.com/compliance/ido Performs the full initialization of the Getui SDK on Android, including registering the GTCID and generating a unique user identifier. This method should be called after obtaining user consent and should be called on every cold start after the initial preInit. It can be called immediately after preInit or delayed to a background thread. ```java GsManager.getInstance().init(Context context); ``` -------------------------------- ### HarmonyOS SDK 初始化 (个推) Source: https://docs.getui.com/compliance 在HarmonyOS应用中,为满足合规要求,首次冷启动时,需在用户阅读并同意《隐私政策》后,调用`PushManager.initialize()`方法初始化个推SDK。此方法会收集设备信息和网络信息并上报。后续冷启动时,仍需调用此初始化函数。 ```typescript import PushManager from '@ohos.PushManager'; import common from '@ohos.app.ability.common'; import hilog from '@ohos.hilog'; // ... 在Ability的onCreate()或onStart()中调用 PushManager.initialize({ appId: 'YOUR_APP_ID', context: this.context as common.UIAbilityContext, onSuccess: (cid: string) => { hilog.info(0x0000, 'EntryAbility', '个推SDK初始化成功, cid = %s', cid); }, onFailed: (error: string) => { hilog.error(0x0000, 'EntryAbility', '个推SDK初始化失败, error = %s', error); } }); ``` -------------------------------- ### GYResponse Structure and Examples Source: https://docs.getui.com/geyan/mobile/android/phoneVerify Illustrates the structure of the GYResponse object, which is used to return results from SDK operations. It details the fields like gyuid, success, code, and msg, and provides example JSON for both successful and failed responses. ```json //获取成功 { gyuid='cd529bfde4c641d0bc42257e2ed7300131', success=true, code=30000, msg='{"process_id":"c9c27556b973d4b9c1f952795f02a2ef","accessCode":"nm360b88d6e1a64ac4b4d7e70776a35b2e","phone":"17768345313","operatorType":4}' } //获取失败 { gyuid='8f41f31b0e7a43e6bbb4d1e6da77489b62', success=false, code=30007, msg='{"msg":1,"process_id":"9dfce85f8214af57be674d2b1069b8","operatorType":"CU","clienttype":"1","errorCode":"-20205","metadata":{"resultCode":1,"resultMsg":"请求sdk超时","resultData":"","traceId":""}}' } ``` -------------------------------- ### Example of Setting Silent Time (Android) Source: https://docs.getui.com/getui/mobile/android/api_id=doc-title-10 An example illustrating how to set a silent time for push notifications. This code sets the silent period to start at 3 PM (15:00) and last for 10 hours, meaning the SDK will not connect to the network during this interval. ```java int beginHour = 15; int durationHour = 10; boolean result = PushManager.getInstance().setSilentTime(context, beginHour, durationHour); ``` -------------------------------- ### 初始化 OneID SDK (HarmonyOS) Source: https://docs.getui.com/compliance/oneid 在 App 首次冷启动且用户阅读《隐私政策》并授权后,调用 `OneID.init()` 进行 SDK 初始化。此操作会收集设备信息、网络信息并上报。如果用户不同意授权,则不能调用此方法。后续冷启动也应保证调用初始化方法。 ```javascript // 初始化接口 OneID.init(this.context) .then((ret) => { hilog.info(0x0000, 'testOneID', 'OneID.init %{public}s', ret) }) .catch((err: Error) => { hilog.info(0x0000, 'testOneID', 'OneID.init Error %{public}s', err.message) }) ``` -------------------------------- ### Get 24-Hour Online Users (JSON Response Example) Source: https://docs.getui.com/getui/server/rest_v2/report This JSON example illustrates the response format for fetching the number of online users within the last 24 hours. The data is aggregated into time points, represented by timestamps as keys and the count of online users as values. ```json { "code":0, "msg":"success", "data": { "online_statics":{ "$date":4, "$date":5 } } } ``` -------------------------------- ### Android SDK Initialization and Registration Source: https://docs.getui.com/geyan/mobile/android/init_id=1 Demonstrates the recommended initialization and registration methods for the Getui SDK in Android applications, replacing deprecated methods. It shows the new `preInit` and `init` interfaces for SDK setup. ```java void preInit(Context context); void init(GyConfig config); ``` -------------------------------- ### Get Gtcid for User Profiling Source: https://docs.getui.com/ido/mobile/miniProgram/api Retrieves the gtcid, which can be used for querying user profile tags. This function should be called after the SDK has started. ```typescript /* * gtcid可用于用户画像标签的查询,需要在sdk启动后调用 */ function gtcid(): string; ``` -------------------------------- ### Set Install Channel for Getui SDK in Android Source: https://docs.getui.com/ido/mobile/android/init This Java code allows you to set the installation channel for the Getui SDK. This setting takes precedence over the channel defined in the manifest. It's recommended to call this before initializing the SDK. The channel value should not exceed the integer range if it's a numeric string. ```java GsConfig.setInstallChannel(channel); ```