I am developing an application in which i have to sync time of multiple devices without giving application root access. Since i can't programmatically change the time of device on android without getting root access, i have one device acting as the true source of time and other devices need to somehow connect to it and get the time and save the local offset.
For this purpose i am using Bluetooth low energy. The master device plays the peripheral role where it advertises a custom service containing the characteristic 'current time', and other devices acting as centrals will look for that advertisement, connect with master, read the current time. So far i have only been able to make it work for one peripheral and one central.
Can a peripheral device connect to multiple central devices, if so then what is the limit to the number of connections?
Is there a better way to address this use case of syncing time of multiple devices?
It's a bit SoC specific, but you should check out this blog:
https://devzone.nordicsemi.com/b/blog/posts/wireless-timer-synchronization-among-nrf5-devices
A max jitter of 220ns over a 30min period is quite an achievement. Although it does not use BLE, but proprietary 2.4GHz the idea can be applied for BLE as well, but not with the same performance.
Related
I need to have control over some admin features of android device.
Is it possible to acquire control over hardware not specified in android.app.admin.DevicePolicyManager like disabling access to microphone?
Also it will be good to find ability to track network connections or attempts to use network adapters by apps.
Maybe some command for root console or other way exist - how I can search for?
As far as i know there is no way to block any other hardware except camera with device manager. I believe that if your app takes control of microphone it will be unavailable to other apps, but i am not sure. Note that from android 8.0 no app is allowed to take control of microphone while in background.
About tracking network activity you could open vpn to monitor all packets that are sent and received.
Please keep in mind that i am not familiar with root methods so you should do some more research on this.
I'm working on a project that can help optimize multicast. More precisely an implementation of Network Coding.
I have a great deal of it done in simulators, but now that I want to implement it on actual mobile phones, I'm facing this problem: How can I send data between them phones without the need for access points between them?
Can I open sockets programmatically and listen to them? Or is there something like an AdHoc network (those are no longer supported in android) that I can use?
EDIT: If needed I can rely on a server/access point for DHCP and such (for the phones to know of each other) . But the data needs to flow between the phones independently of the access point.
An access point is just a 1st-level ISO/OSI device that permits to one or more WiFi compliant devices to communicate wirelessly. Unless you can use Bluetooth or IR as a fallback, there's no way you could make it without an AP.
Have one of your phones act as a "mobile hotspot" (a wifi access point) for the other phones. Share the name of the access point and passphrase with the other phones and they will all be connected on the same network (and the internet through the "hotspot" phone's cellular data connection.
In this way, you have all the normal networking capabilities and security available to you without requiring an additional/external access point.
However, this will not result in direct connectivity between the many phones that are not the access point; all (non-multicast) network communication will bounce through the phone that is acting as an access point for your network.
I am developing an app in which I need to scans WiFi network and display the list of all connected devices.
Allow a use to tap on a device and the app should show all the hardware info of that particular device. Here by hardware I mean - RAM, Storage Media, Storage Capacity, Device Name, Device IP address, etc.
Now this device can be anything like xbox, a laptop with Linux/Windows, mobile phone like iPhone or any Andorid based smart phone or even a printer.
How can I scans WiFi network and query/detect all the devices attached to it?
What are the protocols that I need to use to get list of hardware in a particular device irrespective of the OS running on it?
Check requestPeers of
WifiP2pManager
As per documents it seeks
PeerListListener which returns WifiP2pDeviceList carrying list of WifiP2pDevice which carries deviceAddress, deviceName, primaryDeviceType, secondaryDeviceType, status and other attributes.
Maybe the Network Discovery github project could help you. It lists all users connected to WiFi with IP and MAC addresses and gathers even some information like open ports, device name, ping, etc.
Hope it helps
In my opinion, you can use Wi-Fi Peer-to-Peer
https://developer.android.com/guide/topics/connectivity/wifip2p.html
"Wi-Fi peer-to-peer (P2P) allows Android 4.0 (API level 14) or later devices with the appropriate hardware to connect directly to each other via Wi-Fi without an intermediate access point (Android's Wi-Fi P2P framework complies with the Wi-Fi Alliance's Wi-Fi Directâ„¢ certification program). Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi P2P, then communicate over a speedy connection across distances much longer than a Bluetooth connection. This is useful for applications that share data among users, such as a multiplayer game or a photo sharing application."
Blockquote
We have and Android app and we ought to distribute it through some of our partners and will be pre-loaded on those devices.
At the same time we need to keep accountability of how many devices, for each partner, is using our app.
Once the we release a new app version those devices might or might not be updated and we require to still keep accountability over how many devices for each partner is using our app.
We have been told to add a "channel code" to our app but we don't think that can be done as once the app is updated that channel code would be lost. Also, that would imply having to distribute "different .apk's" (or customised apk's) and that is something we want to avoid at all costs.
We can use Google Analytics however will not give us accurate numbers as GA would also include the devices that have installed our app through Google Play.
Therefore, any help explaining us how can we add that tracking mechanism would be very much appreciated.
If you are only interested on knowing the number of devices using your app at any moment, and the total usages over time GA is a good way to go. You need only to create a GA session at application start as in:GA session management.
Note that before that you should get and configure you GA account as in: GA account for real time events.
I'm not sure if that met the point, but i track the devices by sending the DeviceID on every start of my app.
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String txtguid = tm.getDeviceId();
I use a predefined URL to send the DeviceID and some additional informations (Version Code, timestamp etc) and than i store the Datas. I also added a custom exception Handler and send the stacktrace of any crash to my server.
Works perfekt for me
Hello I've been trying to develop an app for android dor retail system where for instance there would be a total of 5 tablets in a restaurant all running my app but since in my country retail software must follow a strict number of rules, i cant put a database on each android.. they will have to have a way to access the same database over LAN, bluetooth or other.. I developped a test app with a WCF web service and client app in android but apart from the fact that i have a dynamic IP so i would have to be configuring the connection every time i restarted, it's not very reliable
If somebody could point me in the right direction.. i've been googling for the past week and nothing..
PS: One more thing, this system (retail system) is to be implemented in a number of locations so if possible i would like to make only LAN based connections.. Thanks
http://en.wikipedia.org/wiki/DynDNS use something like this, you will have an ability to use the same DNS name updated each time you have new ip.
As for reliability, you need to track the reason first. Try to ping the server for some time and gather statistics.