failing to open my app after changing proxy - android

I want to do performance testing of an android app.For this, I need to set manual proxy with a port.But, when I change the proxy with some port number (like 8181 or 8282) I not able to open the app.If I opened also not able the send the request of that app to the app server.
How to solve this problem.

Based on the tags, it seems you are trying to script a test scenario using JMeter. You mentioned that the app stopped working after setting the proxy. Could you confirm that you had started the JMeter proxy before changing your proxy settings?
You can have a look at this document for step-by-step instructions on setting up JMeter proxy-
https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
If you are using the latest version of JMeter, there will slight differences in the options, but overall instructions should help you get started.

Related

Ionic Capacitor Firebase Phone Number Authentication Problems

For anyone who is trying to authenticate via firebase phone number using ionic, this post is for you.
I spent weeks trying to solve this problem for my own app, and have moved on to using email because solving the phone number problem was taking too much time, but I am making this post to save you from wasting your time on red herrings.
The Issue:
Phone number can only be used when attached to a url, so if you are making an ionic application through a website, phone number auth via firebase will work, however, if you are trying to do it on mobile it won't work because firebase requires a url attached and there are no urls in mobile apps of course (firebase).
Option 1: Plugins
So, the easiest option would be to look around for third-party plugins to implement phone number auth on. I believe there is a Cordova plugin for this, (cordova-plugin-firebase-authentication), however that library is not compatible with Capacitor (compatable plugins).
There are a few other plugins that I tried to implement without much success. Notably, the (capacitor-firebase-auth plugin). It claims that phone auth works for ios and android, however, the actual method for doing that seems very complicated and follows a different path using .p8 codes that I was unable to follow-through with (confusion). And this plugin has some major limitations.
Option 2: In-App-Browsers
Since option one doesn't seem very feasible right now, the second option is to put code up on a website for phone number authentication and then open a browser within your app to authenticate. I spent a ton of time trying to get this method to work to no avail. It seems possible theoretically, but in practice, it is a mess. The biggest problem with this method is that what you want is to be able to run the signInWithPhoneNumber(phoneNumber, appVerifier) on your mobile app, because then your app treats users that have signed in through phone number like any other user and it makes general authentication much easier downstream in your application. However, in order to do that you need a verified appVerifier, which is of the class firebase.auth.RecaptchaVerifier. The firebase.auth.RecaptchaVerifier is supposed run .render() to initiate the recaptcha provlem and then run .verify() to verify a token that is given after the user does the recaptcha (documentation). I have tried to run .render() on a website and then .verify() on a mobile app, passing the token between the two. I am not sure why this doesn't work, it could just be a problem with my setup, but after trying for over a week on this method, I gave up on trying to get it to work. The token I pass just doesn't confirm. I don't know how these two functions work under the hood, there may be some identification system for each unique instance of firebase.auth.RecaptchaVerifier that is invalidating this method, I really don't know.
If you want to take a stab at this method, I recommend using the cordova plugin (it is compatible on capacitor projects) instead of an iframe or the capacitor browser plugin for in-app-browser to the website because it is easier to use and there is better functionality for passing data between the app and the website.
Option 3: Implementing Manually on IOS and Android
I haven't tried out this method, however, theoretically, you could go into your android studio and Xcode projects to actually write swift and java code following the firebase instructions for firebase phone auth (android tutorial) (ios tutorial). This would probably work, but I am not sure how you would notify your ionic project to defer to the swift and java files when authenticating.
Please let me know if there are any methods that have worked for you or any solutions to the roadblocks I have encountered, this is what I've tried so far!
I am the OP. After doing more work I finally got the phone auth system to work using capacitor-firebase-auth (https://github.com/baumblatt/capacitor-firebase-auth). I also created a git repo showing my code example and how to use it: https://github.com/Darrow8/capacitor-phone-test
In my previous attempt, I was running into issues with getting cfaSignInPhone to work but after more tweaking, it worked. Another major issue was getting firebase.auth().signInWithCredential to work. It turns out I had to combine the aformentioned capacitor-firebase-auth library with #angular/fire https://www.npmjs.com/package/#angular/fire
You can simply use cordova-plugin-firebase-authentication its compatible with capacitor, it works for me.
https://ionicframework.com/docs/native/firebase-authentication

Change default react-native android port

The problem
I'm developing an app which uses MongoDB realm and Redux. When only redux is in the project, no problem. But then after debuggin it with realm installed errors started happening. Realm is using port=8083 for its XML requests, while React Native is running by default in port=8081. So, when realm does its first XML request to initialize the realm app react native crashes.
The troubleshooting
By looking at the react-native-debugger documentation its possible to change de debugger port. Nice! And then i searched for a way to do the same in react-native. As weird as it sounds, apparently react-native's android port is hardcoded by the react-native init, meaning that only the default 8081 port works. Actually, only the metro server and ios port can be changed. I requested support from MongoDB, about changing their default port to 8081. But still waiting for an answer.
This is the app repository
Any suggestion?
Thanks in advance!
So, the react native app was running in the emulator and it did just fine. Then, i had this idea of turning off the SIM Card internet in the physical device. After doing so, the local wi-fi was used (where the computer was connected as well). Shazam...! That was it. End of story. This was the issue. What bugs me is that the documentation forgot to mention this use case. The nearest i could find was this

Change system Proxy settings using Android SDK

I'm migrating a Google Chrome extension that I made to an Android version, but I'm facing some questions.
It is basically a Proxy server for certain websites that were blocked in my country. This is working on Chrome by changing the proxy settings with our proxy and with a PAC file that specifies which sites should be proxied.
How can I change the system proxy settings using the Android SDK? Is it doable? If not, what suggestions do you have to have this done?
Thank you so much.
Ok, so after A LOT of investigation, I concluded that this is not a good idea. Also, in most recent Android versions, use an app to set a proxy is mostly impossible.
I've decided a different approach and use a VPN. It works, but is not as lightweight as I would like it to be.

Android - Orbot Built-in App

NOTE: If you have no idea what TOR or Orbot is, check out this links below:
https://www.torproject.org/
So, I was wondering if possible to add TOR support to my app. This would save the user alot of stress looking for a working proxy and besides, TOR is one of the most safest proxies out there.
Im aware that the The TOR team made an app called "Orbot" which allows Android devices to proxy apps using orbot. The problem is, the only way for Orbot to proxy apps is if they have ROOT and some users do not like taking techy approaches, especially when it has "THIS COULD BRICK YOUR DEVICE!" so I thought if its possible to rip out the Orbot source and add it to my app so my app gets proxied.
This can save lots of people from downloading multiple apps and cut time on setting this up (since my app has to have proxy support to be proxied through TOR which I havent seen much of so i really have no idea on how to have something like this) but im not sure where in the source code is the actual routing to the TOR network and thought i could get a little boost in this.
Im not trying to make my own Orbot, i will give credit
So, does anyone know where to start? I decompiled the regular Orbot app and skimmed through the source but not much rings a bell.
Thanks!
Use ORlib, which "is an Android Library for use by any application that wishes to route its network traffic through Orbot/Tor".
If you want to avoid forcing user to install Orbot, you can include Tor in your application using this project which includes Orbot's tor binary and allows full control over it.

I am almost there...PhoneGap Android connect to WCF Service

Firstly I would like to thank all the experts here on stackoverflow, by reading questions asked and looking at example code and reading the answers i have been able to get to this point. Thank you once again!
I have been spending hours and hours searching for a solution, I’ve read through many posts on this issue. It’s seem this is a issue a lot of others are/has been struggling with.I would highly appreciate any more advise or tips if somebody can assist in this frustrating issue.
All my development are done on my local machine. (Win 7, Visual Studio 11beta)
A WCF Service is hosted in IIS Express on its own port or IIS 7.5 (.Net Framework 4.0)
Second Web Application with only Html5/jQuery is hosted in IIS Express on a different port.
Using Eclipse 3.7.2 with Android SDK 17 also on my local machine.
Its seem all the software are functioning properly.
Android Emulator is working, Phonegap/Cordova library is installed, etc.
I am using Android 4.0.3 with Cordova 1.6.0
I am asking assistance to find out why my phonegap emulator ajax call won’t go through to my WCF REST Service. I don’t have a actual android device now to test the program on at this moment therefore I must use the Emulator.
Some more detail:
I have a WCF REST Service developed in .Net receiving & sending in JSON and JSON-P.
I have tested this with a second web application on a different port to make sure cross domain calls are allowed.
I have also used the RESTclient plugin for Firefox and can use it to make JSON and JSON-P calls successfully. [ http://restclient.net/ ]
So I am sure the WCF Service is working as it should. There shouldn't be any cross domain issue.
When I take the Html file with jQuery that I know is working within Visual Studio, to eclipse, copy into phonegap app, I try to make a basic call to my WCF server and I am unable to connect to the server.
I have changed the URL from [http://localhost:50425/LoginService.svc/GetData] to [http://10.0.2.2:50425/LoginService.svc/GetData]
according to android documentation : [http://developer.android.com/guide/developing/devices/emulator.html#networkaddresses]
I have created an allow all whitelist with the following setting:
[ access origin="*" ]
within the cordova.xml file. See: [http://professionalaspnet.com/archive/2012/05/15/Whitelisting-Domains-in-Cordova-_2800_PhoneGap_2900_-Android.aspx]
The correct permissions have been set inside the AndroidManifest.xml file according to [http://docs.phonegap.com/en/1.8.1/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android]
When I initiate the call, I use $.ajaxSetup error function to trap network error etc. and display with alert the error message. Used console.log() to make sure it passes this function without a error.
When the call actually happens, I receive a "Bad Request - Invalid Host Name. HTTP 400. The request hostname is invalid."
If the call would have been successful, I use breakpoints inside Visual Studio to know for certain the call has been made and see the request coming through.
Is there any other ways to test from emulator if I can access the "external" host? In this case to make sure emulator actually can find the service?
Is there any tools or other configuration settings that needs to be done?
I have even deleted my emulator and created a new one but it still fails to connect to the WCF Service.
I would really like this to work, would like to build a complete phonegap application but can’t continue if I can't make a call to a web service.
Any advise would be greatly appreciated.
PhoneGap is really just a wrapper for html/css/js webpages with a js library for accessing phone specific functionality, which can be compiled to multiple native mobile platform apps.
So this is really not a PhoneGap issue...
You say you are using JQuery to query your web service, if you can open the html file which fires of the request in your normal browser window, and everything works fine. The problem is not with the code, but with the Emulator you are using, maybe some miss configurations idk.
Okay if that still fails, you are most likely pointing to the wrong/no IIS Instance.
If you have two IIS Instances running on port 80 idk how that will behave, but i don't think that will work very well, my guess is that one of them will override the other one.
So if you are hosing your webservice on IIS 1, but IIS 2 overrides IIS 1, then you will never reach the webservice, and get the error you get.
So when you changed to point to the other IIS Instance, it started working again.

Categories

Resources