Questions tagged [appwidgetprovider]

A convenience class in Android to aid in implementing an AppWidget provider.

From the API page.

A convenience class to aid in implementing an AppWidget provider. Everything you can do with AppWidgetProvider, you can do with a regular BroadcastReceiver. AppWidgetProvider merely parses the relevant fields out of the Intent that is received in onReceive(Context,Intent), and calls hook methods with the received extras.

191 questions
0
votes
0 answers

Why does my Android Widget stop working randomly and on update

I created a command prompt widget for android, it's my first time working with Xamarin, and Android development, and it's been rough. Everything works as intended except the widget stops working after awhile when left on the home screen; this also…
0
votes
0 answers

Is it possible to update a AppWidgetProvider from a system service?

I have the DeskClock app on my phone and I was wondering if I can make the DigitalAppWidgetProvider that extends AppWidgetProvider update the view right from my system service. I tried sending a broadcast to ACTION_APPWIDGET_UPDATE, but it didn't…
0
votes
0 answers

How to implement a Toggle Button in App widget for the Android Version 11

How to implement a Toggle Button for the App widget in Android Version 11? I tried to implement Toggle Button in App widget but it's crashing .
0
votes
1 answer

How to pass value from Activity to Widget use Intent action extra

I would like pass an value to my widget using Intent. But something wrong, I can not receive my intent extra value.. My MainActivity: var testValue = "test" val intent = Intent("my.action.string") intent.putExtra("extra",…
0
votes
0 answers

How to implement RemoteViews.setOnClickPendingIntent for the rows of TextViews with android.R.id.text1

I have a fragment of the code which generates dates for the current month calendar for appwidget: for (week in 0 until 6) { val rowRv = RemoteViews(context.packageName, R.layout.w_calendar_row_week_wrapper) for (day in 0..6) { ... // Set date…
0
votes
2 answers

Refresh AppWidget with network request using RemoteView button

tl;dr question: How to properly refresh widget e.g. every minute making network request in background, reliably working Android 5-13 and according to policy I have an app widget which needs to be refreshed more often than forced updatePeriodMillis…
snachmsm
  • 17,866
  • 3
  • 32
  • 74
0
votes
0 answers

How to get the viewModel in my Widget class (which extends Broadcast receiver) use Hilt?

I would like create an widget and sent args into. I have Widget class extends Broadcast receiver and I use Hilt. How I can get viewModel in my Widget class? I try use standard way but the viewModel is not found and highlighted by red. My Widget…
0
votes
0 answers

My Widget stops updating after some period of time

I have a widget made up of 2 TextViews, 2 ImageViews, and 2 TextClocks. I am trying to update the widget using a ScreenListener (code below) and an alarm. I want all views to update when the screen is turned On. Also, a repeating alarm is set…
amm811
  • 1
  • 2
0
votes
1 answer

Android updateAppWidget is called but not updating the widget or reaching RemoteViewsFactory?

My app widget (ListView showing game scores) works fine when created on the home screen, but when I call appWidgetManager.updateAppWidget(id, R.id.appwidget) inside the provider, there is no reaction from the widget or the log calls in the…
RufusInZen
  • 2,119
  • 1
  • 19
  • 26
0
votes
1 answer

Why is this Volley jsonObjectRequest not working properly in AppWidgetProvider()?

I am successfully calling for and receiving json data... I am not getting any errors... Logcat is displaying the proper information... I can hard code setTextViewsText outside of the request... But, my city TextView is not changing in this block of…
0
votes
1 answer

App widget is not updated in power saving mode

I have a widget that has network access. Updating widgets in power saving mode results in a timeout exception. It turns out that handling the battery optimization exception will resolve it. But some apps have seen network access in widgets without…
thesquare12
  • 23
  • 1
  • 6
0
votes
0 answers

WorkManager not starting job if application is not launched

I use WorkManager to periodically update widget once in hour. In onEnabled method of AppwidgetProvider I enqueue PeriodicWorkRequest and cancelAllWorkByTag in onDisabled. Here is my code from onEnabled method: val constraints =…
0
votes
1 answer

android widgetProvider : set backgroundDrawable for button

I am trying to set background for button (a homeScreen Widget) through a configuration activity. background color is accepted from user (from a JSON) using that color, 2 GradientDrawables are prepared and added in StateListDrawable. I want to set…
0
votes
0 answers

android AppWidget onClick trigger

I've an app widget which I would like to print text("OnClicked") to console(or toast) ONLY when the widget is clicked. i.e, I would NOT want the text to be printed when the device is restarted as currently happening. Is there a way to trigger some…
0
votes
2 answers

How to restore widget data to its previous state when reboot the phone?

I am setting widget data using android:configure tag which sets my configuration activity (i.e. it's list dialog ) which sets onClick event and image to my widget depending on user's selection. now the problem is whenever I reboot the phone or rerun…