How to achieve p2p on android - android

So I am developing a little game in which the users will try to answer the same question in real time. I thought the best way for the users communication is p2p. After 3 days searching, I found that there 3 possible solutions.
1. XMPP. Recommended by a lot people. Unfortunately not many people in China use GTalk.
2. Jxta. Seems dead and complex.
3. SIP. It requires the user to have a SIP account.
p2p seems to be really hard on cell phones.
My question:
Is p2p really the best solution to my problem?
If it is, what is the best way to achieve p2p connection on cell phones?
Many thanks!

If the only issue with XMPP is that your users don't use Google Talk you should set up a server and rely on in-band registration.
Look at these Q&A to learn what it is and how you can get it in android

An XMPP server is easy to setup, use OpenFire. I've done this before, you have to install a java virtual machine on a server and then install OpenFIre.
To create a client application, you can based your work on the ASMACK library which is very complete.
For me, it worked but my server cann't handle OpenFire. I just have a dedicated server with 512 RAM and 20 Go SSD to a VPN connection.

Related

How to use NFC (HCE/Tag/Peer-Peer) or any other way to communicate between ios 11+ and android API 23+, its 2018 hasn't there been any upgrades?

First things first, I am writing this question after researching quite a bit.
Broader View of the issue
In this day and age, we require a more reliable way to perform peer-to-peer communication, preferably using technologies like NFC.
I mean we are in the year 2018 and I cannot believe that there isn't reliable means to communicate peer-peer between and ios and an android. I am talking about offline, close proximity/range communication, which can open up a new world of possibilities for mobile apps. Many of the apps we use to communicate with other devices require one or more of internet, login, credentials/authentication, etc. I am making this effort because most of the readers/users/developers do not actually know what has changed in 2018, so if anythings changed, I would love to hear it!
Hindrances
IOS has very weak NFC support, functionality-wise..?
IOS doesn't support Android Beam.
Not enough members are bothered to fix this or are helpless.
IOS doesn't support non-ios Bluetooth connection? (Doubt it/Tried but failed)
What I need
Efficient cross platform solution for communication between two different mobile devices preferably offline.
A way to send and receive money other than Apple Pay/GPay/Samsung Pay/iMessage/AndroidMessages, such as over NFC/Bluetooth preferably offline mutually, but connected to internet independently.
A way to automatically send data when two devices (different platforms and within ios) are in close proximity, without the need to login or register or any other steps. At least a way to trigger something upon nearing one device from the other, like NFC basically.
What I have
Working android application that uses android Beam to send and receive ndef messages, which is easy to do, between two android devices. So we can make the payment happen here in this case.
Questions arise when we try to proceed with android -> ios or vice versa.
I have read a lot of related questions where the answer is outright NO. However, am not taking time to write this question to be told it's not possible. I want the crowd here on stack overflow to help me find a way to workaround this situation. I know it is a lot to ask, but I feel this invention or discovery will help man app developers stuck in this same zone. This question should be answerable by someone who is ideally in the Fintech domain, and is an IOS developer or mobile developer, with working knowledge of card emulation, secure element, ios 11+ or ios 12 development, NFC, NFC tags, etc.
Questions/Ideas:
Can we use the secure element and NFC Tag with ios 12 or ios 11+ libraries to simulate this required functionality?
Does any third-party library get close to having the ios/iphone act like a NFC writer?
Can we simulate NFC writer for ios?
Can I simulate a tag on android device, have the iphone read it(do not want the apple pay popup somehow) and then follow through the next workflow via the internet? For example, if I had a sender and receiver (payments), since android supports a lot more than ios, can I simulate something on android so that either the apple pay thinks am a terminal of sorts and pays me electronically (securely of course), or at the least can I read apple pay credentials of sorts and simulate a terminal and accept a payment from ios on android?
Something on these lines, I know its not very clear, though I am trying to be clear and simple.
Suggested by others and why it is not a great solution:
WebRTC - Needs internet
alljoyn - Need only 2 device not 2+ and no need for server or client setup.
Relay Server not quite sure is offline or works
android-ios-peer-to-peer-architecture question talks a lot about it as well!
developing-mobile-p2p-payment-apps question, which seems to be relevant has NO answer.
why-android-ios11-cannot-communicate-via-nfc question talks about React Native. I for one have looked at PhoneGap and Nativescript which just have the same level of support for ios. In short, it won't work.
Any I left out, in short no solution.
Comments:
//Due to the fact that there is no solution, I feel even more motivated to post this question. I feel we should come together as one and fight for this right. I mean usually seemingly impossible questions are answered here, so I figured you guys could take this as a challenge. The challenge would be to find a legal loophole, an ethical approach, nothing unethical of sorts. So let me know if we can arrive at any positive conclusion! Thank you for being patient.
//I have read the rules and "do not ask" section, so I would just request moderators to check if there *can* be any answer before you flag it or take it down, by which I mean we just need one correct answer, and it can come from anyone or anywhere.
I am pleased to reveal that there has been demand for this and Google has released Nearby API as early as 2016. This is the way to move forward. This is a device independent API.
Please checkout Monzo Bank's Nearby Pay
Google and others claim it works with Ios as well.
It has been around since 2-3 years, which means there should be good support and documentation, though I might be wrong.
I hope this answer paves the way for others in my position! Good Luck!

Communicating between mobile devices over a local network

I'm a complete newbie with regards to developing for Android, and for starters I'm trying to develop a simple card game that can be played multiplayer over a local network. I'm having trouble finding a starting point for how I would go about this, I can find plenty of things for communicating across the internet but not having much luck seeing how you communicate directly between two devices over a LAN.
It's a major part of my plan for this app that it be multi-platform and that iOS devices and Android devices can play against each other, so I'm looking for a method that supports this. I know it's possible as I can see there are other apps that have this functionality.
I don't need a detailed implementation (although the more help the better!) but if anyone could just point me in the right direction for how to go about something like this, I'd be really grateful.
I think u need a connection peer to peer, android implements Wifi Direct
Look android dev site. http://developer.android.com/guide/topics/connectivity/wifip2p.html
For a card game I recommend using client-server.
Electrotank is a good server that provides a framework that helps you create a game of this type, with rooms, chat, friends list and connect to Android and iOS. U can write server plugins in Java.
http://www.electrotank.com/es5.html.
Another good server solution is SmartFox.
Or you can create a turn-based game, creating a database to save data and a counter on each client, where you will limit the time for each move, from this time you send data to the server and your opponent query this data the server.
I was working on the exact same thing. You'll want to use sockets to open up connections between multiple instances the same app.
I created an example app that demonstrates how to do this which I link to and explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-2.html
I have an example for both Android and iOS that communicate with each other.

Peer to Peer communication between iOS and Android devices

So I am a relatively new iOS developer but thanks to Stackoverflow, i managed to get peer to peer data communication for my app working without the need of a server using gamekit/GKSessions.
Basically, one iOS device acts as a server and others just connect to it to receive app specific data.
Now, the app is currently being ported on Android and I was wondering if there is a way that I can make an Android device connect to the iOS app and behave the same way as ios app does.
Android developers suggested alljoyn to be an optimum solution for android but that doesn't seem to be available yet for iOS.
Please suggest if you have any ideas on this front.
If there is a solution that involves rework on iOS side as well then I am open to it!
In case, you or others tackling the same question in Jan 2013 needs an answer,
AllJoyn is now ready for iOS too, amongst other platforms.
https://www.alljoyn.org/docs-and-downloads
Venkat i suggest you to read and get some detailed information regarding P2P. This is a Good source, because you might get stuck if both devices are behind multiple Nat. but if your willing to go forward there is always a way. My suggestion would be an Relay, but you need to have a server, but the relay behaves like P2P. Look at the source above to get ideas.
I didn't have time to wait for alljoyn to be launched for iOS and sensing no other feasible solution that would fit on my timeline, I implemented a relay server in between to achieve this.
For others though, iOS binding is now available for alljoyn (www.alljoyn.org).
I haven't tried it yet but the android version of my app works with alljoyn and it works perfectly so I assume it will do the same for iOS as well.
One limitation to be considered using alljoyn is that it cannot communicate between devices that are behind different subnets.
I think there is a limit of max peer to multiple peer connectivity (max 8 peers) derived by IOS and Android, there is no connectivity tested using alljoyn between IOS and Android devices

2 way communication between a .Net server and a mobile OS

I am trying to build a game that for both android and iPhones that communicate with a .Net server for sending and receiving data about the game state. One of the requirements is that I am having an issue with is that I need a way to do 2 way communication in near real time and I can't seem to find a way that works. Also if it helps I am primarily visioning this game being played over a wifi connection to both the server and the clients for at least the first release.
I have tried looking at the push messaging services but they do not seem to be fast enough. I have also looked at using a netTcp binding in wcf but that seems to require a .net client.
Does anyone know a good way to solve this problem that I may have missed?

creating network between 2 emulators running on 2 different pc's

we are doing an android chat application in 2.3.3 as a project in final year BE and very new to android, we thought of doing both anonymous and friends chatting together and wanted to show chatting in 2 different emulator running on two separate laptops. Is it possible to do so. We are stuck here from many days. Not getting any clear information how to achieve it.We are not getting how to create a network between 2 emulators running on two systems and do chatting, Any help in this regard will be greatly appreciated.Thanks in advance
I have to start working on something similar :) Sure it is possible to communicate, it is necessary to use Android connected to App Engine, using the XMPP protocol.
App Engine
XMPP
I think Google has some XMPP servers, so you can make use of them. I'm sorry not to help you more, but I just did the research, no coding yet!
I would suggest to use indeed a server to communicate to as a middle-man. Not a direct connection between the two emulators.

Categories

Resources