Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] java – How do I launch a specific (explicit) activity of another app

Posted on November 14, 2022

Solution 1 :

Try this:

Intent intent = new Intent();
intent.setClassName("com.pas.webcam.pro", "com.pas.webcam.Rolling");
startActivity(intent);

Since you refer to the app as “IP webcam pro”, I’m assuming the package name is “com.pas.webcam.pro” (found by Internet research).

Problem :

I want to launch a specific activity of another app from my app. For example, on the onCreate of my app, I want to launch the activity named Rolling (not main) activity of com.pas.webcam.pro. I have heard that you must have control of both apps to do this because you must add an intent filter to the manifest of the second app. This is not true though, because activity launcher apps in the Google Play Store can launch the Rolling Activity of IP Webcam Pro.

The Activity Launcher app is open source, so I tried reviewing the source code here. It was too complicated though, so I could not figure out how this app magically launches this activity. There are many other questions like this on Stack Overflow, and I have read every one. I have also tried lots of the code from the answers too, like this:

Intent intent = new Intent(); intent.setComponent(new ComponentName("com.pas.webcam", "com.pas.webcam.RollingActivity")); startActivity(intent);

I have also tried variants of this code from other posts. My app always crashes and I get variants (depending on the code I use) of the following error:

An error occurred

Invalid intent operation. Unable to find explicit activity class {com.pas.webcam.pro/com.pas.webcam.pro.Rolling}; have you declared this activity in your AndroidManifest.xml?

I have put both of the following in my Android Manifest and the same thing happens:

<uses-permission android_name="android.permission.GET_INSTALLED_PACKAGES" />

<activity android_name="com.pas.webcam.pro.RollingActivity"

Thanks in advance for any answers, I really appreciate it, as I have been working on this problem for a while.

READ  [ANSWERED] android room - How do I properly use Flow.onStart {} to re-fetch cached content?
Powered by Inline Related Posts

Edit: Here is the activity of the app I want to launch: https://i.stack.imgur.com/Fa7Xq.jpg

Edit: David Wasser helped me solve the problem by giving me the code neccessary to solve the problem. It actually works! To anyone who wants to launch a specific activity of another app with code, please use this:

Intent intent = new Intent(); intent.setClassName("com.pas.webcam.pro", "com.pas.webcam.Rolling"); startActivity(intent);

You may replace com.pas.webcam.pro and Rolling with the app and activity of your choice, but this method truly works. Problem Solved!

Comments

Comment posted by David Wasser

You need to know the exact package name and the exact class name of the

Comment posted by Richard Browning

Thanks for your comment , but I do know the package name of the app I want to launch. It is com.pas.webcam.pro. The activity or class I want to launch is RollingActivity or simply Rolling. This activity can be launched by a third party app, because the Activity Launcher app in the Play Store can launch this specific, as well as any, activity. So are you saying I need to add something to the manifest of my app? Because I am pretty sure my code is fine. Thanks.

Comment posted by David Wasser

You don’t need anything in your manifest. You need to know the exact package name of the other app (this is in the other app’s manifest) and you need to know the exact fully qualified class name of the

Comment posted by David Wasser

If you don’t have the manifest (or APK) of the other app, there are ways to get this information using

READ  [ANSWERED] java - Issue with setupActionBarWithNavController in Kotlin
Powered by Inline Related Posts

Comment posted by Richard Browning

I am absolutely 100% positive the CORRECT package name is com.pas.webcam.pro. The name of the activity is DEFINITELY Rolling. com.pas.webcam.pro.Rolling is DEFINITELY CORRECT. I do not need to query the Package Manager. I already have the package name and activity to launch. If you are sure I do not have to add anything to the Manifest, which I think is correct, what am i doing wrong? Is my code bad? How do I launch this activity of this package? Thanks.

Comment posted by Richard Browning

Wow! I have been searching for weeks for a solution. I have probably tried 10 different types of code. Yet this short easy line of code works. Thank you, thank you so much. Yes, the package name is com.pas.webcam.pro. I knew that. You are correct. Again, THANK YOU. IT WORKS. Woohoo.

Comment posted by David Wasser

Glad this solved your problem. You can accept my answer by clicking the green checkmark next to the answer. This will remove the question from the list of open questions and perhaps help others with a similar problem.

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress