无法从Deep Link获取Uri数据

时间:2015-10-02 11:06:37

标签: android parameters uri intentfilter deep-linking

我希望从浏览器重定向到我的应用程序,因此我在Manifest中使用以下代码进行活动:

Uri URIdata = getIntent().getData();        
if(URIdata != null){
        String scheme = URIdata.getScheme();
        String host = URIdata.getHost();
        List params = URIdata.getPathSegments();
        String username = params.get(0).toString();
    }

//接受以“fivos:// book”

开头的URI

浏览器发送的Uri中也有一些参数(例如fivos:// book?username = george)。 在我被重定向到的Activity中,我使用以下代码来获取Uri,但是Uridata对象中似乎不存在参数,除了方案和主机

ReflectionException in Container.php line 554: Function () does not exist

in Container.php line 554
at ReflectionFunction->__construct('') in Container.php line 554
at Container->getCallReflector(null) in Container.php line 531
at Container->getMethodDependencies(null, array()) in Container.php line 500
at Container->call(null, array()) in Application.php line 1286
at Application->callActionOnArrayBasedRoute(array(true, array('middleware' => 'bankerAuth'), array())) in Application.php line 1255
at Application->Laravel\Lumen\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Authenticate.php line 44
at Authenticate->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Application.php line 1411
at Application->sendThroughPipeline(array('App\Http\Middleware\Authenticate'), object(Closure)) in Application.php line 1256
at Application->handleFoundRoute(array(true, array('middleware' => 'bankerAuth'), array())) in Application.php line 1179
at Application->Laravel\Lumen\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Application.php line 1411
at Application->sendThroughPipeline(array('Illuminate\Cookie\Middleware\EncryptCookies', 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', 'Illuminate\Session\Middleware\StartSession', 'Illuminate\View\Middleware\ShareErrorsFromSession'), object(Closure)) in Application.php line 1185
at Application->dispatch(null) in Application.php line 1125
at Application->run() in index.php line 28

我在清单中遗漏了什么吗?

1 个答案:

答案 0 :(得分:4)

  

我使用以下代码获取Uri但是Uridata对象中似乎没有参数,除了sheme和主机

网址?Uri之后的内容是查询参数,您可以通过方法like getQuery()Uri检索这些参数。