Android show error when server shifted from http to https - android

My live android app stop working when server shifted from http to https.
Tried adding .htaccess for redirecting but still same problem.
i can't change my baseurl at android, but need help to modify at php code.

because android does not understand your serverside configuration so you have to put it manually in an android constant file make for the store base URL and all basic string data so you have not to change everywhere....and save lots of time...also please show your android code ...so anyone can understand where you want to change

Yes... i got the solutions..
you can change http to https without changed android code base url ( which was live with http ) by not forcing to https at cpanel > domains > Force HTTPS Redirect > off
thanks

Related

android - how to hide url request

recently some one told me that he retrieves all the url requests from my android application and he sent them to me .
I'm using proguard in my application but he told me there are some ways that he can monitor the url requests .
I'm using URLConnection in my application .
how can I hide the url requests and somehow encrypt the urls so no one can read and access my url requestes ?
You can't. It's quite easy to use a proxy to catch all network traffic and check what you are using. If the problem is related with the content, then you can switch from http to https, but the host will be always visible. Actually as user I would be really scared about an app that want to hide such information however.
USE https instead of http, it is secured.
Try with HTTPS and add SSL(TSL) pinning to the network call.

Http failure response for (unknown url): 0 Unknown Error on android

I have an ionic app that when I run that on iOS then it works perfectly fine but when I run that on Android I get this error
Http failure response for (unknown url): 0 Unknown Error
Any reason I am getting this one? I have allowed CORS on server side as it is working on iOS devices.
Any help?
EDIT
This is what I have in my app.js file
const cors = require('cors');
And then I simply use it with default options.
app.use(cors());
If you are using localhost, change it to the IP address of the localhost. Android doesn't seems to support it where iOS do.
Try actual host name in case it didn't work too.
First you dont need CORS to call API from your android device.
Second probably your server is not accepting your request. If you are using Cloud then your server must accept request from any IP. There must be a option for allow IP address, place there from 0.0.0.1 to 254.254.254.254 so that each and every user can call your API.
Third you need to allow origin from your config.xml and also in header for CROS request. Check your API header and config file.
And fourth If your service is running under http then it will also could be the problem. Secure your service by adding SSL certificate. This could fix your problem.
We had experienced the same Error several times in our App. In our case it was a problem with the headers of the request and also a CORS problem on the serverside.
Are you able to reproduce this error in the browser if you emulate a android device? Then you could compare them with the headers of the iOS request.
Or you can try to log the incoming requests on the server-side to see if the requests reach the server and what headers are set.
Hope my ideas help :)
The solution is to add NODE_TLS_REJECT_UNAUTHORIZED=0 to your environment to disable the SSL verification in Node.js.
Note : You should only set this in development, Don't do this in production
EDIT
In that case it indicates that CORS has not been properly setup on your server. Go through the issue here

Android: Access http server instead of https in vector (Android Matrix client)

I'm using vector (It's a Android Matrix client Download link:
https://github.com/vector-im/vector-android). This Vector is using
the https server (https://vector.im and https://matrix.org as home
and identity url's) but i want to connect my local matrix server
using http not https.
For this i edited the strings.xml (id's are vector_im_server_url,
matrix_org_server_url, default_hs_server_url,
default_identity_server_url) file with my local http server.
In this case i'm getting the toast message as "Unable to login :
failed to connect to XXXXXX.XXXXXX.com/XXX.XXX.XXX.XXX (port 8008)
after 15000ms". can anyone help where to change this setting
Note:
Initially i'm not able to access the local matrix server url in my system browser for this i added server details in C:\Windows\System32\drivers\etc\hosts after that i'm able to access it in my browser
I think you missed my answer on #matrix:matrix.org. I tried to connect to your homeserver on port 8448 and 8008 from the public internet and the server was not responding. It looks like you need to open up your firewall on those ports. Please try asking again in #matrix:matrix.org (bearing in mind that the core matrix team are awake on european timezones).
Edit: As per https://vector.im/develop/#/room/#matrix:matrix.org/$147222237811409Apqfi:matrix.org, the server really was inaccessible when we tried to give you support earlier. Glad you've got it sorted now; you should also be using the same HS url for both 'vector' and 'matrix' HS URL otherwise it will try to fall back to using matrix.org for unrecognised users. Thanks for the downvote...
M
By using https server only we can use vector services. So, i changed strings.xml as like this
<string name="vector_im_server_url">https://matrix.org</string>
<string name="matrix_org_server_url">my_local_https_server_url</string>
<string name="default_hs_server_url">my_local_https_server_url</string>
<string name="default_identity_server_url">https://matrix.org</string>
to know these url's open your local https server url in browser. It will show Home Server and Identity Server as shown in the image and paste Identity Server url in vector_im_server_url and default_identity_server_url then Home Server url in matrix_org_server_url and default_hs_server_url

Android does not recognize response header setted by Node.js

I have API server which is built on top of Node.js.
I've set response header for download data like below.
res.setHeader('Content-Length', fileSize);
res.setHeader('Content-Type', 'application/octet-stream');
res.setHeader('Content-Disposition', 'attachment;filename="' + fileName + '"');
It works fine in any computer O/S and web browsers.
However, when I try to download data using android phone, any web browsers (eg., dolphine, chrome, FF) DOES NOT recognize response header (ie., filename, content-length)
Any one can help me to solve this problem?
Thanks in advance.
Finally, I found the reason why the http header does NOT work on android.
It's very sorry that I did not mention critical stuff.
Actually, I tried to download using https not http and since I'm using test server which has no valid SSL certification.
I could ignore SSL certification in web browsers in PC but Android.
It was the reason why Android web browser cannot read header.
I've changed the way to download from https to http, it works perfectly.
Thanks for all concerns and responses.
Thank you.

Ajax requests on native android apps

I have packaged a Sencha Touch 2 app with PhoneGap for Android. I can't get the ajax requests to work on my native application. When I handle the request through the browser on http://mydomain.com/mysenchaapp/android/assets/www/ it works fine, however, when I run my app through the emulator as a native app my request fails. I think it would be helpful if I could get fiddler to work on handling native apps' request as well, but I haven't been able to figure that out either. Any help is appreciated.
On a native application you can use cross-domain get requests without using JSONP. I got it to work. My problem accessing the servlet was another issue.
You can't use Ajax for Cross-Domain GET requests, you should use JSONP instead. Take a look at the documentation for Ext.data.JsonP.request(), You can however use Ajax to make a post if i'm not mistaken. This comes in handy when uploading something like a base64 string (which is too big for a GET request)

Categories

Resources