我正在尝试RemoteControlClient设置,以便我的应用程序的音乐可以通过锁定屏幕上弹出的小部件(如SoundCloud,Google Play音乐和其他音乐/视频应用程序工作)进行控制.我不确定我的代码有什么问题以及为什么它没有正确挂钩,但这是我到目前为止所拥有的...
一个名为MusicService的类,它尝试处理RemoteControlClient的更新
public class MusicService extends Service
{
public static final String ACTION_PLAY = "com.stfi.music.action.PLAY";
private RemoteController controller = null;
@Override
public void onCreate()
{
super.onCreate();
System.out.println("Creating the service.");
if(controller == null)
{
controller = new RemoteController();
}
}
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
String action = intent.getAction();
System.out.println("Got an action of " + action);
/* Logic to get my Song cur */
controller.register(this);
controller.updateMetaData(cur);
return START_STICKY;
}
@Override
public void onDestroy() …Run Code Online (Sandbox Code Playgroud) 因此,我从家里连接到我的工作计算机,而远程桌面连接应用程序却很慢。
我从计算机ping我的工作计算机,它在50ms的合理时间内返回,丢失了0。然后,我尝试从RDP会话ping我的家庭IP,并且每次都超时。不知道这是否可以帮助任何人得出结论,但希望可以。注意如果有帮助,我还将它与Cisco AnyConnect安全移动客户端结合使用。Work是Windows 7,Home是Windows 8
我试图关闭家用计算机的防火墙,但没有执行任何操作。
任何帮助都会很棒,可以肯定的是,RDP文件中的设置可能会使它运行起来更加流畅。
我将在下面的修复中尝试进一步编辑此帖子