Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Chromecast Cast Hello World应用程序未使用我的应用程序id运行_Android_Https_Connection_Chromecast_App Id - Fatal编程技术网

Android Chromecast Cast Hello World应用程序未使用我的应用程序id运行

Android Chromecast Cast Hello World应用程序未使用我的应用程序id运行,android,https,connection,chromecast,app-id,Android,Https,Connection,Chromecast,App Id,当我将Chromecast Cast Hello World应用程序(随SDK提供)复制到Eclipse项目中,并使用不同的包名(我在这里将其命名为MY package)时,它运行得非常完美。但只要我使用在GoogleCastSDK开发者控制台下创建的应用程序id(我在这里将其命名为我的应用程序id),它就不再运行了 在Google Cast SDK开发者控制台中,我选择“Android”作为平台,提供包名MY package和https地址“”,该地址指包含以下内容的网页(复制自): 正在等

当我将Chromecast Cast Hello World应用程序(随SDK提供)复制到Eclipse项目中,并使用不同的包名(我在这里将其命名为MY package)时,它运行得非常完美。但只要我使用在GoogleCastSDK开发者控制台下创建的应用程序id(我在这里将其命名为我的应用程序id),它就不再运行了


在Google Cast SDK开发者控制台中,我选择“Android”作为平台,提供包名MY package和https地址“”,该地址指包含以下内容的网页(复制自):


正在等待消息。。。
$(函数(){
var receiver=new cast.receiver.receiver(“”,['urn:x-cast:com.google.cast.sample.helloworld']),
channelHandler=new cast.receiver.channelHandler('urn:x-cast:com.google.cast.sample.helloworld'),
$messages=$('.messages');
channelHandler.addChannelFactory(
receiver.createChannelFactory('urn:x-cast:com.google.cast.sample.helloworld');
receiver.start();
addEventListener(cast.receiver.Channel.EventType.MESSAGE,onMessage.bind(this));
函数onMessage(事件){
$messages.html(event.message.type);
}
});
如果我用“等待消息…”调用打开的网页响应

ID为“MY application ID”的应用程序尚未在Google Cast SDK开发人员控制台下发布,也未上载到Google play开发人员控制台

使用我的应用程序ID运行应用程序时,将显示操作栏中的Chromecast符号

当我连接设备时,连接到Chromecast设备的屏幕变黑,但我在ConnectionCallbacks类中遇到以下错误(else分支,注释为“启动接收器应用”): 05-12 19:56:59.950:D/main活动(12523):ApplicationConnectionResultCallback.onResult:状态代码15

原始应用程序id的结果为: 05-12 19:53:49.727:D/main活动(11778):ApplicationConnectionResultCallback.onResult:状态代码0


我还尝试了下面显示的网页,但得到了相同的结果。

不清楚您到底做了什么。您提到:“ID为“MY application ID”的应用程序尚未在Google Cast SDK开发人员控制台下发布,也未上载到Google play开发人员控制台。”。你所说的应用程序id没有上传到开发者控制台是什么意思?如果你创建了一个应用程序id,那么它就在那里。需要检查的一件事是您的证书是否有效(因为您的应用程序未发布,您可以切换到http进行测试)。

在Google Cast SDK开发者控制台中,我可以将“已发布”设置为“是”或“否”。当前设置为“否”。我也没有将应用程序上传到(据我所知,这不是必需的)。我在购买SSL证书。我的Chrome浏览器接受它。你不需要发布你的应用程序就可以工作,也不需要将应用程序上传到play store。至于您的证书,以及它是否会导致问题,正如我之前所建议的,将其设置为http,以查看这是否解决了问题(从而缩小了问题的范围)。我假设您拥有的“某个WEB地址”可以在外部解析(即使用Google的DNS)。桌面chrome与Chromecast有不同的证书接收设置,它比Chromecast宽容得多。现在它可以与https页面一起工作!我能够将文本投射到Chromecast设备!谢谢你的支持!!!我将删除上面显示http地址的注释。评论是:我将html页面复制到了一些html页面(上面的第一页列表)和另一个html页面(来自raw.githubusercontent.com/googlecast/CastHelloText android/…)。这样你就可以测试它们了。我的提供者Strato(参见Strato.de)自动将http请求页面转发到https(因为我有SSL证书)。我应该(I)在cast.google.com/publish下发布应用程序,还是(ii)将页面移动到http?
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="../css/receiver.css" />
    </head>
    <body>
        <div class="messages">
        <h1>Waiting for Messages...</h1>
        </div>
    </body>
    <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
    <script src="https://www.gstatic.com/cast/js/receiver/1.0/cast_receiver.js"></script>
    <!-- <script src="messageTypes.js"></script> can be removed -->
    <script>
        $(function() {
            var receiver = new cast.receiver.Receiver('<MY APPLICATION ID>', ['urn:x-cast:com.google.cast.sample.helloworld']),
            channelHandler = new cast.receiver.ChannelHandler('urn:x-cast:com.google.cast.sample.helloworld'),
            $messages = $('.messages');

            channelHandler.addChannelFactory(
            receiver.createChannelFactory('urn:x-cast:com.google.cast.sample.helloworld'));

            receiver.start();

            channelHandler.addEventListener(cast.receiver.Channel.EventType.MESSAGE, onMessage.bind(this));

            function onMessage(event) {
                $messages.html(event.message.type);
            }
        });
    </script>
</html>