{"id":25651335,"url":"https://github.com/devengagelab/push-unity3d-plugin","last_synced_at":"2025-08-20T21:20:39.313Z","repository":{"id":138721397,"uuid":"566687574","full_name":"DevEngageLab/push-unity3d-plugin","owner":"DevEngageLab","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-07T08:10:17.000Z","size":58750,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-07T11:55:43.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevEngageLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-16T07:51:12.000Z","updated_at":"2024-08-07T08:10:21.000Z","dependencies_parsed_at":"2024-04-10T09:45:45.297Z","dependency_job_id":"8a9b3bc9-99fc-45de-8cd4-72161429a484","html_url":"https://github.com/DevEngageLab/push-unity3d-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevEngageLab%2Fpush-unity3d-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevEngageLab%2Fpush-unity3d-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevEngageLab%2Fpush-unity3d-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevEngageLab%2Fpush-unity3d-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevEngageLab","download_url":"https://codeload.github.com/DevEngageLab/push-unity3d-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240347948,"owners_count":19787236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-23T16:55:02.662Z","updated_at":"2025-02-23T16:55:03.429Z","avatar_url":"https://github.com/DevEngageLab.png","language":"C#","readme":"# MTPush Unity Plugin\n\n## Setup\n\nPlace the files in the Plugins folder into your own project's Assets/Plugins folder.\n\n### Android\n\n1. Generate build file:\n   In Unity, Select *File---Build Settings---Player Settings*\n   ---Publishing Settings ---- Build , Check the following options：\n*  Custom Launcher Gradle Template\n*  Custom Gradle Properties Template\n*  Custom Base Gradle Template\n*  Custom LauncherManifest\n\n##### The following files will be generated\n*  launcherTemplate.gradle\n*  gradleTemplate.properties\n*  baseProjectTemplate.gradle\n*  LauncherManifest.xml\n\n#### Modify the baseProjectTemplate.gradle file:\nAdd the following code in both repositories files\n```\ngoogle()\njcenter()\nmavenCentral()\nmaven { url 'https://developer.huawei.com/repo/' }//Huawei manufacturers need\n```\nFor details, please refer to the baseProjectTemplate.gradle file under Examples\n\n#### Modify the launcherTemplate.gradle file：\n- Add the following code at the top of the file\n```\napply plugin: 'com.android.application'\n// google push need, if you don’t need google channel, delete it\napply plugin: 'com.google.gms.google-services'\n// huawei push need, if the huawei channel is not needed, delete it\napply plugin: 'com.huawei.agconnect'\n```\n- Add the following code at dependencies file.\n```\n    \n    //Required \n    implementation 'com.engagelab:engagelab:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，google manufacturer\n    implementation 'com.engagelab.plugin:google:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，honor manufacturer\n    implementation 'com.engagelab.plugin:honor:4.4.0' // Here we take version 4.4.0 as an example.\n    implementation 'com.engagelab.plugin:honor_th_push:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，huawei manufacturer\n    implementation 'com.engagelab.plugin:huawei:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，mi manufacturer\n    implementation 'com.engagelab.plugin:mi_global:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，meizu manufacturer\n    implementation 'com.engagelab.plugin:meizu:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，oppo manufacturer\n    implementation 'com.engagelab.plugin:oppo:4.4.0' // Here we take version 4.4.0 as an example.\n    implementation 'com.engagelab.plugin:oppo_th_push:4.4.0' // Here we take version 4.4.0 as an example.\n    //Optional，vivo manufacturer\n    implementation 'com.engagelab.plugin:vivo:4.4.0' // Here we take version 4.4.0 as an example.\n\n    // google push need, if you don’t need google channel, delete it\n    implementation 'com.google.firebase:firebase-messaging:23.2.0'\n\n    // huawei push need, if the huawei channel is not needed, delete it\n    implementation 'com.huawei.hms:push:6.11.0.300'\n    // The following dependencies of oppo need to be added. If the oppo channel is not required, delete it.\n    implementation 'com.google.code.gson:gson:2.8.9'\n    implementation 'commons-codec:commons-codec:1.13'\n    implementation 'androidx.annotation:annotation:1.1.0'\n    \n```\n- Add it to defaultConfig and fill in the corresponding information\n```\nmanifestPlaceholders = [\n                ENGAGELAB_PRIVATES_APPKEY : \"your appkey\",\n                ENGAGELAB_PRIVATES_CHANNEL: \"developer\",\n                ENGAGELAB_PRIVATES_PROCESS: \":remote\",\n                // The following manufacturers are available\n                // Xiaomi manufacturer information\n                XIAOMI_APPID            : \"\",\n                XIAOMI_APPKEY           : \"\",\n                // MEIZU manufacturer information\n                MEIZU_APPID            : \"\",\n                MEIZU_APPKEY           : \"\",\n                // OPPO manufacturer information\n                OPPO_APPID             : \"\",\n                OPPO_APPKEY            : \"\",\n                OPPO_APPSECRET         : \"\",\n                // VIVO manufacturer information\n                VIVO_APPID             : \"\",\n                VIVO_APPKEY            : \"\",\n                // Honor manufacturer information\n                HONOR_APPID            : \"\"\n        ]\n```\n- Add before code SPLITS_VERSION_CODE LAUNCHER_SOURCE_BUILD_SETUP\n```\ntask copyJsonFile {\n    copy {\n        delete(\"google-services.json\")\n        from('您的google-services.json路径')\n        into('./')\n        include(\"google-services.json\")\n    }\n\n    copy {\n        delete(\"agconnect-services.json\")\n        from('Your agconnect-services.json file path')\n        into('./')\n        include(\"agconnect-services.json\")\n    }\n\n    copy {\n        delete(\"src/main/assets/mt_engagelab_push_config\")\n        from('Your mt_engagelab_push_config file path')\n        into('src/main/assets/')\n        include(\"mt_engagelab_push_config\")\n    }\n}\npreBuild.dependsOn copyJsonFile\n```\nFor details, please refer to the launcherTemplate.gradle file under Examples\n\n\n\n#### Modify the gradleTemplate.properties file:\n\nAdd the following Code\n\n```\n// If you don’t use GOOLE manufacturer, you don’t need to add it.\nandroid.useAndroidX=true\n```\nFor details, please refer to the gradleTemplate.properties file under Examples\n\n#### Modify the LauncherManifest.xml file：\n\nAdd it under the application tag\n\n```\nandroid:name=\"com.engagelab.privates.unity.push.MTPushApplication\"\n```\n\nFor details, please refer to the LauncherManifest.xml file under Examples\n\n#### Configure the mt_engagelab_push_config file:\n\nAdd the following Code\n```\n{\n\t\"tcp_ssl\": true, // Fill in the true flag to use ssl encryption for tcp\n\t\"debug\":true,  // debug mode, true means printing debug logs\n    \"testGoogle\": true // Fill in true to test fcm, it is only used for testing. In a production environment, please set it to false or delete this item.\n}\n```\nFor details, please refer to the mt_engagelab_push_config file under Examples.\n\n\n### iOS\n##  When copying the plugin, directly keep the corresponding debugging package.\n## In the plugin iOS directory, there is the SDK package mtpush-ios-x.x.x.xcframework. There are two folders in the package.\n - \"ios-arm64\" is a real machine architecture, used for real machine running, debugging and release. Please keep this folder and delete `ios-arm64_×86_64-simulator` floder when you need to run it on a real machine.\n - \"ios-arm64_×86_64-simulator\" is the simulator architecture, used for simulator running and debugging. If you need to run the iOS simulator, please keep this folder and delete the `ios-arm64` folder. (that is, when the project configuration iOS Target SDK is specified as Simulator SDK).\n\n1. Generate an iOS project and open the project.\n2. Add necessary frameworks:\n\n   - CFNetwork.framework\n   - CoreFoundation.framework\n   - CoreTelephony.framework\n   - SystemConfiguration.framework\n   - CoreGraphics.framework\n   - Foundation.framework\n   - UIKit.framework\n   - Security.framework\n   - libz.tbd（(Xcode 7 and below versions are libz.dylib)\n   - AdSupport.framework (Required to get IDFA; don't add if you don't use IDFA)\n   - UserNotifications.framework (Xcode 8 and above)\n   - libresolv.tbd (Required for JPush 2.2.0 and above, libresolv.dylib for Xcode 7 and below)\n   - StoreKit.framework \n   - libsqlite3.tbd \n   \n      ​\n\n3. Add the header file `MTPushUnityManager.h` in UnityAppController.mm.\n\n    ```Objective-C\n   #include \u003cMTPushUnityManager.h\u003e\n   #import \u003cAdSupport/AdSupport.h\u003e// If you need to use the advertising identifier IDFA, add this header file, otherwise do not add it.\n   #import \u003cAppTrackingTransparency/AppTrackingTransparency.h\u003e// If you need to use the advertising identifier IDFA, add this header file, otherwise do not add it.\n    ```\n\n4. Add the following code in the following methods of UnityAppController.mm:\n\n    ```Objective-C\n    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    \n   \n   __block NSString *advertisingId = nil;\n   //    if (@available(iOS 14, *)) {\n   //        //设置Info.plist中 NSUserTrackingUsageDescription, Requires ad tracking permissions to target unique user identifiers\n   //        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {\n   //            if (status == ATTrackingManagerAuthorizationStatusAuthorized) {\n   //                advertisingId = [[ASIdentifierManager sharedManager] advertisingIdentifier].UUIDString;\n   //            }\n   //        }];\n   //    } else {\n   //        advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];\n   //    }\n\n    [[MTPushUnityInstnce sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions advertisingId:advertisingId];\n    \n      return YES;\n    }\n\n    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {\n      // Required.\n    [[MTPushUnityInstnce sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n    }\n    ```\n    \n5.Some Unity versions need to be modified after exporting the Xcode project:\n\n```Objective-C\n    In Preprocessor.h file,\n\n    #define UNITY_USES_REMOTE_NOTIFICATIONS 0\n    change to\n    #define UNITY_USES_REMOTE_NOTIFICATIONS 1\n```\n\n## API description\n\n[API](/Doc/CommonAPI.md)。\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevengagelab%2Fpush-unity3d-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevengagelab%2Fpush-unity3d-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevengagelab%2Fpush-unity3d-plugin/lists"}