I use this URI to search the Play Store, but the Android docs don't mention a way to search a specific category like, games, music, or books.
URI marketUri = Uri.parse("market://search?q= ");
The Play Books and Play Music apps both open the Play Store app to their correct categories, so if they can open to a specific catergory, then I think I can search one. Does anyone have some info on doing this?
I found the solution. Here's the current method I'm using to shop the music category.
public static void shopFor(Context context, String artistName) {
String str = "https://market.android.com/search?q=%s&c=music&featured=MUSIC_STORE_SEARCH";
Intent shopIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(str, Uri.encode(artistName))));
shopIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shopIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(shopIntent);
}
I did a search at play.google.com in the books category and the URL looks like this:
https://play.google.com/store/search?q=android&c=books
try adding "&c=books" after your query and see what happens.
Related
I am having trouble inserting a passed String from an intent into the google music app's searchbar.
The following code allows me to open up Google Play Music from my app, but leaves the searchbar empty. Would anyone know how to populate Google Play Music's searchbar with my passed in String? any help would be greatly appreciated.
Intent intent = getActivity().getPackageManager().getLaunchIntentForPackage("com.google.android.music");
intent.putExtra(song ,"song to be inserted in google play searchbar");
startActivity(intent);
I have figured it out thanks to the following documentation
In this example, i am opening up the google play store then entering search?q=drake&c=music")); as part of the URI to go to the music tab and search for drake
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("http://play.google.com/store/search?q=drake&c=music"));
startActivity(i);
I want the user to be able to share a link (to text content online). When shared, I also want a link to the app in the Play Store to appear below said link.
Via email, the shared might look like the following
Email subject: [content subject]
Email body:
[link to content]
Download our app here:
[link to app in Play Store]
I tried something like this, but it doesn't display the links:
String playStoreUrl = "market://details?id=" + getActivity().getApplicationContext().getPackageName();
ArrayList<String> links = new ArrayList<String>();
links.add(data.getLink());
links.add(playStoreUrl);
Intent sharingIntent2 = new Intent(Intent.ACTION_SEND_MULTIPLE);
sharingIntent2.putExtra(Intent.EXTRA_SUBJECT, content.getSubject());
sharingIntent2.putStringArrayListExtra(Intent.EXTRA_TEXT, links);
sharingIntent2.setType("text/plan");
startActivity(Intent.createChooser(sharingIntent2, "Share this content"));
Any help is much appreciated! There doesn't seem to much documentation on this.
You can do it like this:
String YOUR_TEXT_TO_SEND=data.getLink()+"\n"+"Download our app here: "+"[link to app in Play Store]";
intent.putExtra(Intent.EXTRA_TEXT, YOUR_TEXT_TO_SEND);
I'm trying to launch the Amazon Kindle app from my android application but based on a specific book that the user clicks.
I'm able to determine the books available and which book the user has selected but I have only been able to launch the kindle application (using the package name com.amazon.kindle) to launch the kindle app.
Does anyone know of any additional commands I can send to specify a book to open? I know this is possible as there is a widget on the google play store where the user selects a boo and it creates a button on the homescreen that launches the kindle app and opens the book.
Thanks in advance!
First we need to set the intent to an ACTION_VIEW intent.
Then we need to define an Uri for the data which is actually a link that looks something like: kindle://book/?action=open&book_id=AMZNID0/B000FC1GHO/0/, where in this case the section B000FC1GHO corresponds to the ID of the book.
Finally we can then start the activity. In my case I had to set some flags on the intent to launch a new activity.
The code I'm using is as follows:
if(intent.getAction().contains("BOOK_ACTION_"))
{
Log.w("LOG", "We have a book selected");
bookID = intent.getAction().substring(12);
Log.w("LOG", bookID);
Intent readbook = new Intent(Intent.ACTION_VIEW);
readbook.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri file = Uri.parse("kindle://book/?action=open&book_id=AMZNID0/" + bookID + "/0/");
readbook.setData(file);
context.startActivity(readbook);
}
I'm overriding the onReceive method in this case so that I can perform some additional steps on each book. Presumably because I'm just setting an ACTION_VIEW intent this could have been handles in the other class that does the onClickListener for the imageview that holds the book I want.
I am trying to get a button on my app go to the market place when clicked. Not to another app, but to my publisher area with all my apps. Can anyone help, it just seems to force close at the moment?
final String APP_MARKET_URL = "market://developer?pub=PUB+ID+HERE";
I think that the correct string is market://search?q=pub:PUB+ID+HERE
If your string is correct too, try doing it with this code
Intent market = new Intent(Intent.ACTION_VIEW, Uri.parse(APP_MARKET_URL));
market.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(market);
in my android application i want to add the functionality the user to buy song from amazon. The easiest way to do is i think to use amazon mp3 application to communicate with amazon store. I found this piece of code from default music player
Intent i = new Intent();
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
i.putExtra(SearchManager.QUERY, mSong.getArtits() + " " + mSong.getName());
i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, "artist");
i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, "album");
i.putExtra(MediaStore.EXTRA_MEDIA_TITLE, mSong.getName());
i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, "audio/*");
startActivity(Intent.createChooser(i, "Search for " + mSong.getName()));
which shows menu to select where to search for your song (browser, youtube, amazon mp3). But here are some things i want to do -
I don't want to show the whole pop up screen but only amazon search, what intent i should use to search directly in amazon mp3.
How can i send my affiliate partner key to amazon mp3 so it can included it when querying amazon.
Shazam is using directly amazon mp3 but i couldn't find any information what intent i should use. Thanks in advance any help will be very helpful.
It's not a public API; Shazam apparently have a private arrangement with Amazon. It might be worth contacting Amazon directly, since they have a lot of public APIs, and this one would certainly seem to be in their interests. But like any large company, I wouldn't hold your breath for a response.
as for 1., you can try to determine the correct activity by evaulating the list of matching activities like this (i being the intent you created):
List<ResolveInfo> info = getPackageManager().queryIntentActivities(i, 0);
String packageName=null, className=null;
for ( ResolveInfo r: info){
if ( r.activityInfo.packageName.startsWith("com.amazon.mp3")){
packageName=r.activityInfo.packageName;
className=r.activityInfo.name;
break;
}
}
if ( packageName != null && className != null)
i.setClassName(packageName, className);
startActivity(i);
This is sort of a hack since one should not rely on the package name starting with a certain fixed string, but in fact it will probably work for long. Just be prepared in your code to deal with it changing (android will automatically display the activity chooser if the Amazon activity is not identified).
as for 2., sorry, I have no information about this.