sensor not working (probably because of lack of permission)

53 views
Skip to first unread message

Minion Ninja

unread,
Aug 1, 2018, 6:10:46 PM8/1/18
to MIT App Inventor Forum
My phone clearly has a orientation and a gyroscope sensor, but when I put them as a "non visible comonent" in the app, the app (when installing) doesn't ask for permission to use them, and probably besause of that, it detects them as "not available" like if my phone didnt have the sensors. Please somebody help

SteveJG

unread,
Aug 1, 2018, 6:23:38 PM8/1/18
to mitappinv...@googlegroups.com
A little more information would be appreciated.

We assume you are using the GooglePlay option to build the apk.   Are you?
If you used the GooglePlay option could you run this experiment for us:   Build the app using the 'traditional' build tool.  Does the phone recognize the sensors using the 'traditional' build?  Does your app work as expected when you do that?

When you say put them as non visible component,  what does that mean?  Both components are non visible.  Do you mean placing them on a different screen or what...a  few more words of explanation would be appreciated .

Would you help us by providing an example aia showing this behavior?   An example would help us a lot.  Thanks.


Regards,
Steve

Evan Patton

unread,
Aug 1, 2018, 7:51:50 PM8/1/18
to MIT App Inventor Forum
As far as I can tell based on the Google documentation, sensors do not fall under the category of sensitive permissions and therefore an app does not need to request permission from the user to access them. Do you see this both in the legacy build and the "Google Play" build, or just one of the two? Also, what is the make/model of your phone?

Regards,
Evan

Minion Ninja

unread,
Aug 2, 2018, 3:16:09 AM8/2/18
to MIT App Inventor Forum
I'm saving the app to my computer, than copy it to my phone usng an usb cable, then I install it on my phone.
I have a Samsung Galaxy Core Prime that runs android 5.1.1 .
I attached the .aia file of my project.
test.aia

Evan Patton

unread,
Aug 2, 2018, 7:43:13 AM8/2/18
to MIT App Inventor Forum
According to this spec page, your phone does not have a gyroscope. The test app you attached does not check for the proximity sensor, so please double check by updating your app to test its availability.

Regards,
Evan

Minion Ninja

unread,
Aug 2, 2018, 3:56:46 PM8/2/18
to MIT App Inventor Forum
Thx for your help, I didn't think my phone doesn't have a gyroscope or orientation sensor.
But I downloaded a protractor app and it had a "Plumb line" option, that worked. How can I achieve that using the MIT App Inventor?

Regards,
Daniel

Evan Patton

unread,
Aug 3, 2018, 3:08:27 PM8/3/18
to MIT App Inventor Forum
If I had to guess, I would expect that they are using the accelerometer to determine the direction of gravity and then drawing the plumb accordingly. You can use the x,y,z values of the accelerometer along with some of the math blocks to determine the appropriate angle for drawing the plumb line.

Regards,
Evan

SteveJG

unread,
Aug 3, 2018, 3:20:28 PM8/3/18
to MIT App Inventor Forum
An earlier post in this Forum discussed using the Orientation sensor to use as a plumb line.   https://groups.google.com/forum/#!searchin/mitappinventortest/orientation$20steve%7Csort:date/mitappinventortest/FbB8yYWq9kg/KLhXgJ9dBwAJ  

You might be able to get it to work.   At the time, the users had a special case and it would not work for him.  MIT indicated they would try to make the necessary modificatons to the Pitch but it does not appear yet that has happened.

Regards,
Steve
Reply all
Reply to author
Forward
0 new messages