Hi
I have a widget, with a provider :
and the onStart of my service :
Problem :
when i call pendingIntent.send(context, 0, intent); in onUpdate, getIntExtra in the service return the good ID. but when service is called by a click on my widget, extras of the intent are empty, i don't have anything
I have a widget, with a provider :
PHP:
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
final int N = appWidgetIds.length;
for (int i=0; i<N; i++) {
int appWidgetId = appWidgetIds[i];
Intent intent = new Intent(context, RingModeService.class);
intent.putExtra("RingModeAppWidgetConfig." + AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0);
// THIS IS FOR TESTING EXTRAS
try {
pendingIntent.send(context, 0, intent);
} catch (CanceledException e) {
}
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.ringmode_widget);
views.setOnClickPendingIntent(R.id.ringmode_widget_icon, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
PHP:
public void onStart(Intent intent, int startId) {
intent.getIntExtra("RingModeAppWidgetConfig." + AppWidgetManager.EXTRA_APPWIDGET_ID, 0)
}
when i call pendingIntent.send(context, 0, intent); in onUpdate, getIntExtra in the service return the good ID. but when service is called by a click on my widget, extras of the intent are empty, i don't have anything