Is there any way to send request from a server to an Android phone? Actually, I want to control an application (enable or disable some features of the application) in an Android phone by a server. Can I use the IP Address of the Android device?. Can anyone guide me.
Thank you!.
Much simpler way is for phone to contact server and ask should features be enabled. You could also use something like this http://code.google.com/android/c2dm/ but I'm not sure if this is an overkill for your use case.
If the above option is not suited for your case then you can create a simple service
for your application and then attach to application.
The service can be a thread which sends requests to the server with some time intervals that you find suitable and can check if there is anything to check and to do for the application.
And also can run in background.
All push services are usually implemented as well concealed polling. Phones on 3G networks usually sit behind NAT proxies and are not visible to outside world. The same holds for most wlan networks - so either use C2DM, or write your own service polling config information from some server provided by you
Related
In web browser we are able to detect network call in devTool/Network, So similar to that is there anyway to detect network call made by third party apps in my android/iOS device?
I have total control over my network as well as my device. Lets imagine two cases.
1) I don't have any idea about reverse engineering the source code of an app, and just wanted to capture all network calls happened in runtime environment. Is there any possibility to use network sniffer/packet sniffer like wireshark?
2) I know ways to reverse engineering an app to certain level using libraries/tool like this and want to extract the possible network calls which may happen when I would run the app. Is there any way or someone has done it?
The motivation behind this activity is to detect network calls done by third party apps which contains payload which is not given permission(my browser cache/history/cookies etc).
Also let me know in comments if I need to add anything more in the question text.
There are various tools like wireshark and charles proxy that can help you with intercepting the calls.
Basically, for this, you would need to set up a proxy to your computer on your mobile device which will redirect all your network calls from your mobile device to your computer and then to the internet. Thus, your computer will be able to get the network call data.
Some apps have implemented SSL pinning. So when your laptop will act as a proxy in between, those network calls will fail, but I believe you will still get the data they wanted to send to the server.
I want to send notification from one android device (android tv without bluetooth, telephony) to another android device (phone/tablet). Both are on same wifi network. Through the notification, I want to launch an app or open a page in phone/tablet browser.
I went through GCM messaging and also saw some options where we can have a kind of http server on the phone running but could not understand implementation.
Can someone help with idea and if possible, some piece of code as well.
As I need it for demo, so even any hack solution is fine for me :-)
Thanks for any help or reading.
Your best bet as a hacky solution is to do simple Socket connection between two devices. Since they are on same Wifi, it will be simpler and won't have any firewall restrictions.
Avoid GCM, it requires setting up a GCM Server and then complex registration. It also makes your solution dependent upon Internet connectivity & Google ofcourse.
See an example here:
http://android-er.blogspot.in/2014/02/android-sercerclient-example-client.html
Basically one device such as TV can be a socket listener. The phone/tablet can connect to that socket and then you can initiate a notification on either device based on your requirements and data exchange.
can someone confirm, that it is possible to create a web server on android device ( which uses 3G or 4G internet ) and access it via internet ( from the remote PC connected to the internet, not from the same local network ).
I know there already are some web servers for android ( iJetty, nanohttpd ) and the programms like ksweb, so it seems, that it should be possible.
However, I've done some searching in the internet and some people warn, that mobile devices work using NAT protocol, so it would be impossible.
Can somebody resolve the ambiguity?
Thank you in advance.
No, it is generally not possible. The dealbreaker problem is not with Android, but rather that just about any mobile network provider is going to block incoming connections.
For special purposes, you can do things like have the phone contact a publicly visible remote machine and create a tunnel with something like ssh through which inbound connections can then be sent if there is a server program listening on the loopback interface of the Android device. But this tends to be only useful for things like remote testing.
Were you using wifi you could do this, but you'd need to accept that Android is not designed to promise a high availability of any 3rd-party program. You would need a wakelock to keep the processor running. And you may even need to do things like periodically initiate outbound traffic from the device in order to keep the wifi stack/radio in a fully active mode so that it can accept connections.
Generally speaking, data you want to make remotely available from the device should be proactively uploaded to a mutually visible server. If you want to send requests to the device, look at using something like Google Cloud Messaging which is designed to wake up the device and a recipient application on it in order to deliver a brief message.
what is the best framework that I should use to make a remote control app for Android. What I want to do is something like Tony Fadel's app for Android and Iphone where you control your house thermostat temperature remotely with a smartphone app.
I was going to use sockets programming, but not sure if that is the best way. If it is then i will use it, but wanted some feedback before i get started.
If I make one android device the server and the other device the client I will still have to manually set the IP address every time I want to connect the client to the server.
I am trying to avoid having to make a web-app and having to make a php website to act as a server for this. Having to keep a server running is too much overhead. would rather make something like two android phones or tablets that can send message to each other over the internet or wifi router without too much setup and effort.
Would appreciate any ideas on this. I can't figure out how the nest thermostat works (http://www.nest.com/) but that is kind of the functionality that I am looking to copy. I wonder if they have to use a centralized server for all of the remote controls. If there is a way to do this peer to peer that would be great. that way all i would need is two Android tablets.
The other examples I can think of is VOIP like skype and google talk. I am sure these don't use a centralized server for voice calls. My needs are much more simple. no voice or video, only sending text messages from one android device to another over the internet. Each android device will probably be using wifi exclusively.
For my Android app, users need to connect to a server that will be hosted somewhere on the same LAN. There can be multiple servers hosted on the same LAN. To make it easy for the user, I was going to scan the current LAN that the Android device is connected to and then list all of the network devices that have the server running on it, rather than having the user input the IP to the computer manually.
I'm fairly new to networking, and after some searching I found out that I would have to use a multi-cast DNS search or UDP broadcast to detect the other devices. I also found a nice library called jmDNS, although I've found very few documentation and sample code on it. Could somebody point me in the right direction for what I'm trying to do to save me wasted time (mostly if I'm on the right track)? I'm assuming that I'll have to modify my server a bit to broadcast it's there? It works completely as intended if I input the IP manually into the configuration page on my app. Also, this only needs to discover Windows computers, not sure if that matters. Thanks in advance.
Well, jmDNS is a complete Java library that you could use for your setup. It can be used to braodcast your services which other clients can search for.
Bounjour service on windows is a bit tricky, although it's definitely possible. The easier way, I would say is to use jmDNS for broadcast and discovery for both your servers and clients.
You would run the jDMs or other service on your local area network as a background service or a dameon.