{"id":16382533,"url":"https://github.com/daadu/receive_intent","last_synced_at":"2025-03-21T01:32:40.698Z","repository":{"id":39886589,"uuid":"345044962","full_name":"daadu/receive_intent","owner":"daadu","description":"Flutter plugin for passing Android Intents to the Flutter environment.","archived":false,"fork":false,"pushed_at":"2025-02-18T08:47:20.000Z","size":140,"stargazers_count":15,"open_issues_count":13,"forks_count":27,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T01:41:37.976Z","etag":null,"topics":["android-intent","flutter","flutter-plugin","hacktoberfest"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/receive_intent","language":"Kotlin","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/daadu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-03-06T08:34:33.000Z","updated_at":"2025-02-23T08:50:29.000Z","dependencies_parsed_at":"2023-12-21T08:19:41.989Z","dependency_job_id":"29823422-66d7-4433-ba38-c85407ea1a12","html_url":"https://github.com/daadu/receive_intent","commit_stats":{"total_commits":58,"total_committers":6,"mean_commits":9.666666666666666,"dds":0.5,"last_synced_commit":"5950356e8da7e706ceb672d8096960adba39d912"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daadu%2Freceive_intent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daadu%2Freceive_intent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daadu%2Freceive_intent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daadu%2Freceive_intent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daadu","download_url":"https://codeload.github.com/daadu/receive_intent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102712,"owners_count":20398386,"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-intent","flutter","flutter-plugin","hacktoberfest"],"created_at":"2024-10-11T04:05:41.241Z","updated_at":"2025-03-21T01:32:40.690Z","avatar_url":"https://github.com/daadu.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# receive_intent\n\n\u003cp\u003e\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n\u003ca href=\"#contributors-\"\u003e\u003cimg src=\"https://img.shields.io/badge/all_contributors-8-orange.svg\" alt=\"All Contributors\" /\u003e\u003c/a\u003e\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\u003ca href=\"https://pub.dev/packages/receive_intent\"\u003e\u003cimg src=\"https://img.shields.io/pub/v/receive_intent?logo=dart\" alt=\"pub.dev\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daadu/receive_intent/actions?query=workflow%3Aanalysis\"\u003e\u003cimg src=\"https://github.com/daadu/receive_intent/workflows/analysis/badge.svg\" alt=\"analysis\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pub.dev/packages/receive_intent/score\"\u003e\u003cimg src=\"https://img.shields.io/pub/points/receive_intent?logo=dart\" alt=\"pub points\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pub.dev/packages/receive_intent/score\"\u003e\u003cimg src=\"https://img.shields.io/pub/popularity/receive_intent?logo=dart\" alt=\"popularity\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pub.dev/packages/receive_intent/score\"\u003e\u003cimg src=\"https://img.shields.io/pub/likes/receive_intent?logo=dart\" alt=\"likes\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daadu/receive_intent/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/daadu/receive_intent?logo=github\" alt=\"GitHub issues\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daadu/receive_intent/milestone/1\"\u003e\u003cimg src=\"https://img.shields.io/github/milestones/progress-percent/daadu/receive_intent/1?logo=github\" alt=\"GitHub milestone\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daadu/receive_intent/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/daadu/receive_intent?logo=github\" alt=\"GitHub stars\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daadu/receive_intent/network\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/daadu/receive_intent?logo=github\" alt=\"GitHub forks\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nA Flutter plugin to pass Android Intents to the Flutter environment.\n\n`Intent` in Android is the \"payload\" for the communication between and within apps. This plugin passes the `Intent`, that \"started\"  the `Activity` to the flutter environment. It also passes any \"new Intents\" that are received (via [`Activity.onNewIntent`](https://developer.android.com/reference/android/app/Activity#onNewIntent(android.content.Intent))) while the `Activity` is already \"started\".\n\nIf the `Intent` was \"started\" via `startActivityForResult`, then this plugin also sends additional information (package name and app signature) about the \"calling\" Android Component, and can send \"result\" back (via [`Activity.setResult`](https://developer.android.com/reference/android/app/Activity#setResult(int))) to it.\n\nThis plugin is in active development.\n___Any contribution, idea, criticism or feedback is welcomed.___\n\n## Quick links\n| | |\n|-|-|\n| __package__ | https://pub.dev/packages/receive_intent |\n| __Git Repo__  | https://github.com/daadu/receive_intent |\n| __Issue Tracker__ | https://github.com/daadu/receive_intent/issues |\n\n\n## Use cases\n- [OAuth based App Flip](https://developers.google.com/identity/account-linking/app-flip-overview) - This was the initial motivation for this plugin. The plugin can be used to pass the `Intent` sent by Google App to the flutter environment - where the consent UI is shown - once it is authorized (or not), the result is sent back to the Google App.\n- Deeplink/Applink - This plugin is a generic implementation of [uni_links](https://pub.dev/packages/uni_links) plugin. While this plugin passes \"any\" Intents, `uni_links` only passes app-link/deep-link Intents.\n- Receive Share Intents - This plugin is a generic implementation of [receive_sharing_intent](https://pub.dev/packages/receive_sharing_intent) plugin. While this plugin passes \"any\" Intents, `receive_sharing_intent` only passes \"android.intent.action.SEND\" (or related) Intents.\n- In general, if you want other apps to \"start\" your app, then this plugin can pass the `Intent` that \"triggered\" it to the flutter environment of the app. These `Intent` will give the app understanding of why the app was started. Check [Getting started](#getting-started) section to implement this.\n\n## Getting started\n#### Add `\u003cintent-filter\u003e` to `AndroidMainfest.xml`\nYou need to add `\u003cintent-filter\u003e` to `android/app/src/main/AndroidManifest.xml` file:\n```xml\n\u003cmanifest ...\u003e\n  \u003c!-- ... other tags --\u003e\n  \u003capplication ...\u003e\n    \u003cactivity ...\u003e\n      \u003c!-- ... other tags --\u003e\n      \n      \u003c!-- Describe Intent your app can receive with \u003cintent-filter\u003e  --\u003e\n      \u003cintent-filter\u003e\n        \u003caction android:name=\"RECEIVE_INTENT_EXAMPLE_ACTION\" /\u003e\n        \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n      \u003c/intent-filter\u003e\n    \u003c/activity\u003e\n  \u003c/application\u003e\n\u003c/manifest\u003e\n```\nIn this example we want to receive Intent with `action` matching `RECEIVE_INTENT_EXAMPLE_ACTION` literal. This `\u003cintent-filter\u003e` should be added to the `Activity` that extends `FlutterActivity` (for project generated from template it is `MainActivity`). \n\n`\u003cintent-filter\u003e` describes, what `Intent` the `Activity` is capable to recevie. To read more about \"Intent and Intent Filter\", encourage you to check [official docs](https://developer.android.com/guide/components/intents-filters) from Android. \n#### Recevie and handle Intent that launched the Activity in Flutter\nInside flutter code, you can call `ReceiveIntent.getInitialIntent()` to get the `Intent` that started the `Activity`:\n```dart\nimport 'package:receive_intent/receive_intent.dart';\n// ...\n\n  Future\u003cvoid\u003e _initReceiveIntent() async {\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      final receivedIntent = await ReceiveIntent.getInitialIntent();\n      // Validate receivedIntent and warn the user, if it is not correct,\n      // but keep in mind it could be `null` or \"empty\"(`receivedIntent.isNull`).\n    } on PlatformException {\n      // Handle exception\n    }\n  }\n  \n// ...\n```\n#### Listen for any new Intent while the Activity is already running\nTo listen to new `Intent` while the `Activity` is running, you can use the `ReceiveIntent.receivedIntentStream` stream:\n```dart\nimport 'package:receive_intent/receive_intent.dart';\n// ...\n  StreamSubscription _sub;\n  \n  Future\u003cvoid\u003e _initReceiveIntentit() async {\n    // ... check initialIntent\n\n    // Attach a listener to the stream\n    _sub = ReceiveIntent.receivedIntentStream.listen((Intent? intent) {\n      // Validate receivedIntent and warn the user, if it is not correct,\n    }, onError: (err) {\n      // Handle exception\n    });\n\n    // NOTE: Don't forget to call _sub.cancel() in dispose()\n  }\n// ...\n```\n#### Send result to the calling Activity (Optional)\nIf the calling `Activty` has \"started\" this activity with `startActivityWithResult` then you can send back result to that activity when ready with `ReceiveIntent.setResult`:\n```dart\nimport 'package:receive_intent/receive_intent.dart';\n// ...\n\n  Future\u003cvoid\u003e _setActivityResult() async {\n    // ...\n    await ReceiveIntent.setResult(kActivityResultOk, data: {\"sum\": 123})\n  }\n// ...\n```\nTo read more about \"Starting Activities and Getting Results\" pattern, encourage you to check [official docs](https://developer.android.com/reference/android/app/Activity#starting-activities-and-getting-results) from Android.\n\nAdditionaly, in the case of activity started with `startActivityWithResult`, the `Intent` object will also have package name (`intent.fromPackageName`) and app signautres (`intent.fromSignatures`) of the calling activity. This could be used to validate the calling app, so that sensitive information is not given to unintendent apps.\n#### Tools to test it\nYou can test this with either [`adb`](https://developer.android.com/studio/command-line/adb) or [Intent Test](https://play.google.com/store/apps/details?id=com.applauncher.applauncher) app form Playstore.\n##### adb\nTo invoke (start) our `FlutterAcitivity` with `RECEIVE_INTENT_EXAMPLE_ACTION`  intent action name as mentioned in example `\u003cintent-filter\u003e` [above](#add-intent-filter-to-AndroidMainfest.xml):\n```sh\nadb shell 'am start -W -a RECEIVE_INTENT_EXAMPLE_ACTION -c android.intent.category.DEFAULT'\n```\nIf you don't have  [`adb`](https://developer.android.com/studio/command-line/adb)  in your path, but have  `$ANDROID_HOME`  env variable then use  `\"$ANDROID_HOME\"/platform-tools/adb ...`.\n\nNote: Alternatively you could simply enter an  `adb shell`  and run the  [`am`](https://developer.android.com/studio/command-line/adb#am)  commands in it.\n\n#### Check example app\nTo know more or to get the working code check the [example app](https://github.com/daadu/receive_intent/tree/master/example).\n\n## Todo\n- Document API references properly\n- Receive Intent for non-`Activity` based `intent-filter` (`BroadcastReceiver`, `Service`)\n- Automatic testing\n\n## Contribute\nCheck the [Todo](#todo) section above, before you begin with any contribution.\n\n1. You'll need a GitHub account.\n2. Fork the [repository](https://github.com/daadu/receive_intent).\n3. Pick an issue to work on from [issue tracker](https://github.com/daadu/receive_intent/issues).\n4. Implement it.\n5. Add your name and email in `authors` section in `pubspec.yaml` file.\n6. Send merge request.\n7. Star this project.\n8. Become a hero!!\n\n## Features and bugs\nPlease file feature requests and bugs at the [issue tracker](https://github.com/daadu/receive_intent/issues).\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://bhikadia.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4963236?v=4?s=100\" width=\"100px;\" alt=\"Harsh Bhikadia\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eHarsh Bhikadia\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-daadu\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/daadu/receive_intent/commits?author=daadu\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://the.lastgimbus.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/40139196?v=4?s=100\" width=\"100px;\" alt=\"Mateusz Soszyński\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMateusz Soszyński\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/commits?author=TheLastGimbus\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/luckyrat\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1211375?v=4?s=100\" width=\"100px;\" alt=\"Chris Tomlinson\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eChris Tomlinson\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/commits?author=luckyrat\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/eric-nextsense\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/78733538?v=4?s=100\" width=\"100px;\" alt=\"eric-nextsense\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eeric-nextsense\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/issues?q=author%3Aeric-nextsense\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/daadu/receive_intent/commits?author=eric-nextsense\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/tneotia\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/50850142?v=4?s=100\" width=\"100px;\" alt=\"Tanay Neotia\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTanay Neotia\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/issues?q=author%3Atneotia\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/daadu/receive_intent/commits?author=tneotia\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://stack11.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/564501?v=4?s=100\" width=\"100px;\" alt=\"Geert-Johan Riemer\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGeert-Johan Riemer\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/commits?author=GeertJohan\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/derrickgw\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/26449929?v=4?s=100\" width=\"100px;\" alt=\"Derrick Gibelyou\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDerrick Gibelyou\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/commits?author=derrickgw\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/nacuta\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3910139?v=4?s=100\" width=\"100px;\" alt=\"Nacuta Claudiu\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNacuta Claudiu\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/daadu/receive_intent/issues?q=author%3Anacuta\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaadu%2Freceive_intent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaadu%2Freceive_intent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaadu%2Freceive_intent/lists"}