diff options
-rw-r--r-- | xbmc/android/activity/XBMCApp.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/xbmc/android/activity/XBMCApp.cpp b/xbmc/android/activity/XBMCApp.cpp index 036601a0cc..1b95381410 100644 --- a/xbmc/android/activity/XBMCApp.cpp +++ b/xbmc/android/activity/XBMCApp.cpp @@ -401,17 +401,32 @@ bool CXBMCApp::HasLaunchIntent(const string &package) // Note intent, dataType, dataURI all default to "" bool CXBMCApp::StartActivity(const string &package, const string &intent, const string &dataType, const string &dataURI) { - CJNIIntent newIntent = GetPackageManager().getLaunchIntentForPackage(package); + CJNIIntent newIntent = intent.empty() ? + GetPackageManager().getLaunchIntentForPackage(package) : + CJNIIntent(intent); + if (!newIntent) return false; if (!dataURI.empty()) - newIntent.setData(dataURI); + { + CJNIURI jniURI = CJNIURI::parse(dataURI); + + if (!jniURI) + return false; + + newIntent.setDataAndType(jniURI, dataType); + } - if (!intent.empty()) - newIntent.setAction(intent); + newIntent.setPackage(package); + startActivity(newIntent); + if (xbmc_jnienv()->ExceptionOccurred()) + { + CLog::Log(LOGERROR, "CXBMCApp::StartActivity - ExceptionOccurred launching %s", package.c_str()); + xbmc_jnienv()->ExceptionClear(); + return false; + } - startActivity(newIntent); return true; } |