All Projects → bradmartin → nativescript-wear-os

bradmartin / nativescript-wear-os

Licence: Apache-2.0 License
Consolidated repo for WearOS with NativeScript

Programming Languages

typescript
32286 projects
shell
77523 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nativescript-wear-os

Twelveish
🕛 Twelveish - Android Wear/Wear OS Watch Face
Stars: ✭ 29 (+7.41%)
Mutual labels:  wearable, wear-os
GoFIT SDK Android
GoFIT SDK for Android — GOLiFE 手環 App 介接 SDK
Stars: ✭ 32 (+18.52%)
Mutual labels:  wearable, wearable-devices
AnalogWatchFace
⌚ Analog Watch Face for Wear OS
Stars: ✭ 68 (+151.85%)
Mutual labels:  wearable, wear-os
ToDometer Multiplatform
WIP Kotlin Multiplatform project: A meter to-do list built with Android Jetpack, Compose UI Multiplatform, Wear Compose, SQLDelight, Koin Multiplatform, SwiftUI, Ktor Server / Client, Exposed...
Stars: ✭ 145 (+437.04%)
Mutual labels:  wear-os
nativescript-auth0
Nativescript Auth0 https://auth0.com/ social authentication plugin
Stars: ✭ 57 (+111.11%)
Mutual labels:  nativescript
nativescript-swipe-card
Swipe Card plugin for nativescript
Stars: ✭ 21 (-22.22%)
Mutual labels:  nativescript
nativescript-printer
📠 Send an image or the screen contents to a physical printer
Stars: ✭ 33 (+22.22%)
Mutual labels:  nativescript
nativescript-snackbar
NativeScript plugin for Material Design Snackbar
Stars: ✭ 22 (-18.52%)
Mutual labels:  nativescript
nativescript-performance-monitor
⚡ Proof your app maintains 60-ish FPS by collecting data or showing it on screen with this NativeScript plugin!
Stars: ✭ 21 (-22.22%)
Mutual labels:  nativescript
WearableSensorData
This repository provides the codes and data used in our paper "Human Activity Recognition Based on Wearable Sensor Data: A Standardization of the State-of-the-Art", where we implement and evaluate several state-of-the-art approaches, ranging from handcrafted-based methods to convolutional neural networks.
Stars: ✭ 65 (+140.74%)
Mutual labels:  wearable-devices
lazyNinjas
No description or website provided.
Stars: ✭ 25 (-7.41%)
Mutual labels:  nativescript
nativescript-fabric
Handling App URLs in nativescript apps
Stars: ✭ 29 (+7.41%)
Mutual labels:  nativescript
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (+18.52%)
Mutual labels:  nativescript
nativescript-app-shortcuts
👇 Home Icon Actions for your NativeScript app, now also for Android!
Stars: ✭ 45 (+66.67%)
Mutual labels:  nativescript
nativescript-vue-router
A simple router implementation that is suitable for NativeScript-Vue.
Stars: ✭ 14 (-48.15%)
Mutual labels:  nativescript
insomnia
😪 NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
Stars: ✭ 40 (+48.15%)
Mutual labels:  nativescript
eye-contact-cnn
Deep neural network trained to detect eye contact from facial image
Stars: ✭ 31 (+14.81%)
Mutual labels:  wearable-devices
ui
Add right-to-left support to the NativeScript framework
Stars: ✭ 22 (-18.52%)
Mutual labels:  nativescript
nativescript-react
Build native application using React and Nativescript.
Stars: ✭ 14 (-48.15%)
Mutual labels:  nativescript
nativescript-vue-multi-drawer
A NativeScript-Vue component for creating multiple side drawers (4 sides supported)
Stars: ✭ 45 (+66.67%)
Mutual labels:  nativescript

NativeScript Wear OS

NativeScript-Wear-OS is a NativeScript plugin that provides layouts and utilities specific to WearOS.

Action Build npm npm


Installation

NativeScript Version 7+:

tns plugin add nativescript-wear-os

NativeScript version prior to 7:

tns plugin add [email protected]

Ambient Mode Support

Documentation: https://developer.android.com/training/wearables/apps/always-on
  1. Add the WAKE_LOCK permission to your AndroidManifest.xml
	<uses-permission android:name="android.permission.WAKE_LOCK" />
  1. Copy the ambient-activity.ts in the root of this project's demo app and use it to replace the default Android Activity loaded by NativeScript. NativeScript docs HERE about using a custom Android Activity.

  2. Update the AndroidManifest.xml for your application to use the correct activity. Change the android:name value of the activity node to point to the same name used inside the ambient-activity.ts file inside the @JavaProxy() decorator at the top of the file.

		<activity android:name="com.nativescript.AmbientActivity" android:label="@string/title_activity_kimera" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/LaunchScreenTheme">
  1. Update your webpack.config to include the custom Android Activity. Snippet below copied from the demo app.
// Add your custom Activities, Services and other Android app components here.
const appComponents = [
  '@nativescript/core/ui/frame',
  '@nativescript/core/ui/frame/activity',
  resolve(__dirname, 'app/ambient-activity'),
];

WearOsLayout

A base layout for Wear OS apps built with NativeScript that automatically handles calculating the inset for circle watch faces. To disable the layout from automatically adjusting the inset set disableInsetConstraint="true" on the WearOsLayout instance. The default is false and does not have to be set.

This has no effect on square watches.

<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true"
    xmlns:ui="nativescript-wear-os/packages/wear-os-layout">
    <ui:WearOsLayout disableInsetConstraint="false">
      <ScrollView height="100%">
        <StackLayout>
            <Label text="Going to put a long string of text so we can fill the screen with other view components to show how this works on Circle and Square watch faces." class="c-white" textWrap="true" />
            <GridLayout rows="auto, auto, auto" columns="*, *, *">
                <Button text="Go Back" tap="navBack" class="yellowBtn" row="0" col="0" />
                <Image src="res://icon" stretch="aspectFit" row="0" col="1" />
                <Button text="Wow" class="greenBtn" row="0" col="2" />
                <Button text="Fantastic" row="1" col="0" />
                <Label text="Something something something" class="c-white" row="1" col="1" textWrap="true" />
                <Label text="Something Text" row="1" col="2" />
                <Button text="Yay" row="2" col="0" />
                <Image src="res://icon" stretch="aspectFit" row="2" col="1" />
                <Button text="Okay" row="2" col="2" />
            </GridLayout>
          </StackLayout>
        </ScrollView>
    </ui:WearOsLayout>
</Page>
Circle Watch Square Watch
Cirlce Watch Usage Square Watch Usage

WearOsListView

<Page xmlns="http://schemas.nativescript.org/tns.xsd"
  xmlns:wear="nativescript-wear-os/packages/listview">
  <StackLayout>
    <wear:WearOsListView useScalingScroll="true" height="100%" items="{{ items }}">
      <wear:WearOsListView.itemTemplate>
        <GridLayout rows="*" columns="auto, *">
          <Image src="{{ image }}" row="0" col="0" />
          <Label text="{{ title }}" row="0" col="1" />
        </GridLayout>
      </wear:WearOsListView.itemTemplate>
    </wear:WearOsListView>
  </StackLayout>
</Page>
API

useScalingScroll - If true, the items in the listview will scale during the scroll layout change event.

ListView Gif


BoxInsetLayout

<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" actionBarHidden="true"
    xmlns:ui="nativescript-wear-os/packages/box-inset-layout">
    <ui:BoxInsetLayout>
        <StackLayout height="100%" width="100%">
            <Label text="This is a box inset layout. It's purpose is for short views so you don't have to calculate the inset for your layout manually. So don't try using a ScrollView with it." class="text-white" textWrap="true"/>
            <GridLayout rows="50" columns="*, *">
                <Button col="0" text="Go Back" class="greyBtn" tap="navBack" />
                <Button col="1" text="Okay" class="yellowBtn" />
            </GridLayout>
        </StackLayout>
    </ui:BoxInsetLayout>
</Page>

BoxInsetLayout Usage

Dialogs

This plugin uses an Android WearOS specific library SmartWearOs.

The plugin has a success dialog and failure/error dialog to present on WearOS. These mimic the behavior of the built in Confirmation Activity on WearOS. With the option of setting the time before it is dismissed/hidden from the user.

Usage

import {
  showFailure,
  showSuccess,
} from 'nativescript-wear-os/packages/dialogs';

showSuccess('Great choice! NativeScript is awesome.', 4).then(() => {
  console.log('success dialog complete.');
});

Success Activity Failure Activity

Change Log

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].