이 사이트의 제한 때문에 내 문제와 관련된 모든 것을 게시 할 수 없습니다. 모든 것을 읽을 수 있습니다. http://www.dreamincode.net/forums/topic/299148-widget-onclickpendingintent-not-received-by-service/위젯 OnClickPendingIntent가 서비스별로 수신되지 않음
기본적으로 현재 재생중인 노래를 표시하고 사용자가 재생 또는 트랙을 전환 할 수있게 해주는 위젯이 내 음악 앱에 있습니다. 위젯은 멋지게 업데이트되지만 서비스는 서비스에 의해 수신되지 않습니다. 내가 OnClickPendingIntent 설정하는 방법
이
은 다음과 같습니다RemoteViews updateViews = null;
ComponentName thisWidget = new ComponentName(this, GMWidget.class);
updateViews = new RemoteViews(this.getPackageName(), R.layout.widget);
Intent WIDGET_PAUSE_PLAY_intent = new Intent(this, GMService.class);
WIDGET_PAUSE_PLAY_intent.setAction(WIDGET_PAUSE_PLAY);
PendingIntent WidgetPausePlay = PendingIntent.getService(this, 0, new Intent(WIDGET_PAUSE_PLAY).setComponent(thisWidget), 0);
updateViews.setonclickPendingIntent(R.id.pbWidMediaPlay, WidgetPausePlay);
을이 내 OnReceive입니다 :
public void onReceive(Context context, Intent intent) {
// super.onReceive(context, intent);
String action = intent.getAction();
Log.d(TAG,"CLICKK: " + action);
}
이 내 서비스에 대한 내 의도 필터입니다 :
<action android:name="android.media.AUDIO_BECOMING_NOISY" /> />
<action android:name="com.my.player.WIDGET_NEXT" />
<action android:name="com.my.player.WIDGET_PREV" />
<action android:name="com.my.player.WIDGET_PAUSE_PLAY" />
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
감사합니다. –