Developing Android App Widgets

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Developing Android App Widgets
Medium
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Android App Widgets Development

Android App Widgets are components placed on home screen and updated via AppWidgetProvider (subclass of BroadcastReceiver). Unlike iOS WidgetKit, Android widgets can respond to taps interactively and update without iOS's budget limitations — but with RemoteViews constraints.

Architecture: RemoteViews as Main Limitation

Android widget renders in launcher process, not app process. So can't use standard View — only RemoteViews. RemoteViews supports limited View set: TextView, ImageView, Button, LinearLayout, RelativeLayout, FrameLayout, GridLayout, ListView, GridView, StackView.

Can't use: RecyclerView, ConstraintLayout (before API 31), custom View, WebView. For collections — ListView or GridView via RemoteViewsFactory.

Starting Android 12 (API 31): RemoteViews supports CheckBox, RadioButton, Switch — interactive elements. Before 12 — only PendingIntent on tap.

AppWidgetProvider and Updates

class MyWidget : AppWidgetProvider() {
    override fun onUpdate(
        context: Context,
        appWidgetManager: AppWidgetManager,
        appWidgetIds: IntArray
    ) {
        appWidgetIds.forEach { widgetId ->
            val views = buildRemoteViews(context)
            appWidgetManager.updateAppWidget(widgetId, views)
        }
    }
}

onUpdate called by schedule from android:updatePeriodMillis in appwidget-provider XML. Minimum — 1800000ms (30 minutes). For more frequent updates need WorkManager or AlarmManager with explicit updateAppWidget.

WorkManager with PeriodicWorkRequest (minimum 15 minutes) + appWidgetManager.updateAppWidget — standard approach for widgets with regular data (rates, weather, schedule).

For push-driven updates: FirebaseMessagingService.onMessageReceivedappWidgetManager.updateAppWidget — widget updates instantly on push.

Collections: RemoteViewsFactory

ListView in widget with data from app:

class WidgetListFactory(private val context: Context) : RemoteViewsService.RemoteViewsFactory {
    private var items: List<WidgetItem> = emptyList()

    override fun onDataSetChanged() {
        // Called in background thread
        items = loadDataFromSharedPrefs(context)
    }

    override fun getViewAt(position: Int): RemoteViews {
        val item = items[position]
        return RemoteViews(context.packageName, R.layout.widget_list_item).apply {
            setTextViewText(R.id.item_title, item.title)
            val fillIntent = Intent().putExtra("item_id", item.id)
            setOnClickFillInIntent(R.id.item_container, fillIntent)
        }
    }
}

setOnClickFillInIntent + setPendingIntentTemplate on ListView — pattern for handling item taps. Without setPendingIntentTemplate taps don't work.

Glance — Jetpack Compose for Widgets

Starting Glance 1.0 (stable): widgets in Compose-like syntax, without manual RemoteViews.

class MyGlanceWidget : GlanceAppWidget() {
    @Composable
    override fun Content() {
        val data = currentState<MyWidgetData>()
        Column(modifier = GlanceModifier.fillMaxSize().background(Color.White)) {
            Text(text = data.title, style = TextStyle(fontSize = 16.sp))
            Button(text = "Refresh", onClick = actionRunCallback<RefreshAction>())
        }
    }
}

Glance limited to Compose subset — not all modifiers and components available. GlanceModifier differs from standard Modifier. State via GlanceStateDefinition and updateAppWidgetState. Best choice for new projects on API 23+.

Widget Configuration by User

AppWidgetConfigure Activity — opens on widget add. User selects parameters (city, theme, displayed data). After selection: setResult(Activity.RESULT_OK, intent.putExtra(EXTRA_APPWIDGET_ID, widgetId)) — mandatory, else widget won't add.

In Glance: GlanceAppWidgetManager().startConfigureActivityIntent — launch configuration programmatically.

Timeframe: 3-5 days for one widget with data and configuration. With collection and push-updates — up to 1 week. Cost calculated individually.