首页 > 解决方案 > 如何阻止 Android Spotify Remote SDK 自动断开连接?(颤振应用)

问题描述

每次我让应用程序闲置一段时间,spotify 远程都会自动断开连接。我不确定这实际上是一件事还是只是 Flutter,但我需要它运行,直到我告诉它停止运行。

每次都会抛出此消息:

来自 Spotify 的消息:[6,{"message":"应用服务停止"},"wamp.error.system_shutdown"]

一旦我尝试再次播放,遥控器无法连接。我检查了 Spotify 遥控器是否为空或是否已断开连接,但看起来两者都不是:

if (mSpotifyAppRemote == null) {
    System.out.println("[player state]: remote is null");
    activateSpotifyRemote(arguments);
} else if (!mSpotifyAppRemote.isConnected()) {
    System.out.println("[player state]: remote is not connected");
    activateSpotifyRemote(arguments);
} else {
    // always goes down to here, but nothing happens after message.
    handleSpotifyPlayerAPI(arguments);
}

标签: androidflutterspotify

解决方案


推荐阅读