I have two android apps connected with wifi (over AllJoyn framework). Can
I test (e.g. ping) their connection using a test framework like JUnit?
Android simulator doesn't support wifi.
Is there any mock object simulation wifi?
Especially for alljoyn how can I test my app?
Update on 19/7/2014: I have given up AllJoyn. I had many problems. Especially multicast packets on most routers are blocked. And since I cannot modify every router my app is useless with AllJoyn.
Related
I have an application with an Android and an iOS version, both of which function primarily by connecting and sending/receiving messages to/from Bluetooth accessories.
iOS uses ExternalAccessory to connect to Bluetooth devices
Android uses BluetoothDevice to connect to Bluetooth devices
I want to write unit tests to make them reliable.
Note that I am not looking to test what it sends/receives to the bluetooth device based on input/output (I already have that tested with stream wrappers). I need to test behavior like:
The bluetooth accessory has disconnected in the middle of an operation
A connection has failed
How to go about it?
For iOS:
You can get a test framework like OCMock and create fake objects that represent what you would see in those scenarios.
OCMock project page.
i'm working on a wireless ad hoc network, at the moment i still designing my network.
The network should work for android devices.
Until now i thought to use a phone as a hotspot, so nearby devices could connect each other, but what if two hotspots have to speak to each others?
Basically the question is: Can two or more hotspots connect and communicate each other?
Thank you.
Yes, you need to use WiFi Direct for this. When using WiFi direct in concurrent mode, and device can act as both a client and an AP the same time. This is what you need. Whether it will work for you as is, depends on your specific device and driver, but there is support for WiFi Direct in Android since v4.0. Sometimes WiFi Direct is also called WiFi Peer-To-Peer or WiFi P2P and this is what the Android API calls it.
see Android WiFi P2P
With the Android API you can discover other peers and services you define and connect to them.
The WiFi p2p utilities are under very active development, so I am not sure if the Android is currently supporting the concurrent mode. You can try. However, you can also setup your connections directly by using the wpa_supplicant utility which is actually what Android is using internally. I have been able to use this directly from my applications for other purposes. If the version that Android is using is not working, or if you find it a bit unstable, you can get the latest version from the hostap and wpa_supplicant projects. Installing those may require root access though.
I would like to use a raspberry pi as a central server for an application I'm building. Basically, I want the raspberry Pi to act as a server which can be used by co-located mobile devices to communicate with each other. I'm trying to build a local access network, and there is no need for an Internet connection. I am going to build an application on Android to interface with the server.
I have considered using an ad-hoc network, however, I have found through the following (among others):
Can
Android do peer-to-peer ad-hoc networking?
xda-developers
thread
that Android does not play nicely with ad-hoc networks unless rooted. I am not in a position to root the cellphones, so what else could one do in this instance?
What is a replacement for an ad-hoc network that is compatible with android?
I ended up creating an Access Point, as suggested by #Jonathon Reinhart. Here's a tutorial on how to do that http://elinux.org/RPI-Wireless-Hotspot
Suppose you only have one android device, but you would like to experiment with the Wi-Fi P2P API. Is it possible to use a computer to mock the other wifi device running whatever OS and application that is necessary to play the other part in the P2P communication?
I know the android emulator doesn't support wifi.
I'm trying to develop an Android application which have to be able to transfer data/message between two Android mobiles, as a client server connection using their own Wifi, which having no network or routers nearby. I just tried using Tcp program to do this but it fails, its not connecting, I'm getting ConnectException and connection refused.
[Edited] Is it possible to achieve this using Android Portable Hotspot integrated with application? Is there any tutorial regarding this approach?
Any Ideas, how to do this?
Thanks.
You need to get the two devices networked to each other before you can worry about tcp usage of that network connection.
If one device is willing to perform access-point like functionality as part of a portable hotspot, and you select that as a wirelss network on the other, you may achieve a network connection between the two that can be used for custom traffic. Though there are ways the hotspot could be implemented where that would not work. Also of concern, the "client" device will now be sending all of its network traffic through the hotspot device, including not just foreground apps but anything it decides to do in the background.