I'm new at Android, and currently developing a widget that needs to send an intent from AppWidgetProvider to BroadcastReceiver. I've tried the following, from AppWidgetProvider.onUpdate:
Intent receiver = new Intent(context, MyWidgetIntentReceiver.class);
receiver.setAction("com.mywidget.intent.action.MESSAGE_1");
context.startService(receiver);
with no results. What am I doing wrong?
Thanks in advance
Thanks! I answer myself. Just replace
context.startService(receiver);
by
context.sendBroadcast(receiver);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.