java programmers!
I'm developing a free app for the Pace. But I'm unable to connect to the network, even with INTERNET permission in the manifest.
Any suggestion/snippet/app to watch and learn how to do?
Thank you
Fabrizio Casellato said:
java programmers!
I'm developing a free app for the Pace. But I'm unable to connect to the network, even with INTERNET permission in the manifest.
Any suggestion/snippet/app to watch and learn how to do?
Thank you
Click to expand...
Click to collapse
Hi!
You have to connect to wifi programatically before make the request, for example at app start up, to be sure network is up.
Code:
WifiManager wifiManager = (WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true)
*Wait network to be connected not only on
Thank you very very much.
And, what about connecting the watch to the smartphone network using Bluetooth connection?
Can I only use wifi?
Related
SOLVED - But I'm not sure how, I was redesgning the app so that I could put it up here for other leo owners to test and gave it one last go to take a screenshot of the error to show people what I was looking for and viola it starts working (I never changed the TCP code) sorry anyone who finds this who has the same issue but it just randomly started working!!
Hi fellow devs,
After a massive googling session I have not been able to find an answer to the following issue:
I am writing a TCP client/server app with my PC as the server and the client being my HD2.
I am writing the app in VB.net using the .net compact framework 3.5 and the windows mobile 6 sdk.
I just cannot get the following code on the client side to work over wifi:
Code:
Dim ParsedIPAddress As IPAddress = IPAddress.Parse("192.168.1.10")
Dim client As New TcpClient()
client.Connect(ParsedIPAddress, 7209)
I get the following exception:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Click to expand...
Click to collapse
If I connect the phone via active sync it will work and I can send and recieve data ok so it appears there is no issue with the code itself.
While connected via active sync - if I turn off the server side app I get the following exception:
No connection could be made because the target machine actively refused it
Click to expand...
Click to collapse
However the exception message remains as the original if I do the above but using wifi so it just is not able to establish a link at all (or not even trying) using wifi??
-----------------
I have tried:
1. Ensuring that windows firewall on the server is off and not getting in the way of anything
2. Ensured that my mobile has got an active wifi connection and can see the machine (wifi remote control apps such as GRemotePro work ok)
3. Turned off all other types of data connection (GPRS,3G) to make sure my mobile has only one route out
------------------
Is there anyone out there who has successfully got TCP to work with the .net compact framework and if so how???
Should I be using another class rather than TCPClient maybe the underlying Sockets class?
Any help would be greatly appreciated.
Cheers,
Prime.
P.S. I don't mind if people only have a solution in C# I'm happy to do any translation etc...
Socket class also fails
Ok so I've tried the socket class now as well and that fails in exactly the same way over wifi, ensured that I can ping my device and ping my pc from the device so clearly the underlying hardware is working just not for the TCPClient or Socket... Any ideas anyone?
Have you enabled port forwarding for the relevant port and IP address in your wireless router?
That's the only thing that springs to mind for me.
Thanks for the reply but...
Hey John,
Thanks for trying to help although unfortunately this does not bear any consquence in this particular situation, you only need to do port forwarding if Network Address Translation is going on between you and the end point. In this case the endpoint (IP + Port) is on the internal LAN with no address translation in between. It appears the the internal WIFI adapter is not being accessed correctly from the application i.e. this is an internal issue on the phone not an issue with the network in general as I can run the same code via active sync and it works also I can convert the project to a standard windows pc app and run the same code from a pc and it works. Oh and of course every other damn (this is really wierd) wifi app I've got works so something with the .net cf and wifi maybe??
Cheers,
Tony.
A development...
Ok so I have dug out my old Orbit II just to see if this was device related and low and behold it is ARGGGHHH!!! The app works just fine on the Orbit II over wifi.
Does anyone know of any policies, security or otherwise, that would stop the HD2 (leo) from being able to use wifi from the .net cf?
<<--delete-->>
Generic reasons for communication failures
Hi
This is a pretty generic problem, I'm afraid you can't give an exact idea of where is the problem so I can't give also an exact solution.
Usually a communication problem is due to one of this three
1) The server does not listen or does not receive
2) There is a problem with the network
3) The client does not make the call
Type 1 should be checked trying to connect to the server with a PC or a laptop. You should be able to make the client run in a PC.
Usually when a (web) server has a (web) tcp service stopped, when you try to connect to it it rejects the connection (this is what that of "the target machine refused it" sounds to me). Start then the (web) service on the server. Change (web) for your application.
My advice is that you should have something in the server side where you could run a wireshark sniffer. Then you would see all the traffic coming from the PDA and see if your client is sending packets.
Type 2 are the ones that can be checked with a ping. Maybe there is a firewall somewhere dropping the packets.
Type 3 may be due to several things
a wrong code (I don't know, there is a lot of time since I made programs)
you're trying to connect to a dns name that can't be resolved. Try with IP address.
You have a wrong network configuration. The server should be in the same network but client is not able to get the server's (or the router's) MAC with the ARP protocol. So it doesn't make the call.
I hope it helps.
Regards
Sent from my SM-G900T using XDA Free mobile app
When I use my Gs5 as s hot spot for internet for my laptop if I use a vpn the data will not work. If I try to download a web page it will say theres no data connection but if I disconnected the vpn it works just fine.Does anyone know why when connected to a vpn this problem occurs. Thanks In advance!!!
Sent from my SM-G900T using XDA Free mobile app
xda23 said:
When I use my Gs5 as s hot spot for internet for my laptop if I use a vpn the data will not work. If I try to download a web page it will say theres no data connection but if I disconnected the vpn it works just fine.Does anyone know why when connected to a vpn this problem occurs. Thanks In advance!!!
Sent from my SM-G900T using XDA Free mobile app
Click to expand...
Click to collapse
More then likely, the VPN is detecting the tethering connection causing it to try to encrypt that as well as the actual data connection.
I take it you're using an app to establish a connection to the VPN? try using the native VPN connection inside android. I have used a VPN with tethering before and I believe that was my setup.
Sent from my SM-G900T using Tapatalk
elesbb said:
More then likely, the VPN is detecting the tethering connection causing it to try to encrypt that as well as the actual data connection.
I take it you're using an app to establish a connection to the VPN? try using the native VPN connection inside android. I have used a VPN with tethering before and I believe that was my setup.
Sent from my SM-G900T using Tapatalk
Click to expand...
Click to collapse
Yes I'am using an app to establish a connection.how do I set up the native vpn connection inside android. Thanks
xda23 said:
Yes I'am using an app to establish a connection.how do I set up the native vpn connection inside android. Thanks
Click to expand...
Click to collapse
Settings > Connections > More networks.
You will need to get the server destination address and other information from your VPN client.
elesbb said:
Settings > Connections > More networks.
You will need to get the server destination address and other information from your VPN client.
Click to expand...
Click to collapse
Thanks my friend.
xda23 said:
Thanks my friend.
Click to expand...
Click to collapse
Yup. I've used that method for playing PS3.
Hey if I was to use wifi tethering app from the market for rooted devices then a vpn app set up would work right? I just need to use the built-in vpn setup when using my native wifi hotspot? I that right. Thanks.
xda23 said:
Hey if I was to use wifi tethering app from the market for rooted devices then a vpn app set up would work right? I just need to use the built-in vpn setup when using my native wifi hotspot? I that right. Thanks.
Click to expand...
Click to collapse
Nope. You need the built-in VPN setup any time you tether. Whats happening is the VPN App is detecting the WiFi connection and you data connection as being "internet connections" therefore it tries to encrypt the WiFi and Data connections double encrypting the data. Or, its not sure what network to port the data through. Using the built-in VPN setup only allows the data connection to be "VPNed"
I used to use WiFi Tether For Root Users on my S4 but still had troubles with VPN until I manually set up the VPN in android.
elesbb said:
Nope. You need the built-in VPN setup any time you tether. Whats happening is the VPN App is detecting the WiFi connection and you data connection as being "internet connections" therefore it tries to encrypt the WiFi and Data connections double encrypting the data. Or, its not sure what network to port the data through. Using the built-in VPN setup only allows the data connection to be "VPNed"
I used to use WiFi Tether For Root Users on my S4 but still had troubles with VPN until I manually set up the VPN in android.
Click to expand...
Click to collapse
O.k. I got you.Im going to set me up a android vpn. Thanks, my friend.
xda23 said:
O.k. I got you.Im going to set me up a android vpn. Thanks, my friend.
Click to expand...
Click to collapse
Shouldn't be too hard. Just contact your VPN service provider, and ask them for the specific connection options you need. For instance, I know Private Internet Access allows you to connect without using their app. They have a webpage setup that has all the info you need depending which server you wish to connect to
xda23 said:
O.k. I got you.Im going to set me up a android vpn. Thanks, my friend.
Click to expand...
Click to collapse
In the following post I described how you can setup a VPN connection on GS5 that might be helpful for your case as well:
http://forum.xda-developers.com/gen...tive-vpn-android-device-t2868224#post55313798
Dear Community!
Like the title says, I want to know if I can connect to my Intranet over wlan, to use the data stored on the server, but at the same time I want to use my mobile connection for internet.
I hope there is a solution
have a nice day :fingers-crossed:
don't think that's possible.
But if you have a VPN server you can connect to this via Mobile Data.
Thanks for your answer
figured it out.
It is possible with Android lollipop
sayz said:
Thanks for your answer
figured it out.
It is possible with Android lollipop
Click to expand...
Click to collapse
Can you share how you did it?
It seems like it's a feature of lollipop so I only updated and tried it. But it only works If the wlan network has no internet connection, the phone then grabs the mobile data connection to stay online.
More of a technical/dev question, I notice when I go to WiFi settings it'll take a while to connect then I can ping things from adb shell but when I'm not on that screen I cannot ping things... does anyone know what exactly is triggered to connect to the WiFi? Or if I can use the existing bluetooth connection to my phone to connect to the internet?
I'm trying to build some apps for the amazfit but I need either a consistent connection or to connect when the apps are opened... I noticed wpa_supplicant in the /etc/wifi folder which means I could potentially start a daemon with root but I'm wondering if there's a better way?
There must be something doing it as the updater app can start the WiFi connection as required... just can't quite figure out what's doing it yet.
Monotoko said:
More of a technical/dev question, ...
Click to expand...
Click to collapse
Welcome to the mystery of Amazfit wifi
Not really. I wrote about it a while ago here. https://forum.xda-developers.com/showpost.php?p=74857110&postcount=36
TLTR; your app just has to turn the wifi on by itself and (once connected) then can use the connection normally. The connection is lost when the watch is asleep though. So, your app needs to keep the watch awake until it's done with the connection.
anox said:
Welcome to the mystery of Amazfit wifi
Not really. I wrote about it a while ago here. https://forum.xda-developers.com/showpost.php?p=74857110&postcount=36
TLTR; your app just has to turn the wifi on by itself and (once connected) then can use the connection normally. The connection is lost when the watch is asleep though. So, your app needs to keep the watch awake until it's done with the connection.
Click to expand...
Click to collapse
Thanks a lot! That should work for my first app... I only need a few updates stored, also wondering if it's possible to connect to the internet via BT through the phone?
Monotoko said:
Thanks a lot! That should work for my first app... I only need a few updates stored, also wondering if it's possible to connect to the internet via BT through the phone?
Click to expand...
Click to collapse
https://forum.xda-developers.com/smartwatch/amazfit/dev-library-amazfit-communication2-t3779946
and
https://forum.xda-developers.com/smartwatch/amazfit/app-amazfit-internet-companion-generic-t3779945
hello lads, I am interested in making Android application that can be use as VPN server, any tips where I can start from ? Is it possible ? I have not see any good topic about this in net
I just wonder why you consider an Android app as a VPN server.
Is it just a portal for a specific LAN? Or do you need a general VPN server for encrypted internet connections?
Even if you can implement basic functions of this VPN server, don't you worry about its concurrent & load capacity as a 'server'? ......
Its definitely possible but you'll have to likely root the phone first.
I turned a rooted Android phone into a VPN server by using the Linux Deploy app and UNIX tools "busy box app" then running CentOS on Linux Deploy. I installed SoftEther VPN Server on CentOS through SSH on the phone.
I wrote about it in a forum. If you google "Turn a flashed to verizon phone into vpn server" it will come up in Aspkin forum and you can see me work through it.
This way is 100% free and SoftEther will tunnel straight through a firewall using port 443 unlike any paid app so you can leave the phone hidden anywhere connected to WiFi and as long as you use SoftEther Client and the DNS host name to connect to the server. It wont work if you use a openVPN or L2TP/IPsec client without opening ports on the router of the wifi connection, or the server IP address (which would be a local ip if connected to wifi hidden somewhere).
Click to expand...
Click to collapse
James_Watson said:
I just wonder why you consider an Android app as a VPN server.
Is it just a portal for a specific LAN? Or do you need a general VPN server for encrypted internet connections?
Even if you can implement basic functions of this VPN server, don't you worry about its concurrent & load capacity as a 'server'? ......
Click to expand...
Click to collapse
Thank you for your reply. I just want to make a VPN server that uses a mobile network and accepts connection from 1 device(concurrent or load capacity or encryption does not matter). It is a small part of my application and not for commercial use. so, everything is possible, to root a device or another way to do my goal.