AndroidWear
Android Wear app that features all the basic components from wearable support library
Install / Use
/learn @ashokslsk/AndroidWearREADME
AndroidWear
Android Wear app that features all the basic components from wearable support library.
This repository is a detailed example of building apps for android wear devices which are these days making a mark in the gadget market. To get started Developing Android wear Apps: Android wear Fundamentals
#Installation Clone the repository and check the repository from oldest commits.
#WearableListView An alternative version of ListView that is optimized for ease of use on small screen wearable devices. It displays a vertically scrollable list of items, and automatically snaps to the nearest item when the user stops scrolling. Google Developer Documentaion. With customlayout and custom adapter this example triggers a toast whenever user taps on the listitem.
##Sample Code
<android.support.wearable.view.WearableListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
mListView = (WearableListView) findViewById(R.id.list);
WearableListAdapter adapter = new WearableListAdapter();
adapter.setItems(new ArrayList(Arrays.asList(items)));
mListView.setAdapter(adapter);

#DelayedConfirmationView DelayedConfirmationView provides a circular countdown timer, typically used to automatically confirm an operation after a short delay has elapsed. The delay is intended to give the user a chance to cancel the operation by tapping the View. Google Developer Documentation
##Sample Code
public class DelayedConfirmationViewActivity extends Activity implements DelayedConfirmationView.DelayedConfirmationListener {
private DelayedConfirmationView mDelayedConfirmationView;
protected void onCreate(Bundle savedInstanceState) {
mDelayedConfirmationView = (DelayedConfirmationView) findViewById(R.id.delayed_confirmation);
mDelayedConfirmationView.setTotalTimeMs(3000);
mDelayedConfirmationView.setListener(this);
mDelayedConfirmationView.start();
}
@Override
public void onTimerFinished(View view) {
}
@Override
public void onTimerSelected(View view) {
}
}

#GridViewPager Layout manager that allows the user to navigate both vertically and horizontally through pages of content. You supply an implementation of a GridPagerAdapter to generate pages for the view to show Google Developer Documentaion
##Sample Code
<android.support.wearable.view.GridViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"/>
<android.support.wearable.view.DotsPageIndicator
android:id="@+id/page_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"/>
//Java Code
private GridViewPager mGridViewPager;
private DotsPageIndicator mPageIndicator;
mGridViewPager = (GridViewPager) findViewById(R.id.pager);
mPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
mPageIndicator.setPager(mGridViewPager);
GridViewPagerAdapter adapter = new GridViewPagerAdapter(this, getFragmentManager());
mGridViewPager.setAdapter(adapter);

#Wearable Activity Base activity class for use on wearables. Provides compatibility for Ambient mode support.
Some Wear apps are most useful when they are constantly visible to the user. For example, users out on a run can glance at their wearable to see the distance covered and time elapsed, or after recording a grocery list on their wearable, users can quickly see which items are remaining on the list as they shop at the market. Making an app constantly visible has an impact on battery life, so you should carefully consider that impact when adding this feature to your app. Google Developer Documentation.
public class MainActivity extends WearableActivity implements WearableListView.ClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
setAmbientEnabled();
}
}
//In Manifest add the following permissions
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND"/>

#Basic and MultiPage Notifications When you'd like to provide more information without requiring users to open your app on their handheld device, you can add one or more pages to the notification on the wearable. The additional pages appear immediately to the right of the main notification card.
private NotificationCompat.Builder getBaseNotificationBuilder() {
return new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Notification Title")
.setContentText("Notification text");
}
private void showBasicNotification() {
NotificationCompat.Builder builder = getBaseNotificationBuilder();
NotificationManagerCompat.from(this).notify(1,builder.build());
}

#Stacked and Action Button Notifications When creating notifications for a handheld device, you should always aggregate similar notifications into a single summary notification. For example, if your app creates notifications for received messages, you should not show more than one notification on a handheld device—when more than one is message is received, use a single notification to provide a summary such as "2 new messages." Google Developer Documentation
private void showMultiPageNotification() {
NotificationCompat.Builder builder = getBaseNotificationBuilder();
Notification notificationpage = getBaseNotificationBuilder().build();
NotificationManagerCompat.from(this).notify(1, builder.extend(new NotificationCompat.WearableExtender()
.addPage(notificationpage)
.addPage(notificationpage)
.addPage(notificationpage)).build());
}

#Voice Reply Notifications If you have handheld notifications that include an action to input text, such as reply to an email, it should normally launch an activity on the handheld device to input the text. However, when your notification appears on a wearable, there is no keyboard input, so you can let users dictate a reply or provide pre-defined text messages using RemoteInput. Google Developer Documentation
private void showReplyNotification(){
NotificationCompat.Builder builder = getBaseNotificationBuilder();
String[] replies = getResources().getStringArray(R.array.reply_items);
RemoteInput remoteInput = new RemoteInput.Builder("reply")
.setLabel("Label")
.setChoices(replies)
.build();
Intent replyIntent = new Intent(this,MainActivity.class);
PendingIntent replyPendingIntent = PendingIntent.getActivity(this, 0, replyIntent ,PendingIntent.FLAG_UPDATE_CURRENT);
builder.extend(new NotificationCompat.WearableExtender().addAction(new NotificationCompat.Action.Builder(
R.mipmap.ic_launcher,"Reply Ashu",replyPendingIntent
).addRemoteInput(remoteInput).build()));
NotificationManagerCompat.from(this).notify(1,builder.build());
}

#Custom Notifications Creating layouts for wearables is the same as handheld devices, except you have to design for the screen size and for glanceability. Do not port functionality and the UI from a handheld app and expect a good experience. You should create custom layouts only when necessary. Read the design guidelines for information on how to design great wearable apps. Google Developer Documentation
private void showCustomNotification() {
NotificationCompat.Builder builder = getBaseNotificatio
Related Skills
openhue
343.1kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
343.1kElevenLabs text-to-speech with mac-style say UX.
weather
343.1kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.5kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
