{"id":18698683,"url":"https://github.com/macacagames/macacaapi","last_synced_at":"2026-01-08T12:01:52.298Z","repository":{"id":62253713,"uuid":"329261945","full_name":"MacacaGames/MacacaAPI","owner":"MacacaGames","description":"Macaca API helps you to using mobile native library easier on iOS and Android such as Toast, Dialog, RateUsDialog, Vibration, ShareDialog.","archived":false,"fork":false,"pushed_at":"2024-05-29T07:00:38.000Z","size":4751,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-04T18:52:33.913Z","etag":null,"topics":["android","ios","unity-native-plugin","unity3d","unity3d-plugin"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MacacaGames.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-01-13T09:49:22.000Z","updated_at":"2024-07-31T03:11:33.000Z","dependencies_parsed_at":"2024-11-07T11:33:20.454Z","dependency_job_id":"edc27f45-62a0-43f5-a7e9-8dfa00a1b1e4","html_url":"https://github.com/MacacaGames/MacacaAPI","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacacaGames%2FMacacaAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacacaGames%2FMacacaAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacacaGames%2FMacacaAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacacaGames%2FMacacaAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MacacaGames","download_url":"https://codeload.github.com/MacacaGames/MacacaAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223331,"owners_count":20743167,"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":["android","ios","unity-native-plugin","unity3d","unity3d-plugin"],"created_at":"2024-11-07T11:29:23.686Z","updated_at":"2026-01-08T12:01:47.255Z","avatar_url":"https://github.com/MacacaGames.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome to MacacaAPI\n\nSee [Document](https://macacagames.github.io/MacacaAPI/) for more detail.\n\nMacaca API is a mobile native library for iOS and Android.\n\n\n## Feature\n- Native share (text, image, video, gif)\n- Native Dialog (with callback)\n- Native DatePicker\n- Rate Us Dialog\n- Vibration\n- Toast\n- Runtime Permission (Android Only)\n\n## System Requirement\niOS 10 or later\n\nAndroid 4.4 or later\n\n### This package require [External Dependency Manager](https://github.com/googlesamples/unity-jar-resolver) to make sure native dependency is resolve correctlly.\n  \n## Installation\n### Option 1: Installation via OpenUPM (Recommend)\n\n```sh\nopenupm add com.macacagames.macacaapi\n```\n### Option 2: Unity Package file\nAdd it to your editor's `manifest.json` file like this:\n```json\n    {\n    \"dependencies\": {\n        \"com.macacagames.macacaapi\": \"https://github.com/MacacaGames/MacacaAPI.git\",\n    }\n}\n```\n\n## Example\n\n- Import MacacaAPI \n- open the sence file in Test folder. (Test.unity)\n- Build and Run!\n\n## For Android User\n\nAndroid Native Shard require one more step to complete.\n\nModify your AndroidManifest.xml in Plugins/Android folder and add this in \u003capplicatoin\u003e block\n\nRemember replace the ``{your authorities}`` into your Package name. (usually looks like com.xxxx.yyy)\n```xml\n  \u003cprovider\n    android:name=\"com.CloudMacaca.AndroidNative.UnityShareContentProvider\"\n    android:authorities=\"{your authorities}\"\n    android:exported=\"false\"\n    android:grantUriPermissions=\"true\" /\u003e\n```\n\n\n## Usage\n\nFull example code in [CloudMacacaAPITest](https://github.com/MacacaGames/MacacaAPI/blob/master/Test/CloudMacacaAPITest.cs)\n\n\n### Show Toast Message\n```csharp\nCM_APIController.ShowToastMessage(\"Hello World\");\n```\n\n### Vibration\n```csharp\n    // The haptic engine pop vibrate\n    CM_APIController.VibrationAsPop();\n\n    // The haptic engine Peek vibrate\n    CM_APIController.VibrationAsPeek();\n\n    // The haptic engine Nope vibrate\n    CM_APIController.VibrationAsNope();\n\n    // Vibrate device in milesecond (Android only)\n    CM_APIController.Vibration(1000);\n```\n\n### Dialogs\n```csharp\n    // Show rate us\n    CM_APIController.ShowRateUsDialog();\n\n    // Show a system dialog\n    CM_APIController.ShowAlertDialog(\n        \"title\",\n        \"msg\",\n        \"Ok\",\n        \"No\",\n        new CMDialogCallback(\n            () =\u003e\n            {\n                CM_APIController.ShowToastMessage(\"Positive\");\n            },\n            () =\u003e\n            {\n                CM_APIController.ShowToastMessage(\"Negative\");\n            }\n        )\n    );\n\n    // Show System datetime picker\n    CM_APIController.ShowDatePickerWithCallback(\n            \"Ok\",\n            \"No\",\n            new CMDatePickerCallback(\n                (date) =\u003e\n                {\n                    CM_APIController.ShowToastMessage(date);\n                }\n            )\n        );\n```\n\n### Share \nFor share MacacaAPI only helps you to call a native share UI.\nyou need to make the screenshot, gif, video yourself in Unity3D and save to a readable path.\n(Usually  Application.persistentDataPath )\n\nA sample to share a Screenshot\n```csharp\n    public string ScreenshotName = \"screenshot.png\";\n\n    public void ShareScreenshotWithText(string text)\n    {\n        string screenShotPath = Application.persistentDataPath + \"/\" + ScreenshotName;\n        if (File.Exists(screenShotPath)) File.Delete(screenShotPath);\n\n        ScreenCapture.CaptureScreenshot(ScreenshotName);\n        StartCoroutine(delayedShare(screenShotPath, text));\n    }\n\n    //CaptureScreenshot runs asynchronously, so you'll need to either capture the screenshot early and wait a fixed time\n    //for it to save, or set a unique image name and check if the file has been created yet before sharing.\n    IEnumerator delayedShare(string screenShotPath, string text)\n    {\n        while (!File.Exists(screenShotPath))\n        {\n            yield return new WaitForSeconds(.05f);\n        }\n        CM_APIController.Share(screenShotPath, text, text, CM_APIController.ShareType.Image);\n\n        //CM_APIController.Share(text, screenShotPath, \"\", \"\", \"image/png\", true, \"\");\n    }\n```\n\nTo share text message\n\n```csharp\n        CM_APIController.Share(\"title\",\"content\");\n```\n\n\n### Android Runtime Permission \n\n```csharp\n    // Request a permission\n    CM_APIController.RequestPermission(CM_APIController.AndroidPermission.WRITE_EXTERNAL_STORAGE);\n\n    // Check a permission state\n    AndroidPermissionState result = CM_APIController. CheckPermissionState(CM_APIController.AndroidPermission.WRITE_EXTERNAL_STORAGE);\n\n    // Check app have a Permission or not\n    bool result = CM_APIController.CheckPermission(CM_APIController.AndroidPermission.WRITE_EXTERNAL_STORAGE);\n```\n\nmore in  [Document](https://macacagames.github.io/MacacaAPI/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacacagames%2Fmacacaapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacacagames%2Fmacacaapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacacagames%2Fmacacaapi/lists"}