Skip to content

Commit

Permalink
java upgrades (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
laves authored Dec 23, 2023
1 parent 0e1d89e commit 8ecffe4
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 126 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/android-demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Android Demos

on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- '.github/workflows/android-demos.yml'
- 'demo/android/**'
- '!demo/android/Activity/README.md'
pull_request:
branches: [ master, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/android-demos.yml'
- 'demo/android/**'
- '!demo/android/Activity/README.md'

jobs:
build-activity-demo:
runs-on: ubuntu-latest
defaults:
run:
working-directory: demo/android/Activity

steps:
- uses: actions/checkout@v3

- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Build
run: ./gradlew assembleDebug
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,9 @@ handle.delete()

### iOS

<!-- markdown-link-check-disable -->
The Rhino iOS binding is available via [CocoaPods](https://cocoapods.org/pods/Rhino-iOS). To import it into your iOS project, add the following line to your Podfile and run `pod install`:
<!-- markdown-link-check-enable -->

```ruby
pod 'Rhino-iOS'
Expand Down
16 changes: 9 additions & 7 deletions binding/ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Rhino is:

## Installation

The Rhino iOS binding is available via [CocoaPods](https://cocoapods.org/pods/Rhino-iOS). To import it into your iOS project, add the following line to your Podfile and run `pod install`:
<!-- markdown-link-check-disable -->
The Rhino iOS binding is available via [CocoaPods](https://cocoapods.org/pods/Rhino-iOS). To import it into your iOS project, add the following line to your Podfile and run `pod install`:
<!-- markdown-link-check-enable -->

```ruby
pod 'Rhino-iOS'
Expand Down Expand Up @@ -59,7 +61,7 @@ let accessKey = "${ACCESS_KEY}" // Obtained from Picovoice Console (https://cons
do {
let rhinoManager = try RhinoManager(
accessKey: accessKey,
contextPath: "/path/to/context/file.rhn",
contextPath: "/path/to/context/file.rhn",
onInferenceCallback: inferenceCallback)
} catch { }
```
Expand All @@ -77,27 +79,27 @@ let inferenceCallback: ((Inference) -> Void) = { inference in
}
```

You can override the default Rhino model file and/or the inference sensitivity.
You can override the default Rhino model file and/or the inference sensitivity.

Sensitivity is the parameter that enables trading miss rate for the false alarm rate. It is a floating-point number within [0, 1]. A higher sensitivity reduces the miss rate at the cost of increased false alarm rate.
Sensitivity is the parameter that enables trading miss rate for the false alarm rate. It is a floating-point number within [0, 1]. A higher sensitivity reduces the miss rate at the cost of increased false alarm rate.

The model file contains the parameters for the speech-to-intent engine. To change the language that Rhino understands, you'll pass in a different model file.
The model file contains the parameters for the speech-to-intent engine. To change the language that Rhino understands, you'll pass in a different model file.

These optional parameters can be set like so:
```swift
let accessKey = "${ACCESS_KEY}" // Obtained from Picovoice Console (https://console.picovoice.ai)
do {
let rhinoManager = try RhinoManager(
accessKey: accessKey,
contextPath: "/path/to/context/file.rhn",
contextPath: "/path/to/context/file.rhn",
modelPath: "/path/to/model/file.pv",
sensitivity: 0.35,
onInferenceCallback: inferenceCallback)
} catch { }
```

Once you have instantiated a RhinoManager, you can start audio capture and intent inference using the `.process()` function.
Audio capture stops and rhino resets once an inference result is returned via the inference callback.
Audio capture stops and rhino resets once an inference result is returned via the inference callback.

```swift
do {
Expand Down
13 changes: 7 additions & 6 deletions demo/android/Activity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
defaultTargetSdkVersion = 31
defaultTargetSdkVersion = 33
}

buildscript {
Expand All @@ -10,14 +9,16 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.4.2'
}
}

allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs << "-Xlint:deprecation"
}
}
}

Expand All @@ -27,6 +28,6 @@ allprojects {
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3 changes: 2 additions & 1 deletion demo/android/Activity/rhino-activity-demo-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import groovy.json.JsonSlurper
apply plugin: 'com.android.application'

android {
compileSdkVersion defaultTargetSdkVersion
compileSdk defaultTargetSdkVersion

defaultConfig {
applicationId "ai.picovoice.rhinodemo"
Expand Down Expand Up @@ -73,6 +73,7 @@ android {
lint {
abortOnError false
}
namespace 'ai.picovoice.rhinodemo'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ai.picovoice.rhinodemo">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Expand Down
2 changes: 1 addition & 1 deletion demo/flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdk 33

lintOptions {
disable 'InvalidPackage'
Expand Down
4 changes: 2 additions & 2 deletions demo/flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.android.tools.build:gradle:7.4.2'
}
}

Expand All @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit 8ecffe4

Please sign in to comment.