#import <engine/AudioSession.h>
#import <engine/CUEEngine.h>
if( ! [AudioSession setup] ) {
NSLog( @"Error setting up AudioSession" );
}
[CUEEngine.sharedInstance setupWithAPIKey:API_KEY];
[CUEEngine.sharedInstance setReceiverCallback:
^void( NSString* jsonString )
{
NSLog(@"Detected ultrasonic payload with JSON: %@", jsonString);
}];
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
#import <engine/AudioSession.h>
#import <engine/CUEEngine.h>
if( ! [AudioSession setup] ) {
NSLog( @"Error setting up AudioSession" );
}
[CUEEngine.sharedInstance setupWithAPIKey:API_KEY];
[CUEEngine.sharedInstance setReceiverCallback:
^void( NSString* jsonString )
{
NSLog(@"Detected ultrasonic payload with JSON: %@", jsonString);
}];
if( ! AudioSession.setup() ) {
print("Error setting up AudioSession" );
}
let instance = CUEEngine.sharedInstance() as! CUEEngine
instance.setup(withAPIKey: API_KEY)
instance.setReceiverCallback() { (json: Optional) -> () in
guard let json = json else { return }
//convert json string to dictionary
let data = json.data(using: .utf8)
do {
let cueJson = try JSONSerialization.jsonObject(with: data! , options: []) as? [String: Any]
print("Detected ultrasonic payload with JSON: \(cueJson)")
} catch {
print(error.localizedDescription)
}
}
instance.startListening()
CUEEngine.getInstance().setupWithAPIKey(this, API_KEY);
CUEEngine.getInstance().setReceiverCallback(new CUEReceiverCallbackInterface() {
@Override
public void run(@NonNull String json) {
final CUETrigger model = CUETrigger.parse(json);
Log.i(TAG, "Detected ultrasonic payload with JSON: " + model);
}
});
CUEEngine.getInstance().setupWithAPIKey(this, API_KEY)
CUEEngine.getInstance().setReceiverCallback(object : CUEReceiverCallbackInterface() {
fun run(json: String) {
val model: CUETrigger = CUETrigger.parse(json)
Log.i(TAG, "Detected ultrasonic payload with JSON: $model")
}
})