How can I start one App from another in android - android

I am a beginner in android , how can I start one app from inside another in android
like when I click on one button and I have to start activity of another app

You can start another app from you application using intent but you need to know its main activity name or at least that applications package name , in the following example it uses another apps package name to start
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);

Related

Integrating Multi Projects into single app

I have three existing apps. Now i want to combine all the three into single app.
Say i have three button, when i click button 1 then app 1 should run. And when
button 2 is clicked app 2 should run. Is it possible in android studio? have
have tried searching but nothing helped.
From this SO start application knowing package name. Just use these two lines you can launch any installed application whose package name is known:
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.example.abc");
startActivity( LaunchIntent );
for the unknown package name
PackageManager pm;
pm = getPackageManager();
// get a list of installed apps.
packages = pm.getInstalledApplications(0);
I'm going to preface this by saying I do not have any experience with Android Studio. Hopefully it bears some resemblance with its terribly simplified counterpart App Inventor.
Anywho, I would create an independent main screen (activity?) that has 3 buttons on it and paste the three existing apps' code into other screens in the same app. Each button would open its corresponding screen/app through opening a new activity.
Got the solution. I just converted the three applications to library and imported them into the main app. Now i can call any activity from any of the three app any time as required. While using package manage all the three apps would have to be installed separately. Thank you coder and himty for sparing some time to answer my question. But still i have a problem. I am actually working on watch faces. Even though i can launch any activity, i still can't change the watch face. Tried Wallpaper but we can only open the face picker & cannot set the watch face.
ComponentName unique=new ComponentName(MainActivity.this,BlackOwlBlue.class);
Intent i=new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,unique)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);

Is it possible to run android application from android application?

Is it possible to run android application from android application? For example, i have a button in application 1 and when i press that button i want application 2 to start. I'm developing application in react-native.
I tried with Linking component but I'm getting this error "No Activity found to handle Intent". So i tried to edit AndroidManifest.xml, also without much success.
Thanks in advance.
Yes through Intent we call Activity of another application like below Intent by passing Application Package name and its class name with full package name .
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.example", "com.example.MyExampleActivity"));
startActivity(intent);
Allowing Other Apps to Start Your Activity

Car App htc one m 8

As the HTC ONE M8 is certified for MirrorLink usage, it also has a customized car app, which comes with an activity that allows phone calls while driving.
Is there a way to start this activity from an external application? Is the only way to call this activity if the app or rather that activity has implemented the ACTION_CALL intent?
thanks
Is there a way to start this activity from an external application?
Yes, you can do that with an intent filter, hereĀ“s the information:
http://developer.android.com/training/basics/intents/filters.html
but if you only want to open the application, knowing the application package is enough with:
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("your.other.app");
startActivity(intent);

Launch Android app from browser, when app doesn't have an intent filter defined

I know how to open an app that has an intent filter defined, as answered in Launch custom android application from android browser, but what if I'm not in control of the Android app, and it hasn't already defined an intent filter I can use?
Do I need to contact the developer and ask to add an intent filter, or is there some other way to open the application from a browser?
If the app's Activity does not have an IntentFilter defined, by default the system will keep the Activity private and not export it for other apps to start it. However, if the developer has set the android:exported="true" for that Activity in the app's manifest you should be able to start it by specifying just the component name in the Intent.

App intents in Android

I need to launch an app from the command line with
am start com.project.app
but it says unable to resolve intent.
I understand that I need to supply the intent, but I don't know what the intent is. I just want to start the app. Is there any way I can list the intents that the app has, find out what the intent was for an app already started, or find out the intent from a shortcut on the home screen?
Thanks.
To start an activity of any package, you need to provide the component name of that package.
It is something like /. or defined in the AndroidManifest.xml
for example, Package name: com.me.test and Activity name is com.me.test.app.TestActivity. Then you need to write
am start -n com.me.test/.app.TestActivity

Categories

Resources