我想通过默认媒体播放器播放网址中的特定歌曲
我可以使用Play song on default music player - android
播放它但它没有完全打开应用程序
此外,我可以使用以下代码打开音乐播放器
Intent intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,Intent.CATEGORY_APP_MUSIC);
startActivity(intent);
我怎么能两个都做?
答案 0 :(得分:1)
每个制造商都会有其默认音乐播放器,但如果您仍想打开Google提供的默认Android音乐播放器,即 Google Play音乐,则可以使用以下代码打开它: -
此代码将打开Google Play音乐,否则会打开其他音乐播放器。
/**
* This method will help you retrieve properties of a file or a list of files from particular folder in Azure Blob storage
* @param containerName - Pass the name of the container
* @param path - Location of your file
* @param fileName - You can pass complete file name to retrieve one file or you can pass prefix of the file.
* @return It returns List<BlobProperties> if you pass complete file name, it will return one file or it will find file with supplied prefix.
* @throws Exception
*/
public List<BlobProperties> retriveBlobFilesProperties(String containerName, String path, String fileName) throws Exception{
List<BlobProperties> blobFilesProperties = new ArrayList<BlobProperties>();
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.parse(this.storageConnectionString);
CloudBlobClient cloudBlobClient = cloudStorageAccount.createCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName);
CloudBlobDirectory directory = cloudBlobContainer.getDirectoryReference(path);
Iterable<ListBlobItem> blobItems = directory.listBlobs(fileName);
for(ListBlobItem item : blobItems){
CloudBlob blob = (CloudBlob)item;
blobFilesProperties.add(blob.getProperties());
}
return blobFilesProperties;
}