Search code examples
javaandroidandroid-intentandroid-contentprovidershazam

How to launch a <provider/> tag (Launching Shazam search activity)


I want to start the search Activity in shazam. According to this there is no search Activity to shazam, only a <provider> tag.

<provider android:name="com.shazam.android.SearchProvider" android:authorities="shazamSearchEncore" android:syncable="false" />

I tried to launch it in various ways but because this is not an Activity it failed. So how do I start shazam search? Or am i missing something in that manifest xml file?

My tries:

1:

 Intent intent = new Intent("com.shazam.android.SearchProvider");
 intent.putExtra("query",query);
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 this.context.startActivity(intent);

2:

  final Intent shazamIntent = new Intent(Intent.ACTION_SEARCH);
  shazamIntent.setPackage("com.shazam.android.SearchProvider");
  shazamIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  this.context.startActivity(shazamIntent );

And so on...

Also I checked these post post 1 and post 2. But found nothing helpful.


Solution

  • A ContentProvider can't be "launched" by intents like an Activity.

    A provider is a component, designed for providing an interface to some data. The data can be accessed by a ContentResolver.

    Some ContentProviders also allow access from other apps. This is usually documented somewhere, providing the URL that is needed to access the data and details about the data itself. Such an example is the Contacts provider, used to access all the contact information stored on the device.

    Judging by the look of the manifest declaration of the provided that you are trying to access, I think it can only be accessed by the Shazam applications itself, so there is no way to access the data it provides.