Questions tagged [explicit-intent]

An explicit intent is one that you use to launch a specific app component, such as a particular activity or service in your app. To create an explicit intent, define the component name for the Intent object—all other intent properties are optional.

From the official Android documentation :

An explicit intent is one that you use to launch a specific app component, such as a particular activity or service in your app. To create an explicit intent, define the component name for the Intent object—all other intent properties are optional.

For example, if you built a service in your app, named DownloadService, designed to download a file from the web, you can start it with the following code:

// Executed in an Activity, so 'this' is the Context
// The fileUrl is a string URL, such as "http://www.example.com/image.png"
Intent downloadIntent = new Intent(this, DownloadService.class);
downloadIntent.setData(Uri.parse(fileUrl));
startService(downloadIntent);

The Intent(Context, Class) constructor supplies the app Context and the component a Class object. As such, this intent explicitly starts the DownloadService class in the app.

19 questions
78
votes
9 answers

Android implicit intents VS explicit intents

Working with android I realized that implicit intents are good choice in most of cases due to their's flexibility. But what's about explicit intents? What are benefits of using them? What are common cases when it's a good practice to use them?
39
votes
7 answers

What is the different between Explicit and implicit activity call in android?

What is the difference between explicit and implicit activity call in android? If you explain the answer with a simple example will be good.
Adham
  • 63,550
  • 98
  • 229
  • 344
19
votes
7 answers

Can any one tell me how to open another app using flutter?

I want to open a bunch of music app links using links data I have in firebase. I want to open, amazonPrimeMusic, Ganna, Spotify, Wynk, JioSavaan to name some. Widget buildResultCard(data) { List items = [Text(data['Ganna']), …
Lokesh Karki
  • 515
  • 1
  • 3
  • 9
3
votes
1 answer

What is difference between "setComponent" and "setClassName" in sending an intent?

From my own Android app, I'm trying to launch an external app's component explicitly. Intent i = new Intent(); Uri uri = Uri.parse("http://0.0.0.1"); i.setData(uri); i.setComponent(new…
Youn Kyu Lee
  • 123
  • 2
  • 6
3
votes
1 answer

Starting an activity in a different application using explicit intents

I have written two different applications, we'll call them AppA and AppB. I am trying to start an activity in AppA from AppB using an intent. I am trying to accomplish this with an explicit intent. In AppB, I create the intent like this: …
CoffeeSaurus
  • 105
  • 1
  • 11
2
votes
2 answers

open specific Activity from command line

I'm trying to start a specific Activity from command line. I'm building the app for Android O (api 26), and i try to explicitly start that activity to simulate a deeplink the activity manifest
1
vote
2 answers

Unable to find explicit activity class, even when i declare the intent in the manifest

I have an activity which I declare in my manifest:
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
1
vote
2 answers

Aplication crashes pressing back button (Explicit Intent passing information)

I have simple app which sum up two numbers and result appears in Second Activity. The Main Activity takes care of two values and Sum button. When the Sum button is pressed, the second Activity launches, shows the result and has back button. Once the…
1
vote
1 answer

Is it mandatory to use "addFlags" in order to launch other app's component explicitly?

Using my Android app, I'm trying to launch an external app's component explicitly. ComponentName name = new ComponentName("other.app.android", "other.app.android.Activity1"); Uri uri = Uri.parse("http://127.0.0.1:8111"); Intent abc = new…
user3491319
  • 289
  • 1
  • 3
  • 7
1
vote
1 answer

intents do not go to expected activity and resume unexpected one

I'm sorry for the title, I can't find a better way to describe my problem briefly. Here is my scenario. There are two apps, A and B. App A has one activity A1, and app B has three activities B1, B2 and B3. Activity B1 is transparent and works as a…
hixhix
  • 771
  • 7
  • 23
1
vote
1 answer

Service must be explicit when opening Activity having map: Android lollipop(5.0)

I have google map displayed in a FragmentActitvity which implements And to open this activity I am start an intent from another activity(let's say Activity A) on click of a button. button.setOnClickListener(new View.OnClickListener() { …
0
votes
1 answer

Activity intent child doesn't return data to parent, toast is not shown

Greetings fellow programmers, I have been having some issues with understanding why my child's intent doesn't return the proper value to my parent's intent properly. private static final int REQUEST_CODE_CHEAT = 0; Now here is how I call my…
tsourtzis
  • 40
  • 6
0
votes
1 answer

Throws in a NullPointerException when using a getStringExtra in MainActivity

I am currently learning explicit intents and I have followed the coding which was instructed and it always returns a NullPointerException. This is the code where I enter the data to return to the MainActivity: if…
0
votes
1 answer

Share application link and apk file in android

I Make a button for both apk and link share link share is working fine but when app will be share the apk name is changed to "untitled" i want the same name as my apk name my code for link btnShare.setOnClickListener(new View.OnClickListener() { …
0
votes
1 answer

Android BackGround service not works in Lollipop using start service

I have an android app service for pushing notification which run in the background. It invokes the intent using startService(); It works fine in pre-versions but it does not work on lollipop. I am not aware of Why it is not works (Because service…
1
2