Android App - Use System proxy settings for whole app - android

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!

Related

Proxying an Android application to send all it's network traffic to a computer

Is there a way to send network traffic from an Android application to a computer, without using another app. Something like embedding a proxy inside the application. I am currently using PCAPdroid to accomplish this, but would like to do it without an app.
I am currently using PCAPdroid to send traffic from an app on my phone to my PC, in order to analyze it's HTTPS traffic.

How to monitor HTTP (get, post etc) requests that my app is making in android

In my own app, I'm using various 3rd party SDKs that make network calls( HTTP requests) in some form or other. Without editing this code, can I write code separately within the application to intercept all GET and POST requests that my app is making?
I want to record these HTTP calls in my app
I am aware of using Fiddler and Charles proxy tools but that is outside the app but this won't work because I can't record these HTTP calls in my app.
Is there a way to do it?
EDIT: I am using Google Analytics SDK and Facebook SDK in my code. I want to monitor all the network calls these SDK's are making from my app
On non rooted phone you can use android OS proxy and redirect traffic. But some apps doesn't respect it. Makes direct connections. Some tweaking could be done. Use Drony with VPN mode to redirect all traffic to SandroProxy. Here is video how capture then traffic with SandroProxy SandroProxy with Chrome devtools SandroProxy can also capture pcapfiles. Can also make ssl mitm on pcap flow. from SandroProxy support
Try HTTP Toolkit - it's an open-source tool I've been building to do exactly this. It can automatically intercept traffic from an Android device, with no manual setup required, and then allows you to inspect & rewrite all HTTP traffic from your computer, like so:
To intercept HTTPS traffic from your app, you just need to either a) trust 'user' certificates in your application's network security configuration (see https://stackoverflow.com/a/38770284/68051) or b) use an emulator or rooted device (in which case HTTP Toolkit can inject a 'system' certificate, which your app will trust automatically).
Charles proxy is a good way.
Others include if app is using singleton network class (which it ideally should), make one function for get and one for post. Call these functions from your classes and use log.d to output data on console. You can track request response or time taken.
If you are specifically looking for your app to be capable of recording the HTTP calls.
Android Snooper library can be the solution you are looking for.
Have you considered Stetho?
http://facebook.github.io/stetho/
You can monitor and modify all incoming and outgoing requests, among other things.
https://github.com/jgilfelt/chuck/
it adds a new app that send notifications each time a network request is made, and you can see the details of the request.
https://github.com/facebook/stetho
it allows you to use the chrome dev tools to monitor your requests created from an android app. (among other cool features)
If you root the device or running over debug (adb), then maybe this will help:
http://code.tutsplus.com/tutorials/analyzing-android-network-traffic--mobile-10663
Else I don't think its possible to do what you want to do. But you can monitor general network stuff like:
For all traffic stats see:
https://developer.android.com/reference/android/net/TrafficStats.html (just pass in your apps user id)
For monitoring network status:
https://developer.android.com/reference/android/net/ConnectivityManager.html
You Can use this as the better option. Remember to scroll down the app and check network intercept is on.
Link is here https://appetize.io/upload

Is it possible to create an application where the user can send themselves push notifications (and be their own push server?)

I have a need to create an application that will consist of two parts, a PC component and an android app component. I would like users to be able to send themselves direct push notifications to the app running on their device, without me having to run a server that they connect to to handle the push. (Going through Google's push servers are ok)
The first issue of getting their device registry key over the PC is a pain but I think it will be acceptable to get them to email it to themselves and then save it to a config file.
The hard part is that it appears they would require access to my google api key in order to push(and this could be abused). I'd like to to come up with something that is "relatively" easy/automated for them to set up and will allow them to use my software to send messages instantly and directly to their device, which may or may not be on the same network.

MDM workflow in Android

Can any one help me out how to do MDM Integration in Android from client and server prespective?
I want to do an enterprise application which having lock and wipe functionality. I have no any clue of workflow of MDM in Android.
Thanks.
Android Device Admin API will do both things what you want to do (lock/wipe device and even more). An example is given and also you can find this complete source code in your Android SDK directory.
Now as client server perspective:
You have to implement your task (lock and wipe) in your android application (in client, i.e. known as agent). Now your application should be capable to communicate with your server or vice-verse.
I am 100% agree with adamk as he said "Remote controlling your application remains exclusively your responsibility - the Android framework does not provide (or enforce) any solution for that."
And Android gives your this feature too, as adamk said to use C2DM, he was right but now C2DM is deprecated, and GCM has been introduced, “a service that helps developers send data from servers to their Android applications on Android devices.” The service can send a message of up to 4 kb to an application on an Android device, most often to tell the application to retrieve a larger set of data. GCM will now handle all queueing and delivery for messages to Android applications.
You should read how to use GCM, and you can find sample code too. Download GCM Android Library from SDK Manager
and check android-sdk/extras/google/GCM directory
After establishing successful communication between your agent and server, evaluate msg in agent sent by server and perform desire action (lock/ wipe). This is again up to you how you define your message payload and how you handle those payloads in agent application.
Here is an article about Android MDM.
Happy Coding :)
You can use DeviceAdmin to gain privileges for managing the Lock preferences and performing device wipe (among other stuff).
(The user must add your app as a device administrator beforehand)
Remote controlling your application remains exclusively your responsibility - the Android framework does not provide (or enforce) any solution for that.
You may want to consider using Google's C2DM API, which is a convenient push mechanism.
As mentioned in the above answer, DeviceAdmin API can help. If you are using an Android device, you might know about the Android Device Manager (the web-based version) which allows you to manage your device. Basically, you can track, locate, lock, and wipe your device, some of the basic features of an MDM solution. So, in coding (though I am not a coding expert), you need to get access to the Device Manager (I guess, using some listener codes, or notification access).
Apart from this, MDM allows creating policies and groups of users (which would be a part of the coding in the app itself), then pushing the command over the internet (or OTA) to the connected device.
MDM also allows managing Apps and Data on the device, for which, you need the app to get access to the internal as well as external device storage.
Hope this helps. Good luck creating your MDM software

Android application as Web Service

Is it possible implement an Android application as a web service?
On the official site I've read:
Note: If you want to develop a server-side application, we recommend
that you implement your application as
a servlet running in a servlet engine
like Tomcat or full-blown JSEE
container like Geronimo. If you prefer
to implement a server-side application
based on our HttpService, we'll assume
that you know what you're doing and
that you don't need help in figuring
out which interceptors need to be
configured.
How can I implement this? Apache TOMCAT can run on Android?
Is it possible implement an Android
application as a web service?
You can create an Android service that will open up some server socket and will listen for HTTP requests. However, Android will eventually kill off that service, either automatically after it is unused or at user request. And, nobody will be able to access the service except on the same WiFi LAN.
IMHO, truly implementing a Web service on Android is pointless.
I think they're saying that you can write a server-side application for an Android user to access, not that you'd run Tomcat on the Android device itself.

Categories

Resources