AlbeyAmakiir
AlbeyAmakiir

Reputation: 2247

Search the android market for an app, but only return the link to the app

I'm making a map application.

I'd like the user to see X in my app, then be able to go to the market, search for an app related to X, and add a link to that app to X, so that other users can find that app when they look at X.

For example, say someone finds a particular brand of bank on the map, and they know there's an app for that bank. I want them to be able to go to the market, find the bank app (Edit: Which I don't know even exists before the user gets my app), and then add the link to that app to the POI on the map, so that others can know about the app.

The part I'm having trouble with is, what does the Market app return? Can I get it to return a link or partial link like that? It seems to me the hardest part is that when a user selects an app, it installs it. I don't imagine it's even set up to possibly return a link instead, but I can't find much info on what it returns at all.

Upvotes: 0

Views: 861

Answers (2)

ImR
ImR

Reputation: 887

If you know the name of the app, you can create an intent as explained here: Linking to Your Apps on Android Market

For example: If the user selects McDonalds on the map, they can push a button to search for apps that match the name. In this case you would do the following:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://search?q=McDonalds"));
startActivity(intent);

That should open the market up to roughly these results in the native market. From there, the user can select the appropriate app.

Upvotes: 0

Reno
Reno

Reputation: 33792

Take a look at the Android market API project

This library allow you to ask directly google's official android market servers for information, search for apps

MarketSession session = new MarketSession();
session.login(email, password);
session.getContext.setAndroidId(myAndroidId);
String query = "HSBC";
AppsRequest appsRequest = AppsRequest.newBuilder()
                                .setQuery(query)
                                .setStartIndex(0).setEntriesCount(10)
                                .setWithExtendedInfo(true)
                                .build();

session.append(appsRequest, new Callback<AppsResponse>() {
         @Override
         public void onResult(ResponseContext context, AppsResponse response) {
                  // Your code here
                  // response.getApp(0).getCreator() ...
         }
});
session.flush();

Upvotes: 1

Related Questions