Skip to content

Commit

Permalink
Fixes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Feb 24, 2022
1 parent 83caa35 commit 850b897
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
<data android:mimeType="audio/*" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.SEND" />

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="audio/*" />
</intent-filter>

</activity>

Expand Down
17 changes: 15 additions & 2 deletions app/src/main/java/phone/vishnu/dialogmusicplayer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 850b897

Please sign in to comment.