Can't open Market App from my Application - android

I'm trying to open market app from my app using:
Intent i = new Intent("Intent.ACTION_VIEW");
i.setData(Uri.parse("market://details?id=com.compamy.app"));
startActivity(i);
But I have No Activity Found Error. I am using real device and I have market installed.
So my question is: What can be done here?Thanks.

The only problem here is what zapl pointed out in the comments ("" around the action). The documentation (http://developer.android.com/guide/publishing/publishing.html) clearly states how to use this:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);

official documantation link:
http://developer.android.com/guide/publishing/publishing.html#marketintent
Opening the app details page from your Android app
To open the Google Play details page from your application, create an intent with the ACTION_VIEW action and include a data URI in this format:
market://details?id=
For example, here's how you can create an intent and open an application's details page in Google Play:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);

Try this:
Uri uri = Uri.parse("market://details?id=com.compamy.app");
Intent i = new Intent(Intent.ACTION_VIEW, uri);
startActivity(i);

Related

How to open the youtube app using Intent

How can I launch youtube app using intent
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setPackage("com.google.android.youtube");
intent.setData(Uri.parse("https://www.youtube.com/watch?v=3TKSW-VgVyM"));
startActivity(intent);
The above code plays the video in youtube, but I want to open only youtube app, How Can I achieve this? Thanks in advance
you can open it using the package name com.google.android.youtube
start application knowing package name
Intent.getLaunchIntentForPackage("com.google.android.youtube");
This is the code needed for launching the Youtube app. Using this inside an onclicklistener is probably best.
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.google.android.youtube");
startActivity( launchIntent );

Open link for installation on Facebook

I have an Android application. I can add posts to timeline using it. Every such post is signed with message "via ЖАЛОБАнк" below. When I click to this link, open page for this app.
How make opening Google Play or other page in browser for installation this app?
You can start an intent to open a link when the user clicks on it. For instance, you can do this onClick()
Intent fb = new Intent(Intent.ACTION_VIEW);
fb.setData(Uri.parse("http://facebook.com"));
startActivity(fb);
I didn't try but this should work:
Intent intent = new Intent("android.intent.action.VIEW", Uri
.parse("https://play.google.com/store/apps/details?id=com.facebook.katana"));
startActivity(intent);

Opening application from current application

I have an Android app that can open another app I have using:
Intent intent = new Intent();
PackageManager manager = getPackageManager();
intent = manager.getLaunchIntentForPackage("myOtherAppPackageName");
intent.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(intent);
Which works perfectly, the only thing is the app force closes when I don't have the other app installed, which makes perfect sense. My question is how do I get my app to open the Play Store to the specific app for someone to download if they do not already have the other app? I would assume do the exact same thing except I don't have the package name for the Play Store.
if you have the package name you can just do this
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"market://details?id=" + "packagename"));
startActivity(marketIntent);
that will launch the play store on the page for that application
If you know package lets use this example code:
public void offerApp(Activity activity) {
Log.d("Launching Market");
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=<PACKAGE>"));
activity.startActivity(i);
}

How to open the default android browser without specifying an URL?

I'm loosing my mind over this. I want to open the user's default web browser. I can use this:
startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse("http://google.com")));
To open the browser and send the user to that URL. But I don't want to send him to a specific URL, I just want to open the browser. I'm sure it's a simple solution, I just can't find it. Any Ideas?
To just open the browser without any URL opened you can use
startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse("about:blank")));
After a bunch of searching, I was able to do this:
PackageManager pm = getPackageManager();
Intent queryIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
ActivityInfo af = queryIntent.resolveActivityInfo(pm, 0);
Intent launchIntent = new Intent(Intent.ACTION_MAIN);
launchIntent.setClassName(af.packageName, af.name);
startActivity(launchIntent);
It basically says "What application would handle this?". Then it grabs that applications package and class name then fires an intent for the main action.

Is there a way to direct the user to the market for another app?

I want to direct the user from one app the user is currently running, to the market, to download another app.
The link to the market is: market://search?q=pname:your.package.name
use this in your code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.android.example"));
startActivity(intent);
from: http://developer.android.com/guide/publishing/publishing.html#marketintent
Yes. Try this:
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://market.android.com/details?id=com.hg.cyberlords"));
c.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
c.startActivity(intent);
This will open the market app with "Cyberlords" app.

Categories

Resources