diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 739e544..b34dfb8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,6 +28,13 @@ + + + + + + + diff --git a/app/src/main/java/phone/vishnu/dialogmusicplayer/MainActivity.java b/app/src/main/java/phone/vishnu/dialogmusicplayer/MainActivity.java index 208f908..925cbe6 100644 --- a/app/src/main/java/phone/vishnu/dialogmusicplayer/MainActivity.java +++ b/app/src/main/java/phone/vishnu/dialogmusicplayer/MainActivity.java @@ -154,12 +154,25 @@ private void initTasks(Intent intent) { initViews(); - Uri uri = intent.getData(); + Log.e("vishnu", "initTasks Intent#getAction: " + intent.getAction()); - if (Intent.ACTION_VIEW.equals(intent.getAction()) && uri != null) { + if (Intent.ACTION_VIEW.equals(intent.getAction()) + || Intent.ACTION_SEND.equals(intent.getAction())) { + + Uri uri = + Intent.ACTION_VIEW.equals(intent.getAction()) + ? intent.getData() + : (Uri) intent.getExtras().get(Intent.EXTRA_STREAM); Log.e("vishnu", "initTasks:" + uri); + if (uri == null) + Toast.makeText( + this, + "Oops! Something went wrong\n\n" + intent.getAction(), + Toast.LENGTH_LONG) + .show(); + mediaPlayer = new MediaPlayer(); try {