Is it possible to test new sensors like humidity or temperature using Android emulator? Official one or any alternative one.
There is so little information on this on official website, even on Stackoverlow. I guess it's not possible, but I rather asked to be absolutely sure.
It is possible to fake some data, but you'll have to do some command-line foo!
In the emulator you could fake some temperature & humidity values you just have to connect to your emulator via telnet.
Connect to emulator. Open a terminal and type (5554 is the number of the first emulator):
telnet localhost 5554
list status of all sensors and see if temperature is enabled:
sensor status
Set some fake values (set whatever you want. Don't worry your emulator won't melt if you set crazy values):
sensor set temperature 1:2:3
Check the values that have been set as temperature:
sensor get temperature
==> you can change those settings at the same time your app is running in the emulator! so just set different temperature values and see what happens in your app. I didn't develop a temperature sensor app yet, but I know that telnet works great for faking geolocation data during testing my location based apps. I don't see any reason why it should not work for temperatures as well.
BTW: if you are getting lost in telnet you can always type help or help <command> to get some additional infos
Related
I want to create an Android application which uses an external device's GPS coordinates (because the mobile devices have a less accurate GPS).
The device I am trying to run with is Trimble GPS Receiver Pro 6T
Any suggestions how I can get the data from this GPS device and get this data to the mobile device? I've tried searching for some libraries and guides but found nothing.
The usual way for your case is to use the NMEA format.
Each GPS reciever can be set to output in NMEA format via serial COM.
You parse the socket, line by line.
Searching for Nmea Parser will give you some src code.
Has anyone used the new Garmin GLO GPS receiver? Has anyone successfully integrated it with their mobile application? I was interested in using it in order to get more accurate GPS coordinates in my Android application, but would like to get some feedback from others before I buy one.
The Garmin website does not mention if there is an API available to retreive the GPS coordinates, it simply states, "Using Bluetooth technology, GLO wirelessly pairs to your mobile device. Just set GLO within range of your mobile device and in moments you’ll be receiving GLO’s position data."
How can you retreive this position data? Will applications on the device, such as Goolgle Maps, just get this data automatically? Any info or feedback about the device would be greatly appreciated.
More info on the device can be found at the following link:
https://buy.garmin.com/shop/shop.do?pID=109827&ra=true
Todd
This question seems to get a decent amount of traffic and could use a more thorough answer.
Garmin probably feels justified in saying this:
Just set GLO within range of your mobile device and in moments you’ll be receiving GLO’s position data
because on iOS you can connect to the GLO and iOS uses the location information from the GLO to supply more accurate information to any device using the iOS location APIs. Android has no such facility. So, option one is to use an app that will read the NMEA data over BT and use that to set the mock location on your Android device (as Rodrigo said). Option two is what I do in my app: connect to the GLO or other BT GPS from directly in the app. Then I parse the NMEA lines myself and use that within the app. The downside of this is that each app which uses location must implement this themselves.
It's working for me with this app:
https://play.google.com/store/apps/details?id=googoo.android.btgps
It uses mock GPS location to inject the GLO's position.
I was having issues with the DDMS's ability to send GPS data to my emulator (i needed speed, accuracy, heading, etc all to change but couldn't get that to work with DDMS). Anyhow, I wrote a quick script to connect to the debug port and send nmea sentences following a track from a gpx file (nmea sentences modelled off an nexus s) but added the extra data i needed. I know there are other gps emulators out there, but for various reasons I ended up writing my own.
The question I have is, is there a way to do this to a real phone? I've trawled through the ddms info i can find and cant find much of use?
I've seen one emulator that can do this via bluetooth, but had trouble with it.
The same way you can send GPS data to a phone, which must have USB debugging and Mock locations allowed in settings.
I am working with sensor device called shimmer.The sensor device sends data and its getting stored into the SD card of the tablet. I have show the acceleration generated by the 3 axis of the sensor device on my tablet.For that I have to get the information.Do anyone know is there a way I can implement the sensor device accelerations on the android tablet.?
no answer?
I am also working on a similar project for my university. The goal was to create an interface between the shimmer sensor and an android application, that we have to code.
Using Bluetooth SPP sniffing I managed to decode most of the used commands for data transmission, but haven't completely mapped it. If you have access to any documentation that I do not, this step is probably redundant.
The basics for creating a connection through android is to code your application for Bluetooth SPP, and once connected, transmit the required commands through SPP to the shimmer sensor. Basically this would be #SOH for settings/Connection start, #ACK to "ping" the device to see if it is responsive (The device should reply with #FF (OK)). If the "boilerplate" program-firmware is used, then the status led on the device also toggles it's color from Green to red and vice versa.
Then you can send #BEL, which triggers the Accelerometer/Gyro/ and whatever other sensor you have connected. You will have to find a way to interpret the data, and extrapolate the readings.
If you are still working on the project, and would like to collaborate, then maybe we could help each other out.
First,thank you for your attention to my question
I'm planning to design an Android GPS locating application
here are my difficulties and situations
(1)my computer hardware has been out of date for a long time and running an android emulator for debugging is really time-costing,thus i bought a real device(android cellphone) one week ago,in the aim of replacing emulator during debugging
(2)i know how to send location datas to an emulator via "DDMS/Emulator Control/Location Controls",but it is disabled for a real device
(3)i am programming indoor,thus using physical gps locating function is not acceptable(even if i turn on "a-gps")
(4)i have found another topic here: Android mock location on device?
however,i can't open the detail links,like "Andrews link"," http://dehuysser.appspot.com/blog/android-developer-shell-released"
I guess these web sites are forbidden by my country......
Here are my questions:
(A)i have found some codes of making mock loation datas ,but these codes can not activate "onLocationChanged" function
However, i wonder if there is a way to send locating datas from PC to real device via USB port(i'm in USB debugging mode), just like sending locations from DDMS to emulator?
(B)i've got the information that, it is possible to send "geo fix" command to emulator as well as to a real device, by "telnet localhost ", but how to check out the port number occupied by my real device?
i know that 5554 port is used for a emulator,but what about the real device?
i've tried to command "netstat" in terminal, but it's a shame to say that i don't know which port is for my android phone......
(C)If my (A)(B) question is not practical,then what's "settings/applications/development/allow mock location" used for?
Please help me, and thank you for your answer!
I have wrote an app exactly for this (this functionality is not available on phones by default) - it's open source and provides exactly the same interface as the emulator (telnet to :5554 and run "geo fix ..." or "geo nmea"): in app store MockGeoFix
The easiest way of using mock data is using the mock test location provider API. It's at the bottom of the documentation page. I've tried it out and location is received in the onLocationChanged callback. Here is some code that you can try out.
The port used by adb is usually 5037.