Hi again
I ran uno build -tandroid
and got tonnes of errors like these
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/foreign/ActivityRecognitionModule.java:38: error: not a statement
debug_log "Sup!";
^
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/foreign/ActivityRecognitionModule.java:38: error: ';' expected
debug_log "Sup!";
^
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/apps/touringtrackpro/DetectedActivitiesIntentService.java:69: error: illegal start of expression
::g::ActivityRecognitionModule::FireEventImpl("IN_VEHICLE", da.getConfidence());
^
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/apps/touringtrackpro/DetectedActivitiesIntentService.java:69: error: method references are not supported in -source 1.7
::g::ActivityRecognitionModule::FireEventImpl("IN_VEHICLE", da.getConfidence());
^
(use -source 8 or higher to enable method references)
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/apps/touringtrackpro/DetectedActivitiesIntentService.java:69: error: not a statement
::g::ActivityRecognitionModule::FireEventImpl("IN_VEHICLE", da.getConfidence());
^
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/apps/touringtrackpro/DetectedActivitiesIntentService.java:69: error: ';' expected
::g::ActivityRecognitionModule::FireEventImpl("IN_VEHICLE", da.getConfidence());
^
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/apps/touringtrackpro/DetectedActivitiesIntentService.java:69: error: ';' expected
::g::ActivityRecognitionModule::FireEventImpl("IN_VEHICLE", da.getConfidence());
^
/Users/Baggers/Downloads/tour-tracking/build/Android/Debug/app/src/main/java/com/apps/touringtrackpro/DetectedActivitiesIntentService.java:74: error: illegal start of expression
::g::ActivityRecognitionModule::FireEventImpl("ON_BICYCLE", da.getConfidence());
^
::g::ActivityRecognitionModule::FireEventImpl("IN_VEHICLE", da.getConfidence());
this looks like c++, but the file is .java
weird
Oh, onHandleIntent
is calling back to uno using the macros. That doesnt work for java files unfortunately.
This is mentioned in https://docs.fusetools.com/native-interop/foreign-code.html#external-source-files (but not very clearly)
Processing of Java files is not yet possible, but will be coming soon.
… it hasnt ‘come soon’
The way to call back is to pass in functions https://docs.fusetools.com/native-interop/foreign-code.html#delegates.
There is also a dirty ‘secret’ way, but this is unsupported so if it doesn’t work then sorry but there wont be help for it:
Make an uno method with the attribute [Foreign(Language.Java), ForeignFixedName]
for example
static class Foo
{
[Foreign(Language.Java), ForeignFixedName]
static void Bar()
{
debug_log("HI!");
}
}
You can then call this method from a java file by with com.foreign.Foo.Bar();
You can see and example of this used here:
However, if you can use the delegates it’s better
I hope this helps!