Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

App-recognition for music players who identify as com.android.music #234

Merged
merged 1 commit into from
Jan 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import android.content.ContentUris;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.MediaStore;
Expand Down Expand Up @@ -95,8 +96,23 @@ protected void parseIntent(Context ctx, String action, Bundle bundle)
}

MusicAPI getMusicAPI(Context ctx, Bundle bundle) {
CharSequence bundleAppName = bundle.getCharSequence("player");
CharSequence bundleAppPackage = bundle.getCharSequence("package");
CharSequence bundleAppName;
CharSequence bundleAppPackage;

bundleAppPackage = bundle.getCharSequence("scrobbling_source");
if (bundleAppPackage != null)
{
PackageManager packageManager = ctx.getPackageManager();
try {
bundleAppName = packageManager.getApplicationLabel(packageManager.getApplicationInfo(bundleAppPackage.toString(), PackageManager.GET_META_DATA));
} catch (PackageManager.NameNotFoundException e) {
bundleAppName = bundle.getCharSequence("player");
bundleAppPackage = bundle.getCharSequence("package");
}
} else {
bundleAppName = bundle.getCharSequence("player");
bundleAppPackage = bundle.getCharSequence("package");
}

MusicAPI musicAPI;
if ((bundleAppName != null) && (bundleAppPackage != null)) {
Expand Down