Android Intent for deep-linking to Deezer Search - android

I am trying to perform a search on Deezer by sending the following intent:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.deezer.com/search/" + query));
this.startActivity(intent);
In a previous version the web browser opened with a link saying "Open in Deezer" (or the like).
But in the current version this doesn't work anymore.
Is there any way to open the Deezer app and perform a search?
I have already tried the following (without success):
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer://search/" + query));
this.startActivity(intent);

There are many deeplinks you can use to search for content inside the Deezer app. You do have the basic search like this :
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer://www.deezer.com/search/" + query));
this.startActivity(intent);
But you can also be more precise :
// Search for an artist, will display the best match
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer-query://www.deezer.com/artist?query" + query));
this.startActivity(intent);
// Search for an album, will display the best match
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer-query://www.deezer.com/album?query" + query));
this.startActivity(intent);
// Search for a track, will display the best match
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer-query://www.deezer.com/track?query" + query));
this.startActivity(intent);

I believe it should be
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer://www.deezer.com/search/" + query));
this.startActivity(intent);
The scheme of the Uri needs to be deezer. You have set it as http.
Try this. This should work.

Related

Android intent open specific twitter in app

There is a way of knowing the id of the specific twitter that you want to open, to be able to open it in the official app.
I remember I found it long ago, but I can not remember.
I think it was a similar thing, but I'm not remembering.
Intent appIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://...?tweet_id=" + id));
appIntent.setPackage("com.twitter.android");
For launching a twitter user feed:
Intent intent = null;
try {
// get the Twitter app if possible
this.getPackageManager().getPackageInfo("com.twitter.android", 0);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?user_id=USERID"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
} catch (Exception e) {
// no Twitter app, revert to browser
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/USERID_OR_PROFILENAME"));
}
this.startActivity(intent);

Google Search for Android

I am trying to put a simple Google Search in my app. I found this code but it's not exactly what I am searching for. Below the search comes from a given url.
String url = "http://www.google.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
The thing is that I would like to get the search text from user and if possible without starting a new Activity like this one:
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
String term = editTextInput.getText().toString();
intent.putExtra(SearchManager.QUERY, term);
startActivity(intent);
Get the text from the user and place that in the URI, then start the intent.
String url = "http://www.google.com/search?q=" + userText;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

Deezer Intent - Android

I've already searched the web but haven't found any results. How can I make the Deezer app play a specific song using an intent at Android? (I'd like to do this with Deezer too).
Just start an ACTION_VIEW intent on "http://www.deezer.com/track/{id}".
String uri = "http://www.deezer.com/track/" + trackId;
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

Starting a Song from Spotify Intent

Is there anyway to start a Spotify Track from its URI ?
I've tried the following approaches but none of them work. When Spotify opens, it always lands in the Playlists page, instead of the track's player.
String spotifyTrackURI = "spotify:track:1cC9YJ8sQjC0T5H1fXMUT2";
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("com.spotify.mobile.android.ui");
// I've tried with Intent#putExtra()..
launchIntent.putExtra( SearchManager.QUERY, spotifyTrackURI );
// or with setData
launchIntent.setData(Uri.parse(spotifyTrackURI))
context.startActivity(launchIntent);
Thanks
Found the answer on the #spotify channel on Freenode (irc). Thanks everyone!
I'm putting it here for other people to know about:
// right click on a track in Spotify to get the URI, or use the Web API.
String uri = "spotify:track:<spotify uri>";
Intent launcher = new Intent( Intent.ACTION_VIEW, Uri.parse(uri) );
startActivity(launcher);
First one is for old Spotify version.
For new versions you can use the second.
In this way it will first try with old version, if it fails with an exception it try with the second one :)
try {
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setAction(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);
intent.setComponent(new ComponentName("com.spotify.mobile.android.ui", "com.spotify.mobile.android.ui.Launcher"));
intent.putExtra(SearchManager.QUERY, artistName + " " + trackName );
context.startActivity(intent);
} catch ( ActivityNotFoundException e ) {
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setAction(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);
intent.setComponent(new ComponentName("com.spotify.mobile.android.ui", "com.spotify.mobile.android.ui.activity.MainActivity"));
intent.putExtra(SearchManager.QUERY, artistName + " " + trackName );
context.startActivity(intent);
}
If you get playlist for Artist on Spotify app. You need to start following intent. You do not need to package name or activity of Spotify.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("spotify:artist:" + "ARTIST SPOTIFY LINK"));
startActivity(intent);

Facebook Link doesnt work android

Hello I just want to call Facebook app with the link below (on my android project):
String url_facebook_prixo = "https://www.facebook.com/pages/Prixo/468580313168290";
I tried this :
Uri uri = Uri.parse("facebook://facebook.com/page{468580313168290}");
Intent viewIntent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(viewIntent);
I tried with others link but its only displaying my wall..
Someone?
You should use the id to open the page.
Intent facebookIntent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("fb://profile/468580313168290"));
startActivity(facebookIntent);
I would advice you to encapsulate this in a try catch. Inside the catch open a normal browser intent

Categories

Resources