0

I am trying to write an nativescript application for android... i have a javascript file from where i need to call a intent to start a service. The code which i want to invoke in my javascript file is in https://github.com/NativeScript/nativescript-geolocation/blob/master/demo/app/main-page.ts from line 35 to 47. Also i have to port the entire piece of source of code present in https://github.com/NativeScript/nativescript-geolocation/blob/master/demo/app/background-service.ts to javascript file. i am not sure how to port code " @JavaProxy("com.nativescript.location.BackgroundService")" to javascript.

Regards, Akarsh

1 Answer 1

2

The JavaScript translation of @JavaProxy("com.nativescript.location.BackgroundService") would be,

    var BackgroundService = android.app.Service.extend("com.nativescript.location.BackgroundService", {
        ...
    });

Refer docs more info.

Sign up to request clarification or add additional context in comments.

3 Comments

It's a common issue while coding proxy classes, try a clean build you should be good.
var BackgroundServiceClass = android.app.Service.extend("com.nativescript.location.BackgroundService",{ Exception in thread "main" java.io.IOException: File already exists. This may lead to undesired behavior. Please change the name of one of the extended classes. java/com/nativescript/location/BackgroundService.java Class: com.nativescript.location.BackgroundService at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:112) at org.nativescript.staticbindinggenerator.Main.main(Main.java:53)
Did you try a clean build? Tried deleting platforms folder?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.