Implicit Intent in Android example – Kotlin

Implicit Intent is not known which app or android component is a target. You have to specifics action in intent, that can invoke any android app on the device able to perform the action. Why Implicit Intent is required? Sometimes your app can’t perform particular actions. On that time you can use implicit intent with action and other apps whose can able to this action will show to the user by android system. If there are multiple apps can able to do, then pick up option will show. This example we will write in Kotlin.

In Android, there are 2 types of Intent.

  • Implicit Intent
  • Explicit Intent

On this tutorial, you can read about all basic of about Android Intent and Types of Intent.

Note: If your app supports some action like open images then you have to implement Intent Filter in your app component.

 

Here is Some actions can do with

  • Call
  • Call Log
  • Contact
  • Browser
  • Gallery
  • Camera
  • Show alarm

And so many more action can do with Implicit Intent, you don’t need to write all app ability to do things. Some awesome specifics app already in the device to handle those actions. Like call app, there is so many call apps and Android also his own. So you don’t need to build your on calling app component, just pass the intent and let handle to another app.

Official doc (more options) : https://developer.android.com/guide/components/intents-common

 

Let’s Build an App for Implicit intent in kotlin :

In this example, we are sharing some example of Implicit intent with kotlin language.

 

Step 1. Create a new project “Build Your First Android App in Kotlin
Step 2. Add the string in res/values/strings.xml

Step 3. Open an “activity_main.xml” resource file

add buttons or add the following code

Step 4. Open an “ActivityMain.kt” class file

and add the following code

*App permission is required for some actions.

Step 5. Add Call permission in “AndroidManifest.xml

<uses-permission android:name="android.permission.CALL_PHONE" />

Step 6. Run the application, in an emulator or On your Android device

 

Output screenshot Implicit Intent kotlin example in Android :

Implicit Intent in Android example - Kotlin tutorial output

 

Video Output

Download source code Implicit Intent kotlin example

https://github.com/EyeHunts/ImplicitIntentExample

Note : This example (Project) is developed in Android Studio 3.1.3 . Tested on Android 9 ( Android-P), compile SDK version API 26: Android 8.0 (Oreo)

MinSdkVersion=”15″

TargetSdkVersion=”27″

Coding in Kotlin


2 thoughts on “Implicit Intent in Android example – Kotlin

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.