AppLovin unable to precache resources - android

I want to use AppLovin Native Ads in my application. I did these
AppLovinSdk.initializeSdk(getContext());
AppLovinSdk sdk = AppLovinSdk.getInstance(getContext());
AppLovinNativeAdService nativeAdService = sdk.getNativeAdService();
nativeAdService.loadNativeAds(3, new AppLovinNativeAdLoadListener() {
#Override
public void onNativeAdsLoaded(List<AppLovinNativeAd> list) {
getActivity().runOnUiThread(() -> {
presenter.onApplovinNativeAdsLoaded(list);
});
}
#Override
public void onNativeAdsFailedToLoad(int i) {
presenter.onApplovinNativeAdsFailedToLoad();
}
});
However, I get error code -200 which is UNABLE_TO_PRECACHE_RESOURCES. I added android.permission.WRITE_EXTERNAL_STORAGE permission to manifest. And I did everything the same as in the official tutorial but I still get this error. What can be the cause?

Related

Why is my native android code in Flutter showing errors?

I am testing platform specific coding with Flutter. I opened the android folder in Android Studio, wrote my code and it shows no errors. I then moved back to Flutter which is underlining in red the Rs in the code below. However, the app is working fine. I am wondering why an error is showing and what I can do to remove these red lines. I would be grateful for pointers.
Here is my code:
public class MyTileService extends TileService {
private final int STATE_ON = 1;
private final int STATE_OFF = 0;
private int toggleState = STATE_ON;
#Override
public void onTileAdded() {
System.out.println("onTileAdded");
}
#Override
public void onTileRemoved() {
System.out.println("onTileRemoved");
}
#Override
public void onStartListening() {
System.out.println("onStartListening");
}
#Override
public void onStopListening() {
System.out.println("onStopListening");
}
#Override
public void onClick() {
System.out.println("onClick state = " + Integer.toString(getQsTile().getState()));
Icon icon;
if (toggleState == STATE_ON) {
toggleState = STATE_OFF;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spa_black_24dp);
System.out.println("OFF");
} else {
toggleState = STATE_ON;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_star_border_black_24dp);
System.out.println("ON");
}
getQsTile().setIcon(icon);
getQsTile().updateTile();
}
}
I tried cleaning the android project, uninstalling and reinstalling Flutter and Dart plugins, checking flutter doctor.
Here is an image:
Flutter projects are not Gradle-based Android projects so a number of
features provided by Android Studio are not available to Flutter
programmers.
This still is a Flutter Plugin.
Is documented here:
https://github.com/flutter/flutter-intellij/issues/2262
And you can track it here:
https://github.com/flutter/flutter-intellij/issues/2243
It seems that the first item is check, so it's only a metter of time to wait this milestone to be released.

Unity Ads are displaying continuously in my Android App

I have an Android app developed in Android Studio. And I have integrated Unity Ads in my app showing full-screen video Ads.
I have followed each step carefully in their documentation:
https://unityads.unity3d.com/help/monetization/integration-guide-android
But the ads are displaying continuously one after another. There is no stopping for this video ads. I am losing users for my app because of this.
Here is my implementation according to their docs in MainActivity.class:
UnityListener unityListener = new UnityListener();
UnityAds.initialize(MainActivity.this, "my_ad_unit_id", unityListener);
private class UnityListener implements IUnityAdsListener {
#Override
public void onUnityAdsReady(String s) {
UnityAds.show(MainActivity.this);
}
#Override
public void onUnityAdsStart(String s) {
}
#Override
public void onUnityAdsFinish(String s, UnityAds.FinishState finishState) {
}
#Override
public void onUnityAdsError(UnityAds.UnityAdsError unityAdsError, String s) {
}
}

ConnectSDK Android

Working with connectSDK Android for casting videos on samsung android Tv.
I've successfully launch the default youtube app and played as well.
But when ever i'm trying to stop the currently running Youtube video getting a response code = 400 i.e
com.connectsdk.service.command.ServiceCommandError: Bad Request
Anyone worked on this? or familiar with the issue?
Code:
if (runningAppSession != null) {
if (runningAppSession.getSessionType() == LaunchSessionType.App) {
getLauncher().closeApp(runningAppSession, new ResponseListener<Object>() {
#Override
public void onError(ServiceCommandError error) {
System.out.println(error);
}
#Override
public void onSuccess(Object object) {
System.out.println(object.toString());
}
});
}
}

SocketIOClient example does not compile

I've got a Andriod Studio project and I'm trying to use the SocketIOClient from the AndroidAsync library. I'm building the library with the command:
dependencies {
compile 'com.koushikdutta.androidasync:AndroidAsync:1.0.0'
}
I was able to get the websocket example to work, but there's seems to be a version issue with the 1.0 and the SocketIOClient example. I've also tried using the 2.0 jar file, but SocketIOClient doesn't appear to be defined there at all(this is one of my first andriod applications, so maybe I'm just doing something wrong). Does anyone know what needs to be done to get the following code to compile:
SocketIOClient.connect(AsyncHttpClient.getDefaultInstance(), "http://192.168.1.2:3000", new ConnectCallback() {
#Override
public void onConnectCompleted(Exception ex, SocketIOClient client) {
if (ex != null) {
ex.printStackTrace();
return;
}
client.setStringCallback(new StringCallback() {
#Override
public void onString(String string) {
System.out.println(string);
}
});
client.on("someEvent", new EventCallback() {
#Override
public void onEvent(JSONArray argument, Acknowledge acknowledge) {
System.out.println("args: " + arguments.toString());
}
});
client.setJSONCallback(new JSONCallback() {
#Override
public void onJSON(JSONObject json) {
System.out.println("json: " + json.toString());
}
});
}
});
Thanks,
Scott

Revmob fullscreen ad preload on Unity?

Is there any way to preload fullscreen ad on Unity? Right now when we call it using
revmob.ShowFullscreen();
when we create end game screen. But most of the time it loads after 5/10 secs later which is in-game most probably if you press restart, so it shows a full screen ad during gameplay.
I've found some ways to preload it on native android and tried same function to see if they exists in Unity but no luck.
Thanks.
Yes! You can use the following code:
private RevMobFullscreen fullscreen;
fullscreen = revmob.CreateFullscreen();
fullscreen.show();
If you need more information, you can access RevMob mobile ad network website: https://www.revmobmobileadnetwork.com
It will be better to add this code to the Create statement:
private RevMobFullscreen fullscreen;
fullscreen = revmob.CreateFullscreen();
...and then also this code to the listener:
RevMobAdsListener revmobListener = new RevMobAdsListener() {
// Required
#Override
public void onRevMobSessionIsStarted() {
fullscreen.show();
}
(...)
}
This will show the fullscreen ad.
You can do like this to preload revmob videos in unity. But there are memory leaks in revmob unity videos and they might fix that in 9.2.x...
REVMOB_APP_IDS = new Dictionary<string, string>() {
{ "Android", androidMediaId},
{ "IOS", iosMediaId }
};
revmob = RevMob.Start (REVMOB_APP_IDS, gameObject.name);
public void SessionIsStarted ()
{
CacheVideoInterstitial("Bootup");
}
public void CacheVideoInterstitial(string location) {
DestroyVideo();
StartCoroutine(CacheAfterEndofFrame(location));
}
IEnumerator CacheAfterEndofFrame(string location) {
yield return null;
fullscreenVideo = revmob.CreateVideo(location);
}
void DestroyVideo() {
if( fullscreenVideo != null ) {
fullscreenVideo.Hide();
//fullscreenVideo.Release();
//fullscreenVideo = null;
}
}
// revmob ad closing delegate
public void UserClosedTheAd (string revMobAdType)
{
DestroyVideo();
CacheVideoInterstitial(this.location);
}

Categories

Resources