Send data between two Android devices on same network - android

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

Related

Is Wi-Fi P2P ideal for a local chat-discovery app(Tinder similar)?

I wanted to know if WiFi P2P android API is ideal for use if we take lot of connections into consideration, tha app's users can be at time clients and servers they can share files and send messages and get them also as clients ? if no what is the best solution ( N.B : i'm opened to client/server architecture ).
I just wanted to know the limits of the API cited above and Thank you guys ...
Wifi direct as a technology is ideal for peer to peer communication.However talking about wifi direct for android , it works well only for a single connection that is only 1-1 use case .It is possible to create a one to many where every device connects to the group owner (Soft AP).But even if u build a one to one and try extend to multi use case you will have problems with certain devices that do no connect perfectly.
Checkout some of the problems listed under problems after downloading this application https://play.google.com/store/apps/details?id=com.budius.WiFiShoot&hl=en
If you want to go for multiple connection it is better to use hotspot .One device ends up being the hotspot and other clients connect to the hotspot .It is being used by plenty of application like xender, zapiya.

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.

Android: Pure P2P chat application

I've started to develop a chat application for Android. This app is supposed to function without internet and, most importantly, without an access point; It has to connect Android devices in a pure P2P manner.
However I've followed the following tutorials posted in android developers guide:
http://developer.android.com/training/connect-devices-wirelessly/nsd.html
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html#fetch
Afterwards, I've tested my app on 3 devices, the problem is one of the devices acts as an access point, preventing other devices from connecting with each other if they are connected to it.
This doesn't work for my app, because I want each user to be able to connect to multiple users at the same time.
What do you suggest I do in order to achieve pure P2P connection for my Android app?
Does the group owner acts as an access point?
EDIT
After I've done some research I found the WiFi Direct is not suitable for my project since it has to assign a device as an access point, what I'm looking for is WiFi ad hoc mode or (IBSS) in Android Anybody got any suggestion on how to start working on that?
By using bt and wifi simultaneously, you can try to extend the network further. This will require some kind of packet routing.
Also, it seems android ignores wlan cards connected to usb otg - just plugging in extra wlan dongles could allow easy extension of network.

Android to iOS connect via WiFi or using Multipeer connectivity or using WiFi direct

So I am developing an APP and I need to connect multiple android and multiple Iphone to send text data without any internet connection or service provider data network.
So one of the phone will have to act as a server to relay information between them. But the app will have to decide which phone will be the server and if a phone that is the server leaves the conversation then another phone will pickup as the server this will all be done with some smart programming but before I get there.
I know Android WiFi direct can do a one to many connection setup which makes it easy to connect android phone and accomplish the task between android phone only. But the problems comes when I need to connect Iphone with the android phones. Since the Iphone must be able to act as a server as well.
I would like to know a few things:
Can I connect Android and Iphone via WiFi Direct?
Can I connect Android and Iphone using Multipeer connectivity feature on Iphone?
Is there anyway to create a soft access point using Iphone? I know android can do this via WiFi direct feature.
If non of these can work can you suggest something.
From the discussion here it doesn't look possible
I wonder though if both OS allow enough control over the WiFi transceiver if you couldn't just write an app that could what you are asking and just bypassing the built in software architecture all together. I would think Bluetooth would be too weak except in extremely dense device saturation environments, but just for proof of concept that could be another route to take. My guess though is that you just wouldn't get that level of control over any of the radios inside a phone through the current OS.

How to get two android devices talking through an app on a lan using wifi

I have a small project I am working on and one of the technical problems I am running into is finding a easy way to get one app on one android device to push data to another app on another android device via lan.
I do not want to have to resort to the push API or other similar solutions in case there is no Internet connection.
I was wondering if anyone had any suggestions for this.
Thanks.
You could definitely use Java Sockets. Open a ServerSocket on one device and connect to it using a socket on the other device. You can then send and receive whatever data you want.

Categories

Resources