Remote sharing my app (Android/iOS) to a desktop user - java

I'm looking for guidance on how to achieve (build) the following:
I have a native App (supported on both Android and iOS)
I have a user 'A' who has the app installed on his phone.
I want another user 'B' to be able to remotely (on a browser) be able to "view" or "take control" of the app being used by user 'A'. So, User A could say "Share with User B" and User B starts seeing a virtual view of the app on User A's phone, and follows as User A navigates around the app.
Basically, some sort of screen sharing on phone, but only limited to my app.
Note that I do not want the user 'A' to install any separate app to share my app. It should be a capability existing/built within my app itself.

To achieve your goal there are smaller problems to take care about, from screen change detection to P2P communication between network nodes.
For iOS there's a Hierarchy Viewer github project that setups HTTP service on device, allowing to preview snapshots of app window using a web browser. Making use of that, you'd still need custom protocols to notify about user touch events and screen changes, which in turn requires effective screen change detector.
Note that this solution assumes no NAT stays between controlling and controlled devices, which is usually a case for local networks. To use the Internet as a medium, you should consider P2P protocols capable of NAT traversal (reffer to STUN protocol for endpoint address recognition and hole punching as a NAT traversal technique).

As a suggestion, how about this? Please note I'm not into this myself, so I might be suggesting something very hard to do.
Create a website that shows the same information as the phone
Make the app have a "server" component
Have the website authenticate and connect to the phone
Have the phone to send over the data from the app to the website, which can then show it in the appropriate fields/positions.

I think what you're looking for is some kind of VNC-like server that would be integrated into your application and serves the content of your application ui on the network. It should be technically feasible, yet it certainly won't be easy !
There are several VNC servers for android ; most but not all requires root access though, probably because they serve the phone screen and not one specific application.

Related

Controlling a device hardware via device admin or root

I need to have control over some admin features of android device.
Is it possible to acquire control over hardware not specified in android.app.admin.DevicePolicyManager like disabling access to microphone?
Also it will be good to find ability to track network connections or attempts to use network adapters by apps.
Maybe some command for root console or other way exist - how I can search for?
As far as i know there is no way to block any other hardware except camera with device manager. I believe that if your app takes control of microphone it will be unavailable to other apps, but i am not sure. Note that from android 8.0 no app is allowed to take control of microphone while in background.
About tracking network activity you could open vpn to monitor all packets that are sent and received.
Please keep in mind that i am not familiar with root methods so you should do some more research on this.

How to implement client server in android for making BINGO game, but not for chat application

I am making a game of Bingo. For that I will be connecting two mobiles via wifi- hotspot and the grid should be shared to both clients, that is both mobiles should see the grid. How can i pass the grid two both clients? Also, how to pass numbers in between client and server? Via object or other thing and how? Also how to exactly implement client server application making 2 java files n android? PS: we are not implementing a chat application.
Bingo XML file: https://github.com/TanishaShrotriya/SDL/blob/master/activity_main_bingo.xml
Java File:https://github.com/TanishaShrotriya/SDL/blob/master/MainActivity_bingo.java
You have a few options. First you need to determine which architecture works for you.
Client/Server (AWS Instance with APIs, and Firebase with PUSH)
---This will enable the devices to get current came status on open, and push changes to their board on confirming their space was called/filled.
---This will enable other devices in that "room" a name given to a virtual shared space for a game. To receive PUSH notification of changed data to display.
Next you need to decide if the server will maintain the full state of each user or just the current called values for comparisons.
If you decide that you do not want to write APIs and setup a Server for PUSH, you can do an ad-hoc wi-fi or even a BLE based communication among everyone in the area. However, this will require significantly more understanding of how to pass bytes, handle network issues, latencies, and communicating from device to device.
If you choose to do the ad-hoc wifi as you mentioned you would have to maintain a ton of connections like a mesh network. A better option would be to have all devices join the same wifi network so that they have access to each other, but aren't necessarily keeping track of mesh networking.
However, even if you are on the same wifi knowing who to send the information to can be difficult without a server to retain routes and IPs of current players. So you may have to create a host so that it can listen for enrolled players. The host device would need to retain routes to all other devices so that it can send the info to each IP address when a change occurs.
I still highly recommend going the client/server route of APIs and PUSH it will be far more reliable.
Now as far as how to pass the data, you could of course screenshot via code and send images, but that is wasteful. I would recommend having a matrix that keeps track of the values covered and simply send a JSON snippet of the card_id, the player_id, and the json of covered blocks to the server that can then push changes back to all players in the "virtual room". This allows them to see how their fellow competitors are doing.
So I would have to ask for more details about what your goal is to help any further, but that is my recommendation, because ad-hoc wifi or bluetooth is doable, but on a mesh scale size you will have a giant headache on your hands. The host scenario device with all on same wifi would be my second direction if you are really anti-server and APIs, which the only reason I could see you avoiding that is if you wanted to play off wifi that doesn't have internet or if you don't want to pay the $30/month for traffic while it is small.
Let me know if that helps or if you want to provide additional clarity.

How to share database between same application in multiple devices without server

I have created database in one application and that application is installed in multiple devices.My requirement is that if i change the value in database of one device then,that changes in database should reflect in another device of same application.I need it without server/third api.
Thanks in advance...
This is precisely when one does need a sever.
Stop and consider what it is that you are asking for. You need a way for a phone to notify all other phones that hold the same application about a change. Phones are not directly addressable to each other via the web, which makes any kind of peer to peer algorithm tricky. SMS texts is the closest form of direct addressing that phones do support, thus it could be used to build a peer to peer protocol, but that would be tricky, unreliable and is unlikely to be beneficial.
A server on the other hand is the standard approach to solving this problem, the server acts as a shared agent that all phones that connect to the web can address easily. Even if the server is just an FTP server on a freebie hosting site.
You need to implement a server functionality in your android application.
What is a server : A server is a running instance of an application (software) capable of accepting requests from the client and giving responses accordingly. Servers can run on any computer including dedicated computers, which individually are also often referred to as "the server".
For further information,I would like to provide this link which will clarify you about communication between two devices Android - communicating between two devices (Use of bluetooth etc.)

android application that allows text and voice communication between devices on a same LAN

i want to develop an android application that allows people on the same wifi network to text and call each other. i looked around and found a few theories which suggested setting up a server client network.i want the devices on the network to scan other devices with the application installed and initiate a chat. i have been using desktop version of such applications which includes outlook messenger, LAN Messenger and a few other and want to apply the same logic to mobile devices.
i have basic knowledge of java to a point where i had to develop a Point Of Sale Application for a store. I need some pointers, a starting point on how this can be achieved and what protocols i have to research to do so.
Have you tried Peer-to-Peer framework ? ..
I am developing a similar app right now, however I am not sure about voice call (although, android support SIP) but I am heading toward messaging ..

How can I code a web app p2p network?

I wanted to code a web application, where one user can choose a file and other multiple users can download that specified file off of that user's computer. That user would have to leave his computer on and leave the web page open.
I dont want to have a big main server that has to handle all that traffic. That user's computer is the server, persay. I understand I'll use torrent.
All this has to be done on a website.
Will a web socket work?
Please and Thanks.
This really isn't possible for a variety of reasons:
Firewalls / NATs
Dynamic IPs
No "server" running on the user's machines
Permissions on the user's machine
What happens if the user simply deletes the file on their machine?
To actually make it work you'd have to:
Convince the user to install the app on their machine (you'd need a windows/linux/... EXE)
Get the user to open a port in the firewall (or use some library to enable NAT passthru)
Have the user's PC ping your server in the event the user's IP changes
On the server side, you'd have to keep several database tables, here are few I can think of off the top of my head:
A user's table (user ID [PK], Current IP, Communications Port, (maybe some other tracking things))
Available downloads table (download ID [PK], user ID [FK])
Then when someone wants to go off and download, you have to (probably) launch your app with the requisite arguments (remote user's IP/port/file ID) and have that do the work of the download.
This is by no means an easy feat.
If by WebSockets you mean the HTML5 variety, I'd stay away from that. http://en.wikipedia.org/wiki/WebSockets#Browser_support
The the computer that has to stay on, is basically your server. Even if it isn't a big server somewhere.
My suggestion would be to install apache or some other small web server on each users computer and have have a dyndns address for each computer so you can find each other. it would be much easier than coding something. especially if it has to be through a web page.
You could use a c# client library to interface to bittorrent or etc and use this mode to upload/leach. As far as NAT/Firewall issues go they are well documented and a function of the protocol being used, ie deal with it.

Categories