├── demo ├── app │ ├── app-root.xml │ ├── app.ts │ ├── App_Resources │ │ ├── iOS │ │ │ ├── Assets.xcassets │ │ │ │ ├── Contents.json │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── icon-20.png │ │ │ │ │ ├── icon-29.png │ │ │ │ │ ├── icon-40.png │ │ │ │ │ ├── icon-76.png │ │ │ │ │ ├── icon-1024.png │ │ │ │ │ ├── icon-20@2x.png │ │ │ │ │ ├── icon-20@3x.png │ │ │ │ │ ├── icon-29@2x.png │ │ │ │ │ ├── icon-29@3x.png │ │ │ │ │ ├── icon-40@2x.png │ │ │ │ │ ├── icon-40@3x.png │ │ │ │ │ ├── icon-60@2x.png │ │ │ │ │ ├── icon-60@3x.png │ │ │ │ │ ├── icon-76@2x.png │ │ │ │ │ ├── icon-83.5@2x.png │ │ │ │ │ └── Contents.json │ │ │ │ ├── LaunchScreen.Center.imageset │ │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ │ ├── LaunchScreen-Center@2x.png │ │ │ │ │ ├── LaunchScreen-Center@3x.png │ │ │ │ │ └── Contents.json │ │ │ │ └── LaunchScreen.AspectFill.imageset │ │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ │ ├── LaunchScreen-AspectFill@2x.png │ │ │ │ │ ├── LaunchScreen-AspectFill@3x.png │ │ │ │ │ └── Contents.json │ │ │ ├── build.xcconfig │ │ │ ├── Info.plist │ │ │ └── LaunchScreen.storyboard │ │ └── Android │ │ │ ├── src │ │ │ └── main │ │ │ │ ├── res │ │ │ │ ├── values-v21 │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── logo.png │ │ │ │ │ └── background.png │ │ │ │ ├── drawable-ldpi │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── logo.png │ │ │ │ │ └── background.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── logo.png │ │ │ │ │ └── background.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── logo.png │ │ │ │ │ └── background.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── logo.png │ │ │ │ │ └── background.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── logo.png │ │ │ │ │ └── background.png │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ └── drawable-nodpi │ │ │ │ │ └── splash_screen.xml │ │ │ │ └── AndroidManifest.xml │ │ │ └── app.gradle │ ├── package.json │ ├── app.css │ └── home │ │ ├── home-page.xml │ │ ├── shake-detector.ts │ │ └── home-page.ts ├── tsfmt.json ├── tsconfig.tns.json ├── .editorconfig ├── .gitignore ├── tsconfig.json ├── package.json └── LICENSE ├── demo-angular ├── tsfmt.json ├── src │ ├── app │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── home │ │ │ ├── home-routing.module.ts │ │ │ ├── home.module.ts │ │ │ ├── home.component.ts │ │ │ └── home.component.html │ │ ├── app-routing.module.ts │ │ ├── app.module.ts │ │ └── accelerometer.service.ts │ ├── package.json │ ├── main.ts │ └── app.css ├── nsconfig.json ├── App_Resources │ ├── iOS │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── icon-20.png │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-1024.png │ │ │ │ ├── icon-20@2x.png │ │ │ │ ├── icon-20@3x.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ ├── icon-83.5@2x.png │ │ │ │ └── Contents.json │ │ │ ├── LaunchScreen.Center.imageset │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ ├── LaunchScreen-Center@2x.png │ │ │ │ ├── LaunchScreen-Center@3x.png │ │ │ │ └── Contents.json │ │ │ └── LaunchScreen.AspectFill.imageset │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ ├── LaunchScreen-AspectFill@2x.png │ │ │ │ ├── LaunchScreen-AspectFill@3x.png │ │ │ │ └── Contents.json │ │ ├── build.xcconfig │ │ ├── Info.plist │ │ └── LaunchScreen.storyboard │ └── Android │ │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable-hdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ ├── drawable-ldpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── drawable-nodpi │ │ │ │ └── splash_screen.xml │ │ │ └── AndroidManifest.xml │ │ └── app.gradle ├── tsconfig.tns.json ├── .editorconfig ├── angular.json ├── .gitignore ├── tsconfig.json ├── package.json └── LICENSE ├── publish ├── publish.sh ├── package.json └── pack.sh ├── src ├── .npmignore ├── messages.ts ├── index.d.ts ├── tsconfig.json ├── index.ios.ts ├── package.json └── index.android.ts ├── .gitignore ├── CHANGELOG.md ├── README.md ├── LICENSE ├── tslint.json └── .travis.yml /demo/app/app-root.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /demo/tsfmt.json: -------------------------------------------------------------------------------- 1 | { 2 | "indentSize": 4, 3 | "tabSize": 4 4 | } 5 | -------------------------------------------------------------------------------- /demo-angular/tsfmt.json: -------------------------------------------------------------------------------- 1 | { 2 | "indentSize": 4, 3 | "tabSize": 4 4 | } 5 | -------------------------------------------------------------------------------- /demo-angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /demo-angular/nsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "appResourcesPath": "App_Resources", 3 | "appPath": "src" 4 | } 5 | -------------------------------------------------------------------------------- /demo/app/app.ts: -------------------------------------------------------------------------------- 1 | import { run } from "tns-core-modules/application"; 2 | 3 | run({ moduleName: "app-root" }); -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "app.js", 3 | "android": { 4 | "v8Flags": "--expose_gc", 5 | "markingMode": "none" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /demo-angular/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "main.js", 3 | "android": { 4 | "v8Flags": "--expose_gc", 5 | "markingMode": "none" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /demo/tsconfig.tns.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "module": "esNext", 5 | "moduleResolution": "node" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /demo-angular/tsconfig.tns.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "module": "esNext", 5 | "moduleResolution": "node" 6 | } 7 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /publish/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PACK_DIR=package; 4 | 5 | publish() { 6 | cd $PACK_DIR 7 | echo 'Publishing to npm...' 8 | npm publish *.tgz 9 | } 10 | 11 | ./pack.sh && publish -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | 3 | @Component({ 4 | selector: "ns-app", 5 | templateUrl: "app.component.html" 6 | }) 7 | export class AppComponent { } 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /src/.npmignore: -------------------------------------------------------------------------------- 1 | *.map 2 | *.ts 3 | !*.d.ts 4 | tsconfig.json 5 | scripts/* 6 | platforms/android/* 7 | !platforms/android/include.gradle 8 | !platforms/android/*.aar 9 | !platforms/android/*.jar 10 | .DS_Store -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /publish/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nativescript-publish", 3 | "version": "1.0.0", 4 | "description": "Publish helper", 5 | "devDependencies": { 6 | "ncp": "^2.0.0", 7 | "rimraf": "^2.5.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/triniwiz/native-script-accelerometer/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png -------------------------------------------------------------------------------- /demo/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | charset = utf-8 8 | 9 | [*.json] 10 | indent_style = space 11 | indent_size = 2 12 | 13 | [*.ts] 14 | indent_style = space 15 | indent_size = 4 16 | -------------------------------------------------------------------------------- /demo-angular/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | charset = utf-8 8 | 9 | [*.json] 10 | indent_style = space 11 | indent_size = 2 12 | 13 | [*.ts] 14 | indent_style = space 15 | indent_size = 4 16 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /demo-angular/src/main.ts: -------------------------------------------------------------------------------- 1 | // this import should be first in order to load some required settings (like globals and reflect-metadata) 2 | import { platformNativeScriptDynamic } from "nativescript-angular/platform"; 3 | 4 | import { AppModule } from "./app/app.module"; 5 | 6 | platformNativeScriptDynamic().bootstrapModule(AppModule); 7 | -------------------------------------------------------------------------------- /demo/app/app.css: -------------------------------------------------------------------------------- 1 | @import "~@nativescript/theme/css/core.css"; 2 | @import "~@nativescript/theme/css/default.css"; 3 | 4 | Page>GridLayout { 5 | margin: 16; 6 | } 7 | 8 | Button.-primary { 9 | font-size: 18; 10 | } 11 | 12 | Progress { 13 | transform: scaleY(3); 14 | vertical-align: middle; 15 | margin: 2 0 24 0; 16 | } -------------------------------------------------------------------------------- /src/messages.ts: -------------------------------------------------------------------------------- 1 | export const stopButNotStarted = "[nativescript-accelerometer] stopAccelerometerUpdates() called, but currently not listening. Ignoring..."; 2 | export const startButNotStopped = "[nativescript-accelerometer] startAccelerometerUpdates() called, but there is active listener. Will stop the current listener and switch to the new one."; -------------------------------------------------------------------------------- /demo-angular/src/app.css: -------------------------------------------------------------------------------- 1 | @import "~@nativescript/theme/css/core.css"; 2 | @import "~@nativescript/theme/css/default.css"; 3 | 4 | .container { 5 | margin: 16; 6 | } 7 | 8 | Button.-primary { 9 | font-size: 18; 10 | } 11 | 12 | Progress { 13 | transform: scaleY(3); 14 | vertical-align: middle; 15 | margin: 2 0 24 0; 16 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .idea 3 | .DS_Store 4 | 5 | *.esm.json 6 | *.js 7 | *.js.map 8 | *.log 9 | *.tgz 10 | 11 | node_modules 12 | publish/src 13 | publish/package/**/* 14 | 15 | src/*.d.ts 16 | !src/index.d.ts 17 | !src/references.d.ts 18 | !src/scripts/*.js 19 | 20 | demo/platforms 21 | demo/report 22 | !demo/karma.conf.js 23 | !demo/references.d.ts 24 | 25 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with XCode 8 you need to specify your development team. 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with XCode you need to specify your development team. 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | 8 | DEVELOPMENT_TEAM = CHSQ3M3P37 9 | -------------------------------------------------------------------------------- /demo-angular/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "cli": { 6 | "defaultCollection": "@nativescript/schematics" 7 | }, 8 | "projects": { 9 | "blank": { 10 | "root": "", 11 | "sourceRoot": "src", 12 | "projectType": "application", 13 | "prefix": "ns" 14 | } 15 | }, 16 | "defaultProject": "blank" 17 | } 18 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 3.0.0 (2019-10-31) 2 | 3 | 4 | ### Features 5 | 6 | * expose `isListening()` function ([ca0ed37](https://github.com/vakrilov/native-script-accelerometer/commit/ca0ed37278780c133bd6acf3988be11838e2a1d8)) 7 | * `startAccelerometerUpdates()` and `stopAccelerometerUpdates()` will no longer throw errors if listener has already started or not yet started. 8 | * **android:** using `utils.getApplicationContext()` instead of `foregroundActivity` 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | # NativeScript 2 | hooks/ 3 | node_modules/ 4 | platforms/ 5 | 6 | # NativeScript Template 7 | *.js.map 8 | *.js 9 | 10 | # Logs 11 | logs 12 | *.log 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # General 18 | .DS_Store 19 | .AppleDouble 20 | .LSOverride 21 | .idea 22 | .cloud 23 | .project 24 | tmp/ 25 | typings/ 26 | 27 | # Visual Studio Code 28 | .vscode/* 29 | !.vscode/settings.json 30 | !.vscode/tasks.json 31 | !.vscode/launch.json 32 | !.vscode/extensions.json 33 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | export interface AccelerometerData { 2 | x: number; 3 | y: number; 4 | z: number; 5 | } 6 | 7 | export type SensorDelay = "normal" | "game" | "ui" | "fastest"; 8 | export interface AccelerometerOptions { 9 | sensorDelay?: SensorDelay; 10 | } 11 | 12 | export function startAccelerometerUpdates(callback: (data: AccelerometerData) => void, options?: AccelerometerOptions): void; 13 | export function stopAccelerometerUpdates(): void; 14 | export function isListening(): boolean; -------------------------------------------------------------------------------- /demo-angular/.gitignore: -------------------------------------------------------------------------------- 1 | # NativeScript 2 | hooks/ 3 | node_modules/ 4 | platforms/ 5 | 6 | # NativeScript Template 7 | *.js.map 8 | *.js 9 | 10 | # Logs 11 | logs 12 | *.log 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # General 18 | .DS_Store 19 | .AppleDouble 20 | .LSOverride 21 | .idea 22 | .cloud 23 | .project 24 | tmp/ 25 | typings/ 26 | 27 | # Visual Studio Code 28 | .vscode/* 29 | !.vscode/settings.json 30 | !.vscode/tasks.json 31 | !.vscode/launch.json 32 | !.vscode/extensions.json 33 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from "@angular/core"; 2 | import { Routes } from "@angular/router"; 3 | import { NativeScriptRouterModule } from "nativescript-angular/router"; 4 | 5 | import { HomeComponent } from "./home.component"; 6 | 7 | const routes: Routes = [ 8 | { path: "", component: HomeComponent } 9 | ]; 10 | 11 | @NgModule({ 12 | imports: [NativeScriptRouterModule.forChild(routes)], 13 | exports: [NativeScriptRouterModule] 14 | }) 15 | export class HomeRoutingModule { } 16 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; 2 | import { NativeScriptCommonModule } from "nativescript-angular/common"; 3 | 4 | import { HomeRoutingModule } from "./home-routing.module"; 5 | import { HomeComponent } from "./home.component"; 6 | 7 | @NgModule({ 8 | imports: [ 9 | NativeScriptCommonModule, 10 | HomeRoutingModule 11 | ], 12 | declarations: [ 13 | HomeComponent 14 | ], 15 | schemas: [ 16 | NO_ERRORS_SCHEMA 17 | ] 18 | }) 19 | export class HomeModule { } 20 | -------------------------------------------------------------------------------- /demo-angular/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from "@angular/core"; 2 | import { Routes } from "@angular/router"; 3 | import { NativeScriptRouterModule } from "nativescript-angular/router"; 4 | 5 | const routes: Routes = [ 6 | { path: "", redirectTo: "/home", pathMatch: "full" }, 7 | { path: "home", loadChildren: () => import("~/app/home/home.module").then((m) => m.HomeModule) } 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [NativeScriptRouterModule.forRoot(routes)], 12 | exports: [NativeScriptRouterModule] 13 | }) 14 | export class AppRoutingModule { } 15 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchScreen-Center@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchScreen-Center@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchScreen-AspectFill@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchScreen-AspectFill@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "noEmitHelpers": true, 8 | "noEmitOnError": true, 9 | "skipLibCheck": true, 10 | "lib": [ 11 | "es6", 12 | "dom" 13 | ], 14 | "baseUrl": ".", 15 | "paths": { 16 | "~/*": [ 17 | "app/*" 18 | ], 19 | "*": [ 20 | "./node_modules/*" 21 | ] 22 | } 23 | }, 24 | "exclude": [ 25 | "node_modules", 26 | "platforms", 27 | "../src/node_modules" 28 | ], 29 | "include": [ 30 | "../src", 31 | "**/*" 32 | ] 33 | } -------------------------------------------------------------------------------- /demo-angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; 2 | import { NativeScriptModule } from "nativescript-angular/nativescript.module"; 3 | 4 | import { AppRoutingModule } from "./app-routing.module"; 5 | import { AppComponent } from "./app.component"; 6 | 7 | @NgModule({ 8 | bootstrap: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | NativeScriptModule, 13 | AppRoutingModule 14 | ], 15 | declarations: [ 16 | AppComponent 17 | ], 18 | schemas: [ 19 | NO_ERRORS_SCHEMA 20 | ] 21 | }) 22 | export class AppModule { } 23 | -------------------------------------------------------------------------------- /demo-angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "noEmitHelpers": true, 8 | "noEmitOnError": true, 9 | "skipLibCheck": true, 10 | "lib": [ 11 | "es6", 12 | "dom", 13 | "es2015.iterable" 14 | ], 15 | "baseUrl": ".", 16 | "paths": { 17 | "~/*": [ 18 | "src/*" 19 | ], 20 | "*": [ 21 | "./node_modules/*" 22 | ] 23 | } 24 | }, 25 | "exclude": [ 26 | "node_modules", 27 | "platforms", 28 | "../src/node_modules" 29 | ], 30 | "include": [ 31 | "../src", 32 | "**/*" 33 | ] 34 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // implementation 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | // If you want to add something to be applied before applying plugins' include.gradle files 9 | // e.g. project.ext.googlePlayServicesVersion = "15.0.1" 10 | // create a file named before-plugins.gradle in the current directory and place it there 11 | 12 | android { 13 | defaultConfig { 14 | minSdkVersion 17 15 | generatedDensities = [] 16 | } 17 | aaptOptions { 18 | additionalParameters "--no-version-vectors" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // implementation 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | // If you want to add something to be applied before applying plugins' include.gradle files 9 | // e.g. project.ext.googlePlayServicesVersion = "15.0.1" 10 | // create a file named before-plugins.gradle in the current directory and place it there 11 | 12 | android { 13 | defaultConfig { 14 | minSdkVersion 17 15 | generatedDensities = [] 16 | } 17 | aaptOptions { 18 | additionalParameters "--no-version-vectors" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "nativescript": { 3 | "id": "org.nativescript.demo", 4 | "tns-ios": { 5 | "version": "6.2.0" 6 | }, 7 | "tns-android": { 8 | "version": "6.2.0" 9 | } 10 | }, 11 | "description": "NativeScript Application", 12 | "license": "SEE LICENSE IN ", 13 | "repository": "", 14 | "dependencies": { 15 | "nativescript-accelerometer": "file:../src", 16 | "@nativescript/theme": "2.2.0", 17 | "tns-core-modules": "~6.2.0" 18 | }, 19 | "devDependencies": { 20 | "nativescript-dev-webpack": "~1.3.0", 21 | "typescript": "~3.5.3" 22 | }, 23 | "gitHead": "1964ea9e8ca1a0518e0d6370781eedcf6c23db42", 24 | "readme": "NativeScript Application" 25 | } 26 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from "@angular/core"; 2 | import { Observable } from "rxjs"; 3 | import { AccelerometerData } from "nativescript-accelerometer"; 4 | import { AccelerometerService } from "../accelerometer.service"; 5 | 6 | @Component({ 7 | selector: "Home", 8 | templateUrl: "./home.component.html" 9 | }) 10 | export class HomeComponent implements OnInit { 11 | data$: Observable 12 | constructor(public accService: AccelerometerService) { 13 | this.data$ = accService.data$; 14 | } 15 | 16 | ngOnInit(): void { 17 | this.accService.start(); 18 | } 19 | 20 | toggleUpdates() { 21 | if (this.accService.isListening()) { 22 | this.accService.stop(); 23 | } else { 24 | this.accService.start(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "noImplicitAny": false, 6 | "removeComments": true, 7 | "preserveConstEnums": true, 8 | "sourceMap": false, 9 | "declaration": false, 10 | "noLib": false, 11 | "noEmitHelpers": true, 12 | "experimentalDecorators": true, 13 | "emitDecoratorMetadata": true, 14 | "noImplicitUseStrict": true, 15 | "noEmitOnError": true, 16 | "lib": [ 17 | "es6", 18 | "dom" 19 | ], 20 | "baseUrl": ".", 21 | "paths": { 22 | "*": [ 23 | "./node_modules/tns-core-modules/*", 24 | "./node_modules/*" 25 | ] 26 | } 27 | }, 28 | "exclude": [ 29 | "node_modules", 30 | "platforms", 31 | "demo" 32 | ] 33 | } -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NativeScript Accelerometer Plugin 2 | Accelerometer plugin for NativeScript 3 | 4 | ## Installation 5 | ``` 6 | tns plugin add nativescript-accelerometer 7 | ``` 8 | 9 | ## Usage 10 | ``` 11 | var accelerometer = require("nativescript-accelerometer"); 12 | 13 | accelerometer.startAccelerometerUpdates(function(data) { 14 | console.log("x: " + data.x + "y: " + data.y + "z: " + data.z); 15 | }, { sensorDelay: "ui" }); 16 | ``` 17 | 18 | ## Expected Values 19 | 20 | * x 21 | * Tilt Left from -1 to 0 22 | * Tilt Right from 0 to 1 23 | * y 24 | * Tilt Forward from 0 to 1 25 | * Tilt Back from -1 to 0 26 | * z 27 | * Face Up -1 28 | * Face Down 1 29 | * Sideways 0 30 | 31 | ## Options 32 | 33 | You can control how often the callback will be called by setting the `sensorDelay` option. The values are: 34 | * `"normal"` - Suitable for screen orientation changes. Around 0.2 seconds. 35 | * `"ui"` - Suitable for the user interface. Around 0.06 seconds. 36 | * `"game"` - Suitable for games. Around 0.02 seconds. 37 | * `"fastest"` - Sensor data as fast as possible. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Alexander Vakrilov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo-angular/src/app/accelerometer.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, OnDestroy } from '@angular/core'; 2 | import { startAccelerometerUpdates, AccelerometerData, stopAccelerometerUpdates, isListening } from "nativescript-accelerometer"; 3 | import { BehaviorSubject, Observable } from "rxjs"; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class AccelerometerService implements OnDestroy { 9 | private _data$: BehaviorSubject = new BehaviorSubject({ x: 0, y: 0, z: 0 }); 10 | 11 | get data$(): Observable { 12 | return this._data$; 13 | } 14 | 15 | constructor() { } 16 | 17 | start() { 18 | startAccelerometerUpdates((data) => { 19 | // console.dir(data); 20 | this._data$.next(data); 21 | }, { sensorDelay: "ui" }); 22 | } 23 | 24 | stop() { 25 | stopAccelerometerUpdates(); 26 | } 27 | 28 | isListening() { 29 | return isListening(); 30 | } 31 | 32 | ngOnDestroy() { 33 | console.log("AccelerometerService.ngOnDestroy()") 34 | if (this.isListening()) { 35 | this.stop(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /publish/pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOURCE_DIR=../src; 4 | TO_SOURCE_DIR=src; 5 | PACK_DIR=package; 6 | ROOT_DIR=..; 7 | PUBLISH=--publish 8 | 9 | install(){ 10 | npm i 11 | } 12 | 13 | pack() { 14 | 15 | echo 'Clearing /src and /package...' 16 | node_modules/.bin/rimraf "$TO_SOURCE_DIR" 17 | node_modules/.bin/rimraf "$PACK_DIR" 18 | 19 | # copy src 20 | echo 'Copying src...' 21 | node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR" 22 | 23 | # copy README & LICENSE to src 24 | echo 'Copying README and LICENSE to /src...' 25 | node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE 26 | node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md 27 | 28 | # compile package and copy files required by npm 29 | echo 'Building /src...' 30 | cd "$TO_SOURCE_DIR" 31 | node_modules/.bin/tsc 32 | cd .. 33 | 34 | echo 'Creating package...' 35 | # create package dir 36 | mkdir "$PACK_DIR" 37 | 38 | # create the package 39 | cd "$PACK_DIR" 40 | npm pack ../"$TO_SOURCE_DIR" 41 | 42 | # delete source directory used to create the package 43 | cd .. 44 | node_modules/.bin/rimraf "$TO_SOURCE_DIR" 45 | } 46 | 47 | install && pack -------------------------------------------------------------------------------- /demo-angular/src/app/home/home.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo-angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "nativescript": { 3 | "id": "org.nativescript.demoangular", 4 | "tns-ios": { 5 | "version": "6.2.0" 6 | }, 7 | "tns-android": { 8 | "version": "6.2.0" 9 | } 10 | }, 11 | "description": "NativeScript Application", 12 | "license": "SEE LICENSE IN ", 13 | "repository": "", 14 | "dependencies": { 15 | "@angular/animations": "~8.2.0", 16 | "@angular/common": "~8.2.0", 17 | "@angular/compiler": "~8.2.0", 18 | "@angular/core": "~8.2.0", 19 | "@angular/forms": "~8.2.0", 20 | "@angular/platform-browser": "~8.2.0", 21 | "@angular/platform-browser-dynamic": "~8.2.0", 22 | "@angular/router": "~8.2.0", 23 | "@nativescript/theme": "2.2.0", 24 | "nativescript-angular": "~8.2.0", 25 | "nativescript-accelerometer": "file:../src", 26 | "reflect-metadata": "~0.1.12", 27 | "rxjs": "^6.4.0", 28 | "tns-core-modules": "~6.2.0", 29 | "zone.js": "~0.9.1" 30 | }, 31 | "devDependencies": { 32 | "@angular/compiler-cli": "~8.2.0", 33 | "@ngtools/webpack": "~8.2.0", 34 | "nativescript-dev-webpack": "~1.3.0", 35 | "typescript": "~3.5.3" 36 | }, 37 | "gitHead": "1964ea9e8ca1a0518e0d6370781eedcf6c23db42", 38 | "readme": "NativeScript Application" 39 | } 40 | -------------------------------------------------------------------------------- /demo/app/home/home-page.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |