So I am making this app right now on android basically what it does, It scans the area for a Bluetooth device with a sequence of letter's that it starts with but the last four letters constantly change, also you cant connect to this device either. So I just do a scan and look for the device and if it finds it, it shows in my list and then I read the last four letters and convert them into a double. What I want to do is have Bluetooth start as soon as the app loads up and then keep scanning the hole time so I can get the last four numbers as they go up and they go down.
How can I do this?
This can be done if you use advertisement data or scan response data. so your application has to run in central as well as in other peripheral devices. The peripheral devices has to advertise with advertisement data ( with a unique string and variable part). the advertisement data can be read by the central.
Alternatively if you have the possibility to make the advertisement scannable, the advertisement data contains the fixed part (unique number/string) to identify the device and scan response data can be used to get the required number. note that the advertisement data and scan response data need to be set by custom application.
Related
Problem
I'm making an app that can detect if current place is a particular place and play the sound if I'm locating in a particular place. So, I'm going to detect the place using wifi names(ssid).
Thus, I want to get ssid list when the app is running on background service. Also, it should always get ssid list because it plays sound when user reached the place.
Question
So my question is, How to always get ssid list and detect the place on background?
First, you should using a service to run a scan task, because of background limitation, my suggestion is foreground service, refer foreground-services
Second, about wifi scan feature, on Android, we can get a list of Wi-Fi access points that are visible from the device, but have few limitations apply to the frequency of scan, each background app (All background apps combined for android 9 and higher) can scan one time in a 30-minute period , and 2-minute period for foreground app.
please refer : wifi-scan-throttling
I'm currently developing an android app for a weight scale I received that transmits data through bluetooth low energy.
I was looking at documentation and if I got the information correctly, there are specific UUIDs for data. I received a BLE scale with a Chinese protocol document found here: http://www.anj.fyi/protocol.pdf
I found and was able to get a functioning scanner working that lists the device name and the UUIDs it broadcasts.
Lets say I want just the weight data to show up in the UI, nothing else and nothing more.
I don't know what UUID they used for the weight data, and there are a lot of UUIDs. Probably 20+. I checked a UUID compilation and the usual weight data UUID does not show up.
How do I get the data from those UUIDs?
I'm thinking it might be the ones that are notifications, indications or read properties.
Looking at the UUID for example, f000ffc2.
How would I get data from that characteristic? Would anyone have an example code to grab the data from those UUIDs, or tutorials because I'm terribly lost right now.
I really appreciate it.
There are no weight information on the document you list http://www.anj.fyi/protocol.pdf, it is only shows the BLE module hardware interface spec, i.e. it does not specify the detailed service and characteristic.(I an a native Chinese speaker).
Regarding to the UUID you want to know which is the one to represent the weight, yes you are right it should be the read/notification feature without write permission. Can you use the apps e.g. lightblue on iOS to receive the notification(meanwhile change the value on your device) to test it? this will help you to understand which characteristic is the one you want.
I'm facing the following problem:
I have a web service of a social network that allows to query a user uploaded videos. The web service signature is:
getUserVideos(String username, int quantity, int offset)
I need to create a gallery with the videos. So basically I request [quantity=10,offset=0] then [quantity=10,offset=10], using a ViewPger for the gallery.
At this point, with the gallery working (and in the position 15 for this example). We need to save the state if the user leaves the app, i.e. pressing the home button. Later, when the user return to the app after some hours, the getUserVideos service may return different data (i.e. if the given username has uploaded new videos in the meanwhile).
I see two different behaviors but find both wrong.
Save the list of videos when leaving the app and restore it when the user comes back, since there is new data in the server and the client data is old, the client offsets and the server offsets will not match, returning repeated videos or never returning others.
Requery to the server keeping the index in the gallery but updating the content (that is return to the video number 15). This will cause that the user returns to see a different video that the one he was seeing before leaving.
What are the common approaches for this kind of problems?
Cause you don't know user have video or not,you must request to server from zero.but when you get data check it with your fetched data and remove duplicate and insert new data to top of your adapter (i don't know if you have adapter or something else).
I've done a lot of reading about LE Bluetooth and GATT but I'm still struggling to fully understand what GATT is. To make it simple I'd like to express how I'd like my app to work, and simply be told if it's possible or not? The basic premise is it will be used as a location tracker and beacons (maybe iBeacons specifically) will be placed around the building and whenever you enter the range of the beacon a message will be sent to the server from the phone. The idea is that it doesn't need to scan, the phone just simply listens and whenever a beacon advertises, the phones in range will hear this and raise an event.
Scenario:
Client downloads the app and enters the building for the first time.
The building has a beacon in every room, advertising every 5 seconds for example.
When the client walks into a room and is in range of a beacon, the phone will get an unfriendlier version of the message "Beacon 2 has an RSSI of -87".
When they leave the room they will no longer hear the message and so will do nothing until it hears another message from a beacon.
NOTE: This scenario doesn't involve any scanning, looping or pairing. The phone will just know it has to listen for LE Bluetooth messages.
So, is this possible? From what I've seen it seems like you need to scan and connect with each beacon using GATT before you can receive data from them.
Any infomation of this matter is greatly appreciated, thankyou!
Yes, this is possible.
Some high level scenario for a merchant store with beacon.
1) app client needs to have uuid or major id of beacons to be stored locally.
2) merchant store with same uuid or major id will broadcast messages.
3) phone OS keeps listening those messages when entered into geofence, OS will pass on these messages to the apps who are registered for beacons listening.
4) your app will match the uuid embed in the message and identify if its meant for it.
5) if message uuid does not match with uuid on client then app will not consume this message.
6) if message uuid matches then client will consume the message and display it on device, even your app is not running at that point of time.
I am creating a java application to receive messages on pc using jsms API. Whenever a user sends a particular message to a no, it receives it and adds to the database, the phone number and the area/ region where it belongs.
The region can either be the area where the phone number is registered, or it can also be the current location of the device. Either of these information will help me.
I would be really glad if any one could any one guide me on how to proceed with finding out the region using java code.
Note: I'm not looking for the country. I'm looking for the state/ region. Preferable Indian states.
You could try out libphonenumber. It basically defines the region based on the number.
There is a JavaScript try page here you could perform some tests.