Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Compass magnetic without a smartphone that supports it
Started by FoxB Jul 21 2013 02:10 AM

11 replies to this topic

Best Answer jstrahan , 21 July 2013 - 06:54 AM

local has_compass = system.hasEventSource( "heading" )
if has_compass then
    print( "The device has a compass." )
end

This doesn't give you what your asking

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

FoxB

[GLOBAL: userInfoPane.html]
FoxB
  • Enthusiast

  • 37 posts
  • Corona SDK

I am implementing a compass in my app. I use it on my Nexus 4 and it works perfectly.

 

But I want to detect if a smartphone has a compass or not. Can anyone tell me how I should do that?



[TOPIC: post.html]
#2

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,925 posts
  • Corona SDK

[TOPIC: post.html]
#3

FoxB

[GLOBAL: userInfoPane.html]
FoxB
  • Enthusiast

  • 37 posts
  • Corona SDK

http://docs.coronalabs.com/api/library/system/hasEventSource.html

Use "heading"

Sorry, but this doesn't give any answer on my question :(



[TOPIC: post.html]
#4

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,925 posts
  • Corona SDK

  Best Answer

local has_compass = system.hasEventSource( "heading" )
if has_compass then
    print( "The device has a compass." )
end

This doesn't give you what your asking

[TOPIC: post.html]
#5

FoxB

[GLOBAL: userInfoPane.html]
FoxB
  • Enthusiast

  • 37 posts
  • Corona SDK

:) Thank you Jstrahan, I read your previous post too quickly, Sorry!



[TOPIC: post.html]
#6

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,925 posts
  • Corona SDK

No problem
I could've miss understood that's why I doubled checked

[TOPIC: post.html]
#7

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,925 posts
  • Corona SDK

When responding from mobile device I tend to not explain myself as good as I should. Guess I need to correct that

[TOPIC: post.html]
#8

FoxB

[GLOBAL: userInfoPane.html]
FoxB
  • Enthusiast

  • 37 posts
  • Corona SDK

When responding from mobile device I tend to not explain myself as good as I should. Guess I need to correct that

Or even better... build an app for that ;-) Just kidding.



[TOPIC: post.html]
#9

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,925 posts
  • Corona SDK

There may be one. Lol

[TOPIC: post.html]
#10

rgame

[GLOBAL: userInfoPane.html]
rgame
  • Enthusiast

  • 53 posts
  • Corona SDK

if your app uses a compass as part of it, isn't another possible solution to your problem adding the "usesFeatures" and make the thing required?



[TOPIC: post.html]
#11

FoxB

[GLOBAL: userInfoPane.html]
FoxB
  • Enthusiast

  • 37 posts
  • Corona SDK

if your app uses a compass as part of it, isn't another possible solution to your problem adding the "usesFeatures" and make the thing required?

 

No it is not, I like your idea tho, because I have thought about it myself aswell.

 

I am using GPS in my app, but if you do not have GPS i just disable some features in the app. That way a lot of people can still use the app, even if they do not have GPS.



[TOPIC: post.html]
#12

rgame

[GLOBAL: userInfoPane.html]
rgame
  • Enthusiast

  • 53 posts
  • Corona SDK

Ah, alright. Makes sense. Just wanted to give you an alternative, but didn't know enough about your program :P




[topic_controls]
[/topic_controls]