This is an odd question, but is there any way to run two separate applications inside one app? So, for example, run another application in a view inside of another app? Is this possible? If so, how is this done?
Thanks in advance!
This may be done although it may go against the recommended way of doing things in Android
Android launch app inside view
How to create android app with app widget in single application
An easier alternative may be to launch an intent with the package address:
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setPackage("com.otherapp.package");
startActivity(i);
Launching Android app, within an app?
Launch an application from another application on Android
However, please note that, technically, the other app is still in its own process although you it appears to function within the original app.
Launch another application INSIDE an application in Android
WeChat has hundreds of Mini-Programs can only open via WeChat apps. But that mini-programs is web-based view. Here the official video
https://www.youtube.com/watch?v=OKcdUT3ZSwA .
Related
Currently, I app developing an application which uses share intent. but when I share a file to my app, my application starts another process.
Steps to reproduce.
start the application.
go to gallery/file manager.
select a file and share to the current application.
Show list applications are running.
Result:
My application starts in two different processes (Please see the screenshot)
I got the answer. It needs android:launchMode="singleTask/singleInstance" in the activity.
New here. I still didn't decide which technology I'll use to make this app, but the main feature is basically this:
There's app A and app B (I don't own any of these);
My app (C) needs only one role: when I login on app A it'll logout on app B and when I login on app B it'll logout on app A.
Note: Forcing app A or B to close will not logout or in.
Anyone knows a way to develop this? The app is supposed to be available on Android and iOS, I was planning to use nativescript.
Any help will be appreciated! Thanks,
Diogo
Unfortunately not because every app run in its specific sand box for security reasons. The only way to do something like that it is using broadcasts intents but the apps A and B should already be prepared to respond to a intent to log out and send a broadcast when log in. Probably it doesn't happen.
In iOS, this won't happen as every app is running on different sandbox and there is no relation between two sandboxes.
Thank you for all your answers. Very useful. Can I use an app to close and open others? For example, If I open Spotify it automatically closes YouTube music using my app. This way would only have to do with the smartphone or tablet.
Is it possible to launch an application within another application in Android and iOS. Something like this.
In Android - No, every app in Android runs in its own "sandbox". Only one thing you can is start another app via intent if you know the package name of the app like described in this answer. But the app will be started separatelly.
there are many applications which invokes my application in system> I want to know which app invoked my app or activity or service presently ?
Can anybody help me to solve this ?
In the starting activity of your application you can try following code to get the PackageName of the app that invokes your application.
if(getIntent().getPackage()!=null){
String packageName = getIntent().getPackage();
}
You can provide different activities to start your app, each being called by different apps. Or you can monitor user actions after app launch (navigation to screens etc) and determine which application may have launched your app. These two are relatively logical but apart from this you can monitor and look for currently running apps (look here for one possible way to do that) and then maybe determine which application launched your app.
Note that these are just strategies, not a definite answer.
I'm writing a basic application. One of the features I'm interested in trying to do is to launch another app, INSIDE the app already running.
Eg. I have an app with 3 menu options, 1 and 2 do certain tasks as part of this parent app, menu option 3 launches another app that's installed on the phone.
I'm not sure if this is possible?
This is possible with the Intents mechanism.
The exact Intent you'll have to write depend on various factors:
do you have to provide some data to the launched application?
do you target a specific application or do you want to let the user choose the application he prefers for that task (in case he has several applications able to do what you need)?
do you want to ensure that the application is available? (that would be better)
do you know if the other app provides specific intent-filters to do some tasks?
Edit:
Then, you should be able to start the second application with the following code:
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setPackage("com.otherapp.package");
startActivity(i);
Place this code in the OnClickListener of your button and that should be enough.