I want to write a simple "compass" app with NativeScript, a fun project to be submitted to GitHub. The GPS part is done. I am using this: https://market.nativescript.org/plugins/nativescript-canvas, app created with 'tns create --ng'. The canvas is drawn once, it works, great! But I want to constantly redraw it with data from GPS and I have no idea how.
I tried to save the 'canvas' value in an instance variable of my Component, I mean the value that comes with the event to 'draw' -> event: {canvas: Canvas} But reusing the value crushes the whole app, it is actually 'undefined' which I don't understand with my limited knowledge of Angular/TypeScript. Any hint how to get the 'canvas' wherever I like? A git repo with a working example?
I followed the instruction for Angular:
and draw(event: { canvas: Canvas }) { ...
deploying it to android emulator ends with an error (see below) but adding a space anywhere in the code forces redeployment ('change detected') which deploys fine. As such this cannot be deployed to a real device, of course. But first - I need to update the canvas :) thx.
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.HelloWorld/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap.
System.err: File: "file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js, line: 21886, column: 20
System.err:
System.err: StackTrace:
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 21886, column: 27
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 21731, column: 14
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 19544, column: 25