My Android project won't use VPN - android

I have a simple app that tries to access an API from a remote server. For testing, I need to use a VPN in order to access it since it is blocked in my current location. When using the browser on the phone, I can get the JSON response I need but when I run my app, It doesn't seem to use my VPN because the JSON response is not the same. I'm using the built in VPN of my test device which can be found in the settings. Any ideas about this? I'm using volley for request.

Related

Unable to make local network calls using IP address on deployed react native app

My react-native android app uses the IP address of a smart device on the local network to communicate with it. This works perfectly in testing but now that I've launched the app for internal testing this call fails.
Ex call is: http://192.168.88.39:8080/version
This call works perfectly in development, but not on the deployed app. I was previously using a hostname to resolve the IP address of the device on the local network but realized this didn't work with Android, so I switched to using the IoT device's IP address to communicate with it.
But to my surprise that isn't working. I've also tried to setup a Charles proxy to intercept the requests but have been unable to do so successfully so I'm not sure what the exact response is from the http request.
But I know it doesn't resolve.
So firstly is this even possible to do? Want to make sure this is not prohibited?
You cannot access http urls in a production build. Check this question for possible solutions Android 8: Cleartext HTTP traffic not permitted

Android Development: how to create a basic server for my android app?

I am building android app that connects to an API.
The problem I am running into is the following: the API doesn't let me do more than one request per second, and if I have more than one person doing the search at the same time they might shut down my account.
I am looking how to create a server that is supposed to: 1. control the traffic (whenever needed, wait the necessary time), and 2. simply forward the request.
Any ideas on how to proceed?
you can get a server from goddady.com and connect your application with the server using a page php and api parsing json like Volley

Android App - Use System proxy settings for whole app

I am currently deploying an app to a company that requires using their proxy for outbound http[s] connections. The issue I'm running into is my all of my requests I wrote work fine because I can make them use a proxy, however I'm using the Parse library for handling push notifications. When the user logs into the app it needs to setup the push sub on parse but cannot due to the app trying to use direct http connection to api.parse.com.
Is there a way to force all of the app to use the system proxy settings?
Is there another push library/service that would better suit my needs if not?
Thanks!

Accessing Internet through Android Application

We, two team mates and I, are trying to access a WCF web service through an Android application. We are using a JSON for the transport of objects. We have tested that the service can be called through HTTP via google chrome, internet explorer and the android browser on the emulator.
We have already set up the internet permission in the android manifest using
<uses-permission android:name = "android.permission.INTERNET"/>
We are using the HttpClient and the HttpResponse objects, to connect to the WCF Server.
Currently we are attempting to access the server both locally on the machine that the emulator is being run on, and one that has been hosted on the local network.
Our problem seems to be that we cannot connect to any server through our app, whether it is our server we are trying to connect to, or any other server.
We have already tested the server connection with a windows phone program using http, which seems to work fine.
Are we missing something obvious? We really do feel like we are banging our heads on a brick wall.
Many thanks for any advice given and if any more information is needed please feel free to reply.
Use 10.0.2.2 as IP for the server running on the same machine as the android Emulator...
Try using Traceview http://developer.android.com/tools/help/traceview.html to find out where the problem is happening. You can use it to create a trace file showing the status of the network connection and where it is failing.

Method to pass username and password in VpnService.Builder

I am developing the application in which I want to use VPN network. to create VPN network in device we need to configure it from (settings-wireless and network-VPN settings) menu of device.
I want to do this many settings via code with hard-coded information.
From API level 4.0 android provides API to handle the VPN services.
To know the implementation of this methods I used the Sample project of Android ToyVPN. But in this many methods I didn't find any method to pass username and password. information which I have to connect VPN network is.
VPN Server name
Username
Password
Using this three information I am successfully connecting to VPN network if I am configuring manually from device. But I want to do this programmatically. Here is the class file which is used to connect to VPN network. ToyVpnClient.java and ToyVpnService.java. in addition to this sample application is crashes in device.
Any help will be appreciated.
The VpnService you are talking about is not what you think. It's just a framework for you to create your own VPN solution. Once established, you'll get all communication on the network (IP) layer and you can do anything you want with it, e.g., encrypt it and send it to your server - the example for this is the ToyVpn project found in /samples/android-14/ directory. You also need a your own server side code to do the decryption and the necessary routing of the traffic.
Unfortunately you can't set the built-in android VPN programmatically. The best you can do is to show a dialog to the user explaining how to set it and then pop up the system settings with the correct screen showing.
It is possible using internal android.jar(com.android.internal) and hidden(#hide) API. Refer the below link:
How to programmatically create a new VPN interface with Android 4.0?

Categories

Resources