How to link 5 apps from one app. New to android - android

I have 5 android apps and im trying to make a front page that has 5 buttons that connects to each one. How do I go about this? i tried to create a onclick method in layout but it didnt work.

you can use the package name of App to open them on button click as :
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);

Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=your Package name"));
startActivity(i);
Declare it in your Activity.
Let me know if it helps you.

Related

Android Start VPNClient (com.ipsec.vpnclient) Programmatically

I have an android application that requires VPN. My users will be using Galaxy Note 3's and will be using the built in "VPN Client" (com.ipsec.vpnclient). I need to find a way to launch this application from my application, in the instance of the VPN dropping. I've already figured out a way to determine if the VPN dropped, but I still need a way to launch the application.
ANSWER:
Thanks to help from #Muthu I was able to get it working with the following method.
final Intent intent = new Intent("android.intent.action.VIEW");
intent.setComponent(new ComponentName("com.ipsec.vpnclient", "com.ipsec.vpnclient.MainActivity"));
EDIT:
To add to the confusion, I am easily able to add a shortcut to the activity (com.ipsec.vpnclient.MainActivity) via another Launcher like ADW or Nova. I also tried using com.ipsec.vpnclient.MainActivity instead of com.ipsec.vpnclient in the method below, to no avail.
Intent intent = getPackageManager().getLaunchIntentForPackage("com.ipsec.vpnclient");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
The above method works with other packages, but I can't seem to get this one to launch.
Here is the application when viewed in Android System Info.
Any ideas on how to launch this application programmatically?
You can Start any installed application by using intent. in your case like this
Intent LaunchVPN = getPackageManager().getLaunchIntentForPackage("com.ipsec.vpnclient");
startActivity( LaunchVPN );
Edit
You can open pre installed apps that can be found inside settings page by
final Intent i = new Intent("android.intent.action.VIEW");
i.setComponent(new ComponentName("com.android.settings","com.android.settings.InstalledAppDetails"));
startActivity(i);

Launch another App within an App for android

I am new to Android. Say, I open an app and I would like to open another App after clicking a button. How can I accomplish this task? Would appreciate if you can provide me some tutorial on this.
Intent intent = new Intent();
intent.setClassName("**package.name**", "**package.name.LauncherActivityName**");
startActivityForResult(intent,REQUEST_CODE);
You need to know the package and class names of the activity to call
Intent i = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("app package name");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
Use this code:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.package");
startActivity(launchIntent);
The app you want to launch must be on the device.
Intent appIntent = getPackageManager().getLaunchIntentForPackage("your app package name ");
startActivity(appIntent );
If the other application is a pre-packaged application mean, this tutorial may help you.
If the other application is going to be your application, then you need to learn Implicit Intent tutorials.
Also include the activity of the other application which you are planning to call in the Manifest file of the calling package also.

How do we find the information for launching other app?

I need to allow user to draw/sketch/paint something. There are already many apps(like Skitch, I will use this as an example) that accomplish this task. So I don't want to re-invent the wheel.
In Android, theoretically, we can launch other activity by intent. This is sort of like "pipe" in Unix.
The problem is, I don't know how to get the information for launching Skitch.
To integrate Skitch in my app, I need to know the Action it supports, the returning intent (if any) when it finishes.
I installed Skitch, photoshop, and lots of other touch drawing apps in my device, but this code doesn't work :
Uri data = Uri.fromFile(file);
Intent i = new Intent(Intent.ACTION_EDIT);
i.setData(data);
i.setType("image/*");
startActivityForResult(i, ACTIVITY_DRAW);
I can launch Skitch from my app in the following way: but obviously I can't get any returned result this way(code from here).
Intent i = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("com.evernote.skitch");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
My question: Is there a standard way to find information for launching a third party app?
Is this site the only way to share/get such information?
Or if you have any suggestions for my problem, please help me.
Thank you!
As you might already know how to call another application Activity from your app ..this way Mentioned Here.
Intent intent = new Intent(Intent.ACTION_RUN);
intent.setComponent(new ComponentName("<packet name>", "<class name>"));
List list = packageManager.queryIntentActivities(intent, packageManager.COMPONENT_ENABLED_STATE_DEFAULT);
if(list.size() > 0)
{
Log.i("Log", "Have application" + list.size());
startActivity(intent);
}
else
{
Log.i("Log", "None application");
}
All your require is Mainly Two Things to call any Activity
1) Package Name of that Activity
2) Activity Class Name
These two informations only can be available if they are opensource or made free to use .. like Zxing,Google Maps Application.
There is another way to start an application activity like,
Intent intent = new Intent();
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + numberField.getText())); // set the Uri
startActivity(intent);
For this way to use need to know the correct Action for the Activity you want to call and the Correct parameter to pass with.
And again,These information only can be available if they are opensource or made free to use .. like Facebook and Gmail apps to share and post messages.
So If you are searching for anything like which can tell you what you will need to pass to call any specific comercial apps in your device, you wont find it directly.
It's an old question but perhaps it could help somebody to know that Sony's AppXplore application (free) shows the package and name of the activities of every app installed on your device, so you can eventually use them to do explicit Intents.

Android About page

How to open Settings>About page programmaticlly in Android.
You can open it by simply using an Intent
Intent aboutPhone = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);
startActivity(aboutPhone);
As in Android there are many Settings classes and here it would be :
android.provider.Settings
Looks like this is as close as you can get
Intent i = new Intent(Settings.ACTION_SETTINGS);
startActivity(i);
Takes you to the main settings page. There doesn't seem to be an option to go to the About Phone page.
Short answer you can't .
Long answer all you can do is create an activity and show all the info from about page in your activity by problematically polling out the info from the system

Problem launching Google Navigation

i tried since many hours to launch navigation from my app.
I want navigation without destination.
i tried with
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q="));
startActivity(i);
That launches navigation but with destination not found
I tried too to launch processName, packageName with startIntent with com.google.android.apps.maps,
com.google.android.apps.maps:driveabout and
**com.google.android.maps.driveabout.app.DestinationActivity
with no succes too :/
an idea ?
Google Navigation does not have any documented and supported Intent filters. It is not designed to be integrated from third party apps.
The following code should work...
String url = "google.navigation:q="+startPos.getLatitude()+","+startPos.getLongitude();
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(i);
Take a closer look a the intent filter for Google Navigation. It could be that it is not designed to be started via Intent without a specified destination. Unfortunately, i don't know where to find information about Google Navigation's intent filter, but if you were to show me where you are looking i could help you figure it out.
Try using
google.navigation:fd=true
i don't want to integrate it, i just want to launch it like a click on the list of apps whith a home launcher.
I've tried the google home sample, and navigation can be launched.
but i don't understand why that doesn't work with my own app :/

Categories

Resources