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
Related
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]
I am integrating Huawei Push Kit (https://pub.dev/packages/huawei_push) in Flutter application and everything works fine except I am unable to get the event when received push notification message is clicked to be able to act on it.
Is this possible to achieve via this plugin or do I need to write this part in native Android code?
Currently, you can achieve this with another plugin that listens for the custom intents. Uni_links package from pub.dev is easy to use. Here is a quick guide to uni_links package:
Add uni_links to your pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
huawei_push: 4.0.4+300
uni_links: 0.4.0
Define an intent filter on your AndroidManifest.xml file:
<application
<!-- . . . Other Configurations . . . -->
<activity/>
<!-- . . . Other Configurations . . . -->
<!-- Add the intent filter below.(inside the application and activity tags) -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="app"/>
</intent-filter>
</activity>
</application
Call the uni links methods in your initState() that will listen for the custom intents. The notification's custom intent I've sent from the Push Kit Console looks like this:
app:///ContentPage?name=Push Kit&url=https://developer.huawei.com/consumer/en/hms/huawei-pushkit
// Get the initial intent that opens the app
Future<void> initInitialLinks() async {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
String initialLink = await getInitialLink();
if (initialLink != null) {
var uri = Uri.dataFromString(initialLink);
String page = uri.path.split('://')[1];
String serviceName = uri.queryParameters['name'];
String serviceUrl = uri.queryParameters['url'];
try {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
Navigator.of(context).pushNamed(
page,
arguments: ContentPageArguments(serviceName, serviceUrl),
); // Navigate to the page from the intent
});
} catch (e) {
Push.showToast(e);
}
}
} on PlatformException {
print('Error: Platform Exception');
}
}
// Get intents as a stream
Future<Null> initLinkStream() async {
if (!mounted) return;
_sub = getLinksStream().listen((String link) {
var uri = Uri.dataFromString(link);
String page = uri.path.split('://')[1];
// Parse the string ...
Navigator.of(context).pushNamed(page); // Navigate to a page from the intent
}, onError: (err) {
print("Error while listening for the link stream: " + err.toString());
});
}
For more information, visit: Deep Linking on Flutter using Huawei Push Kit’s Custom Intents
The accompanying github repository of the article includes the codes.
I also looked into their flutter plugin and couldn't any method for that. I guess you will have to write platform specific code and for that you can refer to their demo native android project with PushKit.
https://github.com/HMS-Core/hms-push-clientdemo-android
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',
});
}
}
I am developing an android application. I have used webview to load my moodle site; everything is fine but the "upload" button doe not function! When for example I click on the "upload" button to upload my photo in profile of moodle, nothing happens.
I have included the following in the manifest file:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<!--
Allows Glide to monitor connectivity status and restart failed requests if users go from a disconnected to a connected network state.
-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
And the following lines have been added to the MainActivity:
<if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int hasCameraPermission =
checkSelfPermission(Manifest.permission.CAMERA);
Log.d(TAG, "has camera permission: " + hasCameraPermission);
int hasRecordPermission =
checkSelfPermission(Manifest.permission.RECORD_AUDIO);
Log.d(TAG, "has record permission: " + hasRecordPermission);
int hasAudioPermission =
checkSelfPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS);
Log.d(TAG, "has audio permission: " + hasAudioPermission);
List<String> permissions = new ArrayList<>();
if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(Manifest.permission.CAMERA);
}
if (hasRecordPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(Manifest.permission.RECORD_AUDIO);
}
if (hasAudioPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(Manifest.permission.MODIFY_AUDIO_SETTINGS);
}
if (!permissions.isEmpty()) {
requestPermissions(permissions.toArray(new
String[permissions.size()]),111);
}
}
The following were also added to the webView activity:
wvs.setWebChromeClient(new WebChromeClient() {
#TargetApi(Build.VERSION_CODES.LOLLIPOP)
#Override
public void onPermissionRequest(final PermissionRequest request) {
SiteActivity.this.runOnUiThread(new Runnable() {
#Override
public void run() {
request.grant(request.getResources());
}
});
}
#Override
public void onPermissionRequestCanceled(PermissionRequest
request) {
// The following line was underlined red so I commented it out!
//Log.d(TAG, "onPermissionRequestCanceled");
}
});
After adding the above lines, when I run the app, I am asked to give permission but then a white page opens in webview and nothing happens!
Also, recording audio and video does not function inside the moodle site running in a webview! This may also help to find out the issue!
Would you please help me to eliminate the problem.
I highly appreciate your help.
Faramarz
Is there a way to create a file with specific extension. Currently im creating a html kind file. Is there a way to give specific extension to the file while creating? Maybe .css or .js etc?
<extension
point="org.eclipse.ui.newWizards">
<category id="com.ui.category" name="XXX Project">
</category>
<wizard
category="com.ui.category"
id="ui.wizard.NewFileWizard"
name="Create a new File"
icon="icons/new_project.png"
class="org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard"
project="true"
>
</wizard>
</extension>
You will have to create your own wizard to do this, extending BasicNewFileResourceWizard
The minimum code would be something like this:
public class FileExtNewFileWizard extends BasicNewFileResourceWizard
{
public FileExtNewFileWizard()
{
super();
}
#Override
public void addPages()
{
super.addPages();
// Get the page created by `super.addPages` and set the default file extension
WizardNewFileCreationPage page = (WizardNewFileCreationPage)getPage("newFilePage1");
page.setFileExtension("css");
}
}