create an ad-hoc mobile network using wifi-direct - android

I have a project idea which is suggested by my lecturer to create an ad-hoc mobile network using WiFi-direct available in android mobile phones. the purpose of this network is to send data over a long distance from one android device to another using several other android devices as intermediate nodes and also to use a MANET routing protocol for path selection when there's more than one path available to reach the destination.
I have looked into some of the questions related to this where some have asked how to implement a similar type of network but most of those answers were pretty old at which time WiFi-direct was not available widely, as I assume.
I'm pretty much new to android and I'm learning it now for this purpose. so I would like to know weather this can be done using an android app, some guidelines to start if possible and any sample codes i can refer to get this done.
Thank you in advance.

Well you could use socket server and socket client technology to share data between devices in the same network which is definitely not a long distance thing. For long distance, you have to use internet to send and receive data because socket servers/clients cant connect devices in other networks. I am not sure how its gonna work but Good luck!

Related

Android - Managing Multiple Wifi Connections

I'm in the design phase of an Android application that will require a connection to multiple wifi networks, and I'm wondering if anyone can provide advice and/or code snippets regarding the best way to go about this. The app will have a connection to one wifi network that has internet access, and another wifi network with no internet access that will be used to share data accross the devices (raspberry pis) on it.
Can I be connected to both networks simultaneously? If so, how do I specify which network to use when making a request? I've been reading the Android 5.0 documentation which indicates its possible, but I'm a little confused on how to implement it.
If its not possible, this post from 2011 says that the WiFi Direct standard could be another solution. WiFi Direct is now supported on Android, but I can't find many examples of how to use it to achieve my goal.
Any advice is much appreciated!
As far as I know, you can have only one connection to the Access point, meaning that you can indeed make the device connected to the access point which offers you the internet connection, but then you can not connect to other networks.
Anyway, I would suppose that in your use case that is not the problem, actually I don't see any problems there. At least, if you simply have the connection and then have the Raspberry Pi's connected to you, i.e. you simply create a access point in your Android device, and all devices connect to it.

Multiplayer game on local network without internet

I am creating a multiplayer android game as a part of my coursework. This is my first game. I intended to allow users to connect to the game over a simple network. I don't want to use internet at all hence I wont be using the android game services. How do I go about this. I have no clue at all. I have tried various tutorials but all of them are using a central game server. I just want to create a simple Client - Server network. One user will host a game and others will join.
it's my first time answering a question here. I usually just read here in stackoverflow. I'm also currently working on my first game. It connects devices using wifi peer-to-peer or WifiDirect (without a wifi hotspot). It requires high version of android OS (4.0 or 4.1?) but I believe you can also try the other way on which the devices needs to connect in the same wifi hotspot for lower OS version requirements. The latter, I haven't tried yet.
After I connect the devices on the same network (peer-to-peer), I use sockets to exchange data between them. I use serializable objects for sending data. I don't know if it's the best way but it works for me.
My game can connect more than two players in wifi peer-to-peer. One device acts as the network owner (and also the game server).
See android's tutorial/documentation for WifiDirect connection :
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html
Be sure to read also the adjacent lessons.
Also, Sockets must be used with Threads so you also need to read about it if haven't.
Hope I helped ^^
I finally got the solution and made the Android application. Simply used java socket programming. It works on Hotspot. This works on client - server framework.
Please find the code here and contact me if you require any assistance.
https://github.com/rohitramkumar308/GameOfCards
and this is the link to the app
https://play.google.com/store/apps/details?id=srk.syracuse.gameofcards
Hope this helps you.

Data transfer between two android devices which are on different networks

I am working on one project in which two android devices which are in different network need to transfer some data. Both device will have internet connection. It will be either Wifi or GSM provider.
Consider the following cases:
If one Android device has GSM network and
another device in some other place which has Wifi network
If one Android device has GSM network and another device has GSM network
How to transfer data in such cases?
I don't want to use server in between.
Please let me know how do I solve this issue. Any clue or any links which will help me. So far I didn't find any such things. Please help me...
Short Answer: You're going to have to use a server.
Long Answer: You could use bluetooth if the location is close enough or maybe Wifi Direct although I haven't personally used the latter. Although, ultimately a server will be the best option. If you don't know a lot about backend development I could recommend parse.com as a good service that makes creating backends very easy and has fairly high usage limits before you have to pay.
Unless a device has been configured with an external IP address, which is very unlikely (impossible?) on a cellular network, there won't be a way to directly contact it from an external device. Even on WiFi, most devices will never have an externally defined address.
If you had administrative control over a directly connected and externally addressed router, you could port-forward traffic to a single device, but that's likely not the solution you're after.
A much easier approach is to use one of the services that let you define a back-end w/o a lot of setup or costs. The most popular one is probably Parse.

Send data between two Android devices on same network

I'm new to android programming and have a question about networking. I am creating a chess app where two players can play a game against each other on separate devices. My goal is to set this up so it works locally (the devices are near each other or on the same wifi network).
I noticed when trying to work through WiFi P2P (which thoroughly confused me) that the end goal was to get the MAC filter and IP address of the device you are connecting to. If I already have these (i.e. the user inputs them on the client device knowing these values externally) can I simply create the connection without using P2P?
In essence, can I simply start a networked android app with creating and connecting to a serversocket rather than dealing with P2P or NSD?
Thanks and sorry for any confusion,
Scott
you can use the alljyon sdk https://www.alljoyn.org/docs-and-downloads ,i had work with it and it work correctly ,you can find a sample demos one for chat in the same wirless without need the internet connection

Android: connecting two device without internet

I am developing an application. In which the idea is like - i want to connect two devices as two mobile or two tabs or mobile to tab or mobile to server or tab to server. Means i want to send data from one device to other device mostly xml.
I want to connect two devices with out internet and blue tooth, I want to connect them with wifi having no internet. And than want to transfer data.
My point is i am having an application which is used to generate a xml and after generation of xml i want to send it to other device or tab or desktop server on a button click.
I searched on Google and found Ad-hoc network, but it is quite difficult to understand me. Is any other way by which i can easily understand Ad-hoc or other way by which i can connect.
So please guide me what should i do, how can I achieve my task. I need your guidance and suggestions.
Socket connection would be a great idea in your situation, you dont need to have Internet to do so. Here is one of many examples if you google it: http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/
Hope this helps
You can use iJetty. iJetty can be configured to use in your application and when you start wifi router on one android device another can get connected on that device and if it's your client applciation you can configure it to look on a specific port.
Try this : http://puregeekjoy.blogspot.in/2011/06/running-embedded-jetty-in-android-app.html
You could use Wi-Fi Direct if your version of Android is 4.0 or later and your hardware works with it.

Categories

Resources