Flutter webrtc not working properly in release mode - flutter

I am using WebRTC for video conference within my flutter app.
The app works as expected in debug mode. I am able to establish the connection and the video from both ends is visible without any issues.
However, when I build an apk and test it on real devices, video conferencing fails. Video from both devices is not showing up on the screen. It is only a white screen with no videos where there should be 2 videos.
Here's the code I am referring to: https://github.com/md-weber/webrtc_tutorial
Thanks.

What I have learnt is WebRTC is not really a production ready solution. One still needs to setup STUN/TURN server as discussed here - https://github.com/flutter-webrtc/flutter-webrtc-server/issues/30
If one is excited to explore in future, they can refer to -
https://meetrix.io/blog/webrtc/coturn/installation.html
https://medium.com/av-transcode/what-is-webrtc-and-how-to-setup-stun-turn-server-for-webrtc-communication-63314728b9d0
I do not have the time or energy to spend on this now, but will surely be back when we have a bigger team. For now I am going to use on of the readymade solutions in the market.

When you compile the release apk, you need to add the following operations,
1-Edit /android/app/build.gradle
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
2-And create new file /android/app/proguard-rules.pro
## Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-dontwarn io.flutter.embedding.**
## Flutter WebRTC
-keep class com.cloudwebrtc.webrtc.** { *; }
-keep class org.webrtc.** { *; }
refer to [https://flutter-webrtc.org/docs/flutter-webrtc/get-stared#important-reminder][1]

Related

Unity3D firebase AUTH not working on ANDROID fierbase doesnt connect or something

in editor work fine. i am trying to add my project fierbase and in work. but when i start test at android login window dont react. i am trying to do this
Unity3D firebase AUTH not working on ANDROID
public class FirebaseINIT : MonoBehaviour
{
public static bool firebaseReady;
void Start()
{
CheckIfReady();
}
void Update()
{
if(firebaseReady == true)
{
SceneManager.LoadScene("LoginScene");
}
}
public static void CheckIfReady()
{
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
Firebase.DependencyStatus dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
firebaseReady = true;
Debug.Log("Firebase is ready for use.");
}
else
{
firebaseReady = false;
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
}
});
}
}
but not loaded next scene. and i am confused why this happen, i cant do next because dont understand problem. May this will be from android resolve? Because in order to build the project, I must remove the Resolved libraries.
otherwise if I don't remove assets=> Android=> resolve libraries then I will get the following errors
Configure project :launcher
WARNING: The option setting 'android.enableR8=false' is deprecated.
Execution failed for task ':launcher:processReleaseResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
the project has an additional plugin for advertising appodeal + admob at least the direction of movement of the study of the issue
and i am integrate this first time i am not sure i am at the right way

flutter_blue is not working in release apk (Flutter)

While debugging the app Bluetooth is scanning and identifying near by devices. In release mode, it's not working.
Add the following code in [Project-Name]/android/app/build.gradle
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources false // this line
minifyEnabled false // this line
}
}

Ionic 4 AdMob-Plus Ads

Has anyone got AdMob-Plus to work successfully with Ionic 4? Using the code below nothing shows up and the promise terminates with error without a message.
import { AdMob } from '#ionic-native/admob-plus/ngx';
constructor(
adMob: AdMob,
platform: Platform){
this.platform.ready()
this.adMob.setDevMode(true);
this.adMob.banner.show({
id: {
android: 'test',
ios: 'test',
}
})
}
I originally went with AdMob Free but didn't want to manually import the iOS SDK for AdMob. The current SDK version throws error ITMS-90809 when submitting to iOS app store.
***EDIT***
The comment below by Naga is the solution
some of native plugins will work just on android and ios and this is one of them.
this plugin will not work on pc even with build it on the browser.
so you have to test it on a native device or an emulator.
I just came across this issue today. The workaround is to just use the Cordova plugin as recommended here
Have you tried with cordova-admob plugin?
It has really great docs at https://ionic-admob.com
ionic plugin add cordova-admob
npm i #ionic-native/admob
You can use it like this:
import { Component, OnInit } from '#angular/core';
import { Platform } from 'ionic-angular';
import { Admob } from '#ionic-native/admob/ngx';
#Component({
selector: 'app-home',
templateUrl: 'home.page.html',
})
export class HomePage implements OnInit {
constructor(private admob: Admob, private platform: Platform) { }
async ngOnInit() {
await this.platform.ready();
await this.admob.createBannerView({
bannerAdId: 'ca-app-pub-xxxx/xxxx',
});
}
}

Flutter Square Plugin crashes in release only

Flutter Square plugin crashes only in release when I use invalid card or press back.
But when I use flutter run --release & hook up my mobile. the crashes don't occur & the app works perfectly!
here's the code we used
void _pay() async {
await InAppPayments.setSquareApplicationId(sqAppId);
try {
await InAppPayments.startCardEntryFlowWithBuyerVerification(
money: Money((money) => money
..amount = 0
..currencyCode = 'USD'),
collectPostalCode: true,
contact: Contact((ContactBuilder contact) {
return contact.givenName = username;
}),
buyerAction: "Store",
squareLocationId: sqLocationId,
onBuyerVerificationSuccess: (BuyerVerificationDetails result) {
addCard(result.nonce, result.card.postalCode);
},
onBuyerVerificationFailure: (err) {
return showErrorDialog(context, err.toString());
},
onCardEntryCancel: () {});
} on Exception catch (e) {
print(e);
}
}
What is the difference between flutter build & flutter run --release ?
Could I use the APK out from flutter run & upload it to google play ?
In the release version you have to add the PERMISSIONS explicitly.
Try adding android.permission.INTERNET to the Manifest file.
Add
<uses-permission android:name="android.permission.INTERNET"/>
to the AndroidManifest.xml located in android/app/src/main.
For your question about uploading a debuggable apk, Google Play-Upload will reject your file.
Refer to this link for the differences between release and debug.

Vungle with Admob mediation in Unity

i have integrated Admob 3.11.1 in Unity 2017.2.0 project. I wanted to add Vungle 5.3.2 as another network in the mediation.
I have configured Vungle's console with an custom interstitial placement and rewarded custom placement.
Succesfully added the Vungle's placement references into Admob console (as a new ad source).
Configured eCPM of Vungle to $100 so it get first in priority.
Imported Admob 3.11.1 Unity plugin.
Imported vungle .jars from Android export and placed them in Plugins/Android folder. Also tried placing them in Plugins/Android/GoogleMobileAdsPlugin/libs.
Added Vungle manifest activities.
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<activity
android:label="#string/app_name"
android:screenOrientation="fullSensor"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:name="com.vungle.publisher.VideoFullScreenAdActivity">
</activity>
<activity android:name="com.vungle.publisher.MraidFullScreenAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity android:name="com.vungle.publisher.FlexViewAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18"/>
<uses-permissio
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
Load rewarded ad from script like this:
RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance;
// Create an empty ad request.
AdRequest.Builder builder = new AdRequest.Builder();
// Add simulator test as default
builder.AddTestDevice(AdRequest.TestDeviceSimulator);
rewardBasedVideo.LoadAd(builder.Build(), "admob-rewarded-placement");
I'm using proguard.. so i added the rules for Vungle:
# Vungle
-dontwarn com.vungle.**
-dontnote com.vungle.**
-keep class com.vungle.** { *; }
-keep class javax.inject.*
-dontwarn de.greenrobot.event.util.**
-dontwarn rx.internal.util.unsafe.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-keep class rx.schedulers.Schedulers { public static <methods>; }
-keep class rx.schedulers.ImmediateScheduler { public <methods>; }
-keep class rx.schedulers.TestScheduler { public <methods>; }
-keep class rx.schedulers.Schedulers { public static ** test(); }
-dontwarn com.moat.**
-keep class com.moat.** { public protected private *; }
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
Added Admob's Vungle adapter .aar in Plugins/Android folder.
When i want to show a rewarded ad, i allways get Admob ads or Unity ads (another network its being mediated). But i never get Vungle ads.
What could i be missing?
I finally solved it. I was missing passing Vungle placement references when loading Admob ad.
RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance;
GoogleMobileAds.Api.Mediation.Vungle.VungleRewardedVideoMediationExtras vungle = new GoogleMobileAds.Api.Mediation.Vungle.VungleRewardedVideoMediationExtras();
vungle.SetAllPlacements(new string[] { "REWARDED-78375", "INTERSTITIAL_INGAME-243547", "DEFAULT8623" });
// Create an empty ad request.
AdRequest.Builder builder = new AdRequest.Builder()
.AddMediationExtras(vungle);
// Add simulator test as default
builder.AddTestDevice(AdRequest.TestDeviceSimulator);
rewardBasedVideo.LoadAd(builder.Build(), m_rewardedVideoId);
I was also missing Vungle extras package. You can get it on Vungle tutorial about integration with Admob Tutorial