Android F# application: sensors

64 views
Skip to first unread message

Daniele Ciarrocchi

unread,
Nov 23, 2015, 8:32:11 PM11/23/15
to F# Discussions
I am trying to write a simple android application in F# with Visual Studio and Xamarin, to see how F# works. This app has to take a picture (or a colored circle) and move it over the screen when i move my device. How can I use sensors in F#? (accelerometer, gyroscope..) to do this? I can't find how to use them.

Jon Wood

unread,
Nov 25, 2015, 9:20:36 AM11/25/15
to F# Discussions
Probably a couple of things (of which you may have already tried).

Here's an accelerometer recipe from Xamarin
And, what I would try, is this Device Motion Plugin component

Hope one of those works for you!

Daniele Ciarrocchi

unread,
Nov 25, 2015, 6:43:24 PM11/25/15
to F# Discussions
Thank you, it helped!
I also found this example: it use the barometer, I'll try to modify it to use the other sensors!

Daniele Ciarrocchi

unread,
Nov 26, 2015, 11:40:35 AM11/26/15
to F# Discussions
Ok i got this problem now:

let ra = new RotateAnimation(float32(0),float32(360),Animation.RELATIVE_TO_SELF,float32(0.5),Animation.RELATIVE_TO_SELF,float32(0.5))

The field, constructor or member 'RELATIVE_TO_SELF' is not defined.

Do you know how to solve this and have the image rotating with the pivot set in his center? What F# use instead of relative_to_self to have the same result?

Daniele Ciarrocchi

unread,
Nov 26, 2015, 11:51:24 AM11/26/15
to F# Discussions
Ok I found by myself: Dimension.RelativeToSelf
I tried it one day ago but it didn't work, but today it seems working

Jon Wood

unread,
Dec 8, 2015, 8:36:38 AM12/8/15
to F# Discussions
That tends to be how it goes :p

Glad it's working!
Reply all
Reply to author
Forward
0 new messages