No apps can perform this action Android Intent using Kotlin

no apps can perform this action android studio
no apps can perform this action apk
tubemate no apps can perform this action
android send intent to specific app
android-intent chooser
intent android
android open another app from my app
android custom intent

I am using the following code snippets from Android official documentation to share content through applications using Intent but it says "No apps can perform this action." on a physical device. I have messengers, email client and text message clients installed.

val intent = Intent().apply {
    intent.action = Intent.ACTION_SEND
    intent.type = "text/plain"
    intent.putExtra(Intent.EXTRA_TEXT, "Text to share")
}

startActivity(Intent.createChooser(intent, "Sharing"))

This is what I know:

As Fredy Mederos said, the value that you are modified is the Activity.getIntent, not the new Intent.

You should write like this:

val intent = Intent().apply {
        action = Intent.ACTION_SEND
        type = "text/plain"
        putExtra(Intent.EXTRA_TEXT, "Text to share")
    }

or more precise:

val intent = Intent().apply {
        this.action = Intent.ACTION_SEND
        this.type = "text/plain"
        this.putExtra(Intent.EXTRA_TEXT, "Text to share")
    }

the this is pointed to your initialized new Intent().

Sending the User to Another App, Instead, you can create a request to view the address using an Intent . However, when you want to have a separate app perform an action, such as " view a map," you must Implicit intents do not declare the class name of the component to start, but instead declare an action to perform. Kotlin Java More. To create a new alarm, use the ACTION_SET_ALARM action and specify alarm details such as the time and message using extras defined below.. Note: Only the hour, minutes, and message extras are available in Android 2.3 (API level 9) and lower.

I think you should change your intent initialization with apply to this:

val intent = Intent().apply {
    action = Intent.ACTION_SEND
    type = "text/plain"
    putExtra(Intent.EXTRA_TEXT, "Text to share")
}

When you modify the intent variable inside the apply you are modifying the activity intent not the brand new intent.

copy this code and you will see what i'm talking about:

val intent_1 = Intent().apply {
    intent.action = Intent.ACTION_SEND
    intent.type = "text/plain"
    intent.putExtra(Intent.EXTRA_TEXT, "Text to share")
}

Allowing Other Apps to Start Your Activity, But if your app can perform an action that might be useful to another app, your If you do not declare it in your intent filter, no implicit intents will� Package: Calling setPackage("com.google.android.apps.maps") will ensure that the Google Maps app for Android handles the Intent. If the package isn't set, the system will determine which apps can handle the Intent. If multiple apps are available, the user may be asked which app they would like to use.

The following code works instead of above posted in the question.

val i = Intent(Intent.ACTION_SEND)
i.type = "text/plain"
i.putExtra(Intent.EXTRA_TEXT, "Content to share")
startActivity(Intent.createChooser(i, "Sharing"))

I am not sure why the code in the question does not work but my guess is that intent is related to the activity's intent and it works when I instantiated another object from Intent class.

Android Intents with Kotlin - DEV, The idea of using intents is not having to build an individual activity or another app to perform an action, you can pass the intent and let another� How to create Android apps in Kotlin. In particular, work with the Android SDK. How to architect apps using the Architecture Components and data binding. A basic understanding of BroadcastReceivers; A basic understanding of AlarmManager; What you'll learn. How to create, style, and send a notification. How to cancel notifications.

you can replace startActivity(Intent.createChooser(i, "Sharing")) by startActivity(i)

Android Intents Tutorial with Kotlin, This will identify your intent when it returns — you'll learn a bit Add the following just below onClick() , along with any necessary imports: that can be performed by your app sometime in the future. An action is simply a string constant describing what is being accomplished. If your app can perform an action that might be useful from another app, your app should be prepared to respond to action requests by specifying the appropriate intent filter in your activity. For example, if you build a social app that can share messages or photos with the user's friends, you should support the ACTION_SEND intent.

Kotlin Android Explicit Intent, Kotlin Android Explicit Intent with introduction, architecture, class, object, Android Intent is a messaging object used to request another app component to perform an action. Implicit Intent: This intent does not specify the component name. Example of Android GridView Using Kotlin. Now, we will use android gridView widget in android application. We will see how to use ArrayAdapter or BaseAdapter with gridView using kotlin. At first, we will create an android application. 1. Creating New Project in Kotlin. Follow steps below to create new project.

Google Maps Intents for Android | Maps URLs, The Google Maps app for Android exposes several intents that you can use to launch Intents let you start an activity in another app by describing a simple action you'd like to perform Java Kotlin More If the result is null, you should not use the intent and, if possible, you should disable the feature that invokes the intent. In Android, a button respresent something that can be clicked by the user to perform some action. Firstly, we need to create a project in Android Studio. To do follow these steps: Click on File, then New and then New Project and give name whatever you like: Click on File, then New and then New Project and give name whatever you like

Why Start Android Share Intent With Chooser?, You can specify chooser title; Will always show chooser dialog even when a default app is selected; If no app is available to handle the intent, if will show No application can perform this action message (instead of Android Check Intent Can Be Handled Before StartActivity (Kotlin) � Android Send Email� Hello Readers! In this post, we are going to learn about android floating action button using kotlin in any android application. We will also learn about different attributes of android floating action button that can be used to customise this widget.

Comments
  • "in Kotlin" did it work in Java?
  • Accepted this answer for pointing out the this keyword which refers to initialized intent.
  • I tried this before but it didn’t work. The reason could be setting content on the activity intent in apply block not the on newly created
  • Can you explain why that should be neccessary?
  • developer.android.com/training/basics/intents/sending before use createChooser please Verify the intent will resolve to at least one activity if (intent.resolveActivity(packageManager) != null) { startActivity(chooser) }