0
我有MyActivity和MyService(播放音乐)。我也有通知(在通知栏中),但是当我按下时,MyActivity在默认状态下打开(播放按钮没有按下,例如,虽然音乐仍在播放)。这在我开始使用绑定工作之前就行得通了 - 我担心它必须对它进行一些操作。Android:通知和绑定服务
什么可能是错的?
编辑:
这是我的我的服务里面Noification:
PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 0,
new Intent(getApplicationContext(), SoundRelaxerActivity.class),
PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new Notification();
notification.tickerText = "Soundrelaxer: "+trackTitle;
notification.icon = R.drawable.play;
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.setLatestEventInfo(getApplicationContext(), "SoundRelaxer","Playing: " + trackTitle, pi);
startForeground(1, notification);
其实我使用PendingIntent(在开发者指南教程中工作),它没有这种类型的标志。或者你的意思是我开始服务的意图?另外,请看第一篇文章更新。 – 2012-02-09 18:26:26
不是'PendingIntent',你传递给'PendingIntent'的'Intent'。 – 2012-02-09 18:27:59
谢谢,现在它按预期工作。 – 2012-02-09 18:52:08