Distributed app without external server design problem - android

I am trying to figure out good design for an android app that is ment to communicate with same app on other phones.
Lets assume following scenario, 4 people meet and they want to connect thier phones together to share some messages between them. I have decided to try out following approach: One of them creates a group 3 other people will join. Creating a group essentially will start a server and open a socket. How remaining 3 apps can find out how to connect to the newly created server?
I have considered using bluetooth, but as far as i know it is limited to only a few devices. Manually sending IP addresses to eachother seems to be an option, but thats not what an app should do. External server would be a solution to this problem, but the entire point is to avoid having that.
What would be a possible solutions for apps discovery?

Related

Android app, Is there a way to get another device to access that url without having to type it manually by the user?

best regards from Venezuela, I am new to stackoverflow, and this is my first question on this site.
This question will be long because I am providing a lot of detail, so this question is as clear as possible.
Brief introduction.
I have created an app that runs on Android devices, this app allows you to share files between devices that are connected to the same WI-FI network. but with a different methodology to that used by apps that are intended to fulfill this same purpose.
On the device where my app is running (which we will named device one), a url similar to http://192.168.1.102:7898 is generated, and said url must be entered in a web browser installed on the device with which you want to share the files (which we will named device two).
The main purpose is to offer a way to share files between devices, using WI-FI. without the need for device two, my app has to be installed.
You can find more information in https://labs.xda-developers.com/store/app/com.tecnoelias.ipfiles
...
So far everything works fine. But, it is annoying that every time someone wants to share files using my app, on device two, they have to enter the url described above. keeping in mind that said url will change as the WI-FI router decides, and therefore, you should not use shortcuts to the url (bookmarks or navigation history).
Having said all this, the following question arises.
Is there a way to get device two to access that url without having to type it manually by the user?
To accomplish this, three ideas occurred to me.
1: Generate a QR code in the app. but this requires that on device two, an additional app is installed that can read QR codes. which violates my purpose.
2: Implement in the app, a mechanism that allows you to find other devices that my app is working on, and in this way, interact with those devices (through my app, similar to how other file transfer apps do). This is a good idea, but it nevertheless requires that my app be installed on both devices.
3: My third idea and the one I would like to implement is the following:
On device one, it will open my app and then activate it.
When the app is activated, the app will search for other devices that are connected to the same WI-FI network, until it finds device two.
If successful, a SOMEWHAT will be sent programmatically to the device two, that SOMEWHAT can be, a message, a bit, a data packet, or anything else that helps to realize this idea .
After device two receives that SOMEWHAT, it will show a notification or a pop-up window, which will allow access to the url generated in my app (on device one).
Consider two things. 1: NO additional app MUST be installed on device two. and 2: Because device two can be running any operating system, the SOMEWHAT will be a different mechanism for each operating system, (operating systems can be, Android, IOS, BlackBerry, Symbian, Windows Phone, Windows, Linux, Mac, among others).
If for example, device two, runs Android 10 (not rooted), and has the most common applications installed, which can be: WhatsApp, Facebook Messeinger, Google Play Services, other Google apps, and system applications.
My thought is that you should be able to use one of those apps, to receive the url, and after clicking on that url, the web browser will open, and then it will load the corresponding webpage (which in this case, is to access the files shared by device one, through my app).
Any ideas?
You can give me your opinion, some code, or you can just tell me that this can't be accomplished.
Any response or suggestion are appreciated.

Socket vs Database in Game Creation

I am creating a multiplayer game for android which will be like: you choose a character, you get an oponnent and during this player versus player "fight", they only click in buttons which are the "attacks".
Though at first it seemed like a simple task I am not quite sure how to do the communication between the users of which attack was selected by the opponent, but I've come up with two possibilities: Sockets and Databases.
Sockets seemed like the best option, however, what I've found is that they only work on the same network, what definetly doesn't serve my purpose.
About Database I am not sure if it is a good idea, as making so many requests to check whether the other player has already chosen would make the game laggy I think. I have even created an Firebase account, as their Realtime Database seemed much more reasonable to use, but I couldn't find any way in which I could integrate Firebase with LibGDX (which I am using for this app).
To sum up, the answer is: what is the best way to exchange data quickly? How could I implement it using LibGDX?
I am using Android Studio if it helps anything and am on 0$ budget.
Because of the $0 budget then getting a VPS (virtual private server) is out of the question. So you need another alternative. Run your server from home, from your own PC.
Your next step would be to get a free dns service which will redirect a web address to your home routers IP address and from there you can setup your router to redirect ports directly to your PC. These can be web ports, or ports for TCP use.
You will then have a choice of what to use:
1 - Web sockets which can be used by various languages that will run on the server.
2 - TCP/IP server which is less overhead than web sockets and is direct communication via TCP to your server.
Both of the above will have their strengths, but it is up to you where you start. The server software itself can be written in many languages, including Java which will be more compatible with your current Android project.
There's no way I can explain in depth any further without other questions being raised. So from here, it's a lot of research in the various technologies.

OneNote for Android - Offline API?

I'm looking at developing a to-do list Android widget that draws from a OneNote to-do list.
While most Android phones are permanently connected to the internet via 3G or LTE, many tablets are still WiFi only and will not have internet connectivity when on the go. I could, in this situation, store the data that I receive from the API locally and queue any changes made for the next time the tablet is available online, but there's a problem with this solution. What if the user edits the same to-do list via the OneNote app?
What I'm wondering is if there's any way that my widget can talk to the OneNote app when the device is offline.
It seems that OneNote's data files are stored in a location that needs a rooted device to access externally, so interacting with them seems to be not an option. How can I achieve my goal?
I'm new to Android development, but I think Android's Intents system might be a solution. Does OneNote expose any Intents?
Thanks,
YM
(Apologies if the tone in this post seems strange, I originally posted it on answers.microsoft.com but was told that it belongs here instead.)
We don't have Android client APIs at this time, and talking to the local files isn't a good idea, as the app isn't expecting them to change outside of its control. We would like to get round to client APIs, across all platforms, but its unlikely to happen in the next six months at least. This would be a good request to post on our uservoice site to see if there's broader interest. Please do include the scope of the methods you'd need.

Android shared database development

Please give me some light regarding to this situation. I'm new in android development and I don't know how to handle this. I need to have my application to be install in many Android devices at least two device. Now I want both of them to share single database at the same time because there will be data to be process by one another. I'm a full pledge ASP.Net programmer so my mindset regarding this situation is to build a host device then the other one will connect to the same network as where the host is connected or is there any other way how this two can be connected then share the same database.
Thanks in Advance.
Make a REST api and talk to it with all android devices. The server must control the database to make sure that nobody reads or writes the same database rows at the same time.

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.

Categories

Resources