When trying to open a downloaded video (as audio file) the app crashes when there is no music player app installed.
SysInfo:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://org.schabi.newpipe.beta.provider/external_files/emulated/0/Music/NewPipe/Koi wa Ameagari no You ni Ending Full『Aimer - Ref_rain』.m4a typ=audio/mpeg flg=0x81 }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1818)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
at android.app.Activity.startActivityForResult(Activity.java:4229)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)
at android.app.Activity.startActivityForResult(Activity.java:4187)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:732)
at android.app.Activity.startActivity(Activity.java:4526)
at android.app.Activity.startActivity(Activity.java:4494)
at us.shandian.giga.ui.adapter.MissionAdapter.viewFileWithFileProvider(MissionAdapter.java:285)
at us.shandian.giga.ui.adapter.MissionAdapter.access$400(MissionAdapter.java:39)
at us.shandian.giga.ui.adapter.MissionAdapter$2.onMenuItemClick(MissionAdapter.java:236)
at android.widget.PopupMenu$1.onMenuItemSelected(PopupMenu.java:104)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:761)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:904)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:894)
at com.android.internal.view.menu.MenuPopup.onItemClick(MenuPopup.java:128)
at android.widget.AdapterView.performItemClick(AdapterView.java:310)
at android.widget.AbsListView.performItemClick(AbsListView.java:1164)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3139)
at android.widget.AbsListView$3.run(AbsListView.java:4054)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6186)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
This is a rather rare case, but if someone was willing to fix this, we could check if a player was installed , and only send an intent if one is there. If not we could redirect the user to fdroid.
@theScrabi: I'm not experienced into this but can the code to run the intent be executed inside "try catch"?
An exception is thrown so I think this should be possible. I added the stacktrace. I would say it happens at this line.
I am not familiar with the source code so it's just a guess.
If any of you wants to fix it, check these methods of the GigaGet list adapter (MissionAdapter). It should be using resolveActivity like this instead of just hoping that the user has some app that can handle it.
But as you can see, the code from GigaGet is old and unmaintained (unused and duplicated methods, handling API versions, code style) and because of that we are switching to another download manager, so only fix it if you want to (getting familiar with the codebase is always a good thing).
@MeikelLP Hello, I tried to fix the issue, but couldn't reproduce it. Are you sure it still exists? When I try to open a video/audio file without a player it will just open within the NewPipe App. That's how it looks for me then. Any idea what I might be doing wrong?
The bug still exists (for me at least) in 0.13.2 but was already found in 0.12.x
I did not "uninstall" the default music app (in my case com.cynogenmod.eleven) - I rather deactivated it. I think that's about everything you need to reproduce. I also updated the information given by the app (see above).
If you need more information please ask again :)
@MeikelLP Alright, sorry! It actually opened thanks to Google Play Music. I now solved the issue an am learning how to make pull requests!
I'm not a team member or professional Android developer but the commit looks promising to me 👍
Fixed in #1327 by @Somethingweirdhere. Thank you!