Interagire con altre app
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
In genere, un'app per Android ha diverse attività. Ogni attività mostra un'interfaccia utente che consente all'utente di eseguire un'attività specifica, come visualizzare una mappa o scattare una foto.
Per portare l'utente da un'attività a un'altra, la tua app deve utilizzare un Intent
per definire l'"intenzione" dell'app di fare qualcosa. Quando passi un elemento Intent
al sistema con un metodo come startActivity()
, il sistema utilizza Intent
per identificare e avviare il componente dell'app appropriato. L'uso di intent consente alla tua app di avviare un'attività contenuta in un'app separata.
Intent
può essere esplicito, per avviare un'istanza Activity
specifica, oppure implicito, per avviare qualsiasi componente in grado di gestire l'azione prevista, ad esempio "cattura una foto".
Gli argomenti di questa guida mostrano come utilizzare Intent
per eseguire alcune interazioni di base con altre app, ad esempio avviare un'altra app, ricevere un risultato da quell'app e rendere la tua app in grado di rispondere agli intent di altre app.
Argomenti
- Inviare l'utente a un'altra app
- Mostra come creare intent impliciti per avviare altre app che possono eseguire un'azione.
- Ottenere un risultato da un'attività
- Ti mostra come iniziare un'altra attività e ricevere un risultato dall'attività.
- Consentire ad altre app di iniziare la tua attività
- Ti mostra come rendere aperte le attività nella tua app per l'uso da parte di altre app definendo
filtri intent che dichiarano gli intent impliciti accettati dalla tua app.
- Filtro della visibilità dei pacchetti su Android
- Mostra come rendere visibili alla tua app altre app se non sono visibili per impostazione predefinita. Si applica solo alle app destinate ad Android 11 (livello API 30) o versioni successive.
- Soddisfare i casi d'uso comuni con una visibilità dei pacchetti limitata
- Mostra diversi tipi di interazioni con l'app che potrebbero richiedere l'aggiornamento
del file manifest dell'app in modo che altre app siano visibili.
Si applica solo alle app destinate ad Android 11 (livello API 30) o versioni successive.
- Limitare il caricamento nei contenitori Android on-device
- Mostra come limitare il caricamento dell'app Play Store in un'app simulata in ambiente Android, nota anche come contenitore Android on-device.
Per ulteriori informazioni sugli argomenti in questa pagina, vedi quanto segue:
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-02-10 UTC.
[null,null,["Ultimo aggiornamento 2025-02-10 UTC."],[],[],null,["# Interact with other apps\n\nAn Android app typically has several [activities](/guide/components/activities). Each activity displays a\nuser interface that lets the user perform a specific task, such as viewing a map or taking a photo.\nTo take the user from one activity to another, your app must use an [Intent](/reference/android/content/Intent) to define your app's \"intent\" to do something. When you pass an\n`Intent` to the system with a method\nsuch as [startActivity()](/reference/android/app/Activity#startActivity(android.content.Intent)),\nthe system uses the `Intent` to identify and start the appropriate app component. Using intents\neven lets your app start an activity that is contained in a separate app.\n\nAn `Intent` can be *explicit* , to start\na specific [Activity](/reference/android/app/Activity) instance,\nor *implicit*, to start any\ncomponent that can handle the intended action, such as \"capture a photo.\"\n\nThe topics in this guide show you how to use an `Intent` to perform some basic\ninteractions with other apps, such as starting another app, receiving a result from that app, and\nmaking your app able to respond to intents from other apps.\n\nTopics\n------\n\n**[Sending the user to another app](/training/basics/intents/sending)**\n: Shows you how to create implicit intents to launch other apps that can perform an\n action.\n\n**[Get a result from an activity](/training/basics/intents/result)**\n: Shows you how to start another activity and receive a result from the activity.\n\n**[Allow other apps to start your activity](/training/basics/intents/filters)**\n: Shows you how to make activities in your app open for use by other apps by defining\n intent filters that declare the implicit intents your app accepts.\n\n**[Package visibility filtering on Android](/training/basics/intents/package-visibility)**\n: Shows you how to make other apps visible to your app if they\n aren't visible by default. Applies only to apps that target Android 11\n (API level 30) or higher.\n\n**[Fulfill common use cases while\nhaving limited package visibility](/training/basics/intents/package-visibility-use-cases)**\n: Shows several types of app interactions that might require you to update\n your app's manifest file so that other apps are visible to your app.\n Applies only to apps that target Android 11 (API level 30) or higher.\n\n**[Limit loading in on-device Android containers](/training/basics/intents/limit-play-loading)**\n: Shows you how to limit your Play Store app from loading in a simulated\n Android environment app, also known as an on-device Android container.\n\nFor additional information about the topics on this page, see the following:\n\n- [Sharing simple data](/training/sharing)\n- [Sharing files](/training/secure-file-sharing)\n- [Integrating Application with Intents](http://android-developers.blogspot.com/2009/11/integrating-application-with-intents.html) blog post\n- [Intents and Intent\n Filters](/guide/components/intents-filters)"]]