How much is your home screen useful with just icons? Not so much...Deep dive how to differentiate the home screen in order to increases user engagement, decreases the chance that an app will be uninstalled and increases the likelihood of its being used...
Deck was presented in Droidcon NYC 19 #DCNYC19
24. Pinned Shortcuts
val shortcutManager = getSystemService(ShortcutManager::class.java)
if (shortcutManager!!.isRequestPinShortcutSupported) {
val pinShortcutInfo = ShortcutInfo.Builder(context, "my-shortcut").build()
val pinnedShortcutCallbackIntent = shortcutManager.createShortcutResultIntent(pinShortcutInfo)
val successCallback = PendingIntent.getBroadcast(context, /* request code */ 0, pinnedShortcutCallbackIntent, /* flags */ 0)
shortcutManager.requestPinShortcut(pinShortcutInfo, successCallback.intentSender)
}
25. Best practices
4 Publish max four shortcuts
4 Limit description (Short 10 chars, Long 25 chars)
4 Create over update
26. Outline
1. The status of my home screen
2. The push way - Shortcuts
3. The pull way - App widgets
27. Widgets
Enable users to interact with a piece of your
application directly in the home screen.
28. Three main components:
4 AppWidgetProviderInfo - XML resource describes
App Widget meta data
4 AppWidgetProvider - BroadcastReceiver extension
to implement the widget
4 View layout - to define the UI
34. AppWidgetProvider - onUpdate
class ExampleAppWidgetProvider : AppWidgetProvider()
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
// There may be multiple widgets active, so update all of them
for (appWidgetId in appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId)
}
}
37. Update the widget manually
/ Send a broadcast so that the Operating system updates the widget
val man = AppWidgetManager.getInstance(this)
val ids = man.getAppWidgetIds(ComponentName(this, CoffeeLoggerWidget::class.java))
val updateIntent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
sendBroadcast(updateIntent)
38. Update via Service
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val appWidgetManager = AppWidgetManager.getInstance(this)
val allWidgetIds = intent?.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS)
//1
if (allWidgetIds != null) {
//2
for (appWidgetId in allWidgetIds) {
//3
CoffeeLoggerWidget.updateAppWidget(this, appWidgetManager, appWidgetId)
}
}
return super.onStartCommand(intent, flags, startId)
}
41. Customizing Home Screen
4 Users get instant access to priority functionality
4 User can see important info without opening the app
4 Apps are more visibile in the home screen with better
entry point