Problem with Flutter accessing REST API on device - api

My Flutter application accesses a REST API on my web site. When I run with the local emulator it works 100%, but when I use it with the device (Samsung A80 cell phone using Android) or install the apk on the phone, access to the database does not work.
Is there a configuration missing?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mysongs_v2">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
</manifest>
The error does not appear to be the access to the database, but it only happens when I use the cell phone.
This is when I run using the emulator.

Related

Unable to connect with server while running react native app on real android device

I am trying to run my react native app on my real android device as the laptop gets too hot while using Android studio (8 Gb RAM, the pain). Hence, I enabled my USB debugging, plugged the cable and ran the command "react-native run-android". The app started with no issue. I started the backend server also which are up and running on localhost:3000 and localhost:3001. The app runs and greets with a login and sign up page. I tried to sign up but there is an error saying
Error [TypeError: Network request failed]
I am connecting via WIFI on the same network and hoping the server and the app can communicate but the app doesn't.
There is not any issue with the code itself as I ran it multiple times in android studio previously and the app ran well. I was able to sign up as a new user and login with the same id. I am not able to do the same in the real device.
My questions:
I read the official document and it said to open in-app developer menu and put the machine ip address and localhost server. Is this localhost server the one that the Metor JS runs on or the backend server of the app itself?
What am I missing here, any commands or any configuration?
Why is my app not able to communicate with the server?
Reason behind the network error.
You should follow these steps to connect with the bundler.
Make sure that the app and bundler using the same network.
If you are using android add this code in your androidMenifest.xml file.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:usesCleartextTraffic="true" // make sure that this line is added.
.......>
.......
</application>
if you are adding localhost in the developer setting try to add your IP address like this, yourIP:yourPort
example: 192.168.89.24:8081

Having trouble using my laptop as a proxy for my smartphone

I want to capture my smartphone network logs on jmeter. This usually requires that my smartphone accesses the internet through my laptop by using it as a proxy and making jmeter listen on the port through which the smart phone is connected. Here are a few references I found on the internet:
http://findnerd.com/list/view/-How-to-Connect-the-Android-Mobile-Device-to-JMETER/4929/
https://dzone.com/articles/how-to-record-mobile-appli-cation-traffic
There are others references but they essentially say the exact same thing. I followed all the steps but my smartphone is unable to access the Internet when I set its proxy to my laptop's IP address . The only difference could be that since the motherboard wifi adaptor had started malfunctioning sometime back, I am using a USB WiFi adaptor on my laptop. I need to know how to make this work and capture my smartphone network logs on my laptop using jmeter. Any help appreciated
UPDATE - Found the issue. I needed to install an SSL certificate on my Android phone. This certificate is generated by jmeter in it's bin folder. I had to send to to my Android device and install it. Now, I can access the internet on my phone through my browser and o am able to see the https traffic being recorded in JMETER. but, when I try to access any apps, it gives me the following error:
javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown.
I know it has something to do with the self-signed certificate generated by Jmeter, but I am not sure why it's working for chrome and not for apps. Anybody know any solutions to this?
First of all you need to install JMeter's MITM certificate onto your Android phone, the file is called ApacheJMeterTemporaryRootCA.crt and it's being generated in "bin" folder of your JMeter installation when you start the HTTP(S) Test Script Recorder
If your phone is running Android 7 or higher you will need to take some extra steps in order to be able to capture your application traffic
Add the next line to the application section of your application manifest file:
android:networkSecurityConfig="#xml/network_security_config"
Create network_security_config.xml file under your application resources folder and put the following code inside:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
Compile and install your application in debug mode like:
gradlew installDebug
That's it, now you should be able to capture your application traffic using JMeter.
More information: Recording Using Android Devices

setMicrophoneMute and setSpeakerPhoneOn not working in android audio call only (react-native)

I have integrated voip call in react-native using react-native-webtrtc and in-call-manager (https://github.com/react-native-webrtc/react-native-incall-manager) for call management.Everything working fine with call. In-call-manager works fine for playing ringtone/busytone but also want user to have options to mute mic or turn on/off speaker phone while on call.
I have tried InCallManager.setSpeakerphoneOn(true/false) InCallManager.setMicrophoneMute(true/false) but no change occurred. Also I have opened issue on git but no response so hoping to get answer here
I expect if both function works fine then User is able to mute/unmute mic or turn on/off speakerphone.
I have dealt with this issue before you just have to add
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
in the manifest file of your project.
Both InCallManager.setMicrophoneMute() and InCallManager.setSpeakerphoneOn() will work.
You are right though. This is not clearly mentioned on their Github page.

How to access microphone in worklight 6.0.0.2?

I am currently developing a mobile app that converts voice to text using pocketsphinx imported in worklight. Its working fine in mozilla alone but the microphone is not getting recognised in any of the other browsers or in the worklight. So how to get away with this??
Google's documentation for capturing audio states that you must add the following permissions in AndroidManifest.xml. You do not state whether you've done so or not, nor do you provide any errors you see in LogCat, nor anything else to work with.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Verify you've added the above permissions.
Edit the questions with error logs.
Provide demo Worklight project exhibiting your problem.

image resizing in azure not working when deployed locally

<resizer>
<plugins>
<add name="MvcRoutingShim" />
<add name="AzureReader2" connectionString="UseDevelopmentStorage=true" endpoint="http://127.0.0.1:10000/devstoreaccount1/" />
</plugins>
</resizer>
I am trying to implement image resizing in my Mvc4 application using "AzureReader2". I had installed all the nuget packages and modified webconfig file as above. It works fine when i tried to deploy on server. But locally it fails, it's says "The remote server returned an error: (400) Bad Request.".
Do any one faced the same issue, if so let me know the work around please.
The local storage emulator for Azure hasn't been updated. Microsoft is working on fixing this. This isn't related to ImageResizer.
http://blogs.msdn.com/b/windowsazurestorage/archive/2013/11/27/windows-azure-storage-release-introducing-cors-json-minute-metrics-and-more.aspx
"As mentioned above an updated Windows Azure Storage Emulator is expected to ship with full support of these new features in the next couple of months. Users attempting to develop against the current version of the Storage emulator will receive Bad Request errors as the protocol version (2013-08-15) is unsupported. Until then, users wanting to use the new features would need to develop and test against a Windows Azure Storage Account to leverage the 2013-08-15 REST version."