App Open Ad is showing app content in place of advertisement - android

My app was getting too high CTR for AppOpenAd which was around 35%-40%. So after looking for the issue I found that the AppOpen Ad is displaying the AppContent background in place of the advertisement.
Below are the screenshots to demonstrate the exact issue.
So, in normal implementation as per the Google Admob Documentation.
Below is the picture of what is exactly happening at many times. There is a comparison between the perfect display and problem happening display.
Image showing comparison of AppOpenAd Issue
So, to work around I tried setting the background to the AdActivity with the following style and theme in Manifest file.
<style name="Theme.AppThemeNoActionBar.AdTheme" >
<item name="android:background">#color/black</item>
<item name="android:windowBackground">#color/black</item>
<item name="android:windowExitAnimation">#null</item>
<item name="android:windowEnterAnimation">#null</item>
</style>
And setting it into manifest file
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:theme="#style/Theme.AppThemeNoActionBar.AdTheme"
tools:replace="android:theme"/>
But still the issue remained same. Here the comparison picture.
Image showing comparison of AppOpenAd Issue after setting theme

Related

Unwanted Blank screen showing on app start up android jetpack compose - android studio chipmunk.-How to remove it?

I just created an empty project and run it on device. On the app start up it shows a default blank screen on start up(app launch) before the first activity. I went through many answers and didn't find an exact answer or the root cause from where it is showing up. Many answers told to add
<item name="android:windowDisablePreview">true</item>
in themes.xml. Even after adding I still see the blank screen appearing.
Also in some other answer they told about new splash screen api, but I didn't feel it much customizable for doing server calls and other operations in splash screens. Also its available in below 12 versions.
What is right solution to handle this unwanted glitches during app startup?
Your help is highly appreciated.
<resources>
<style name="Theme.Owl" parent="#style/Theme.Material.DayNight.NoActionBar">
<item name="android:colorPrimary">#ff00ff</item>
<item name="android:colorAccent">#ff00ff</item>
<item name="android:statusBarColor">#color/immersive_sys_ui</item>
<item name="android:navigationBarColor">#color/nav_bar</item>
<item name="android:windowDisablePreview">true</item>
</style>
<style name="Theme.Material.DayNight.NoActionBar" parent="#android:style/Theme.Material.Light.NoActionBar" />
</resources>

How do I change the Grey top banner in Android / React Native?

Please notice that there is a mid-GREY banner above the app. How can I
Remove this (the app should ideally begin right below 9:56)
Change the background color (less ideal)
TLDR;
It's a display bug on the Pixel 4 emulator. Real Pixel 4 doesn't have that gap.
Edit
My answer below was not spot on. I tried on an emulated Pixel 4, API 29 (with Android Studio 4.2, macOS Big Sur) with rounded corners, as yours, and it rather seems to be an issue with the curve of the phone than an empty ActionBar.
My app on a pixel 4:
Even Youtube has this space:
Edit 2
Compared with a real Pixel 4
We clearly see that this gigantic gap is only on the emulator.
That's a bug on the emulator, and probably the main reason why no one talks about it around the web (googling Pixel 4 status bar height shows angry Pixel 5 owners results about its huge height).
Didn't found any bug report about it, I'll file one.
Old answer
What you see is probably an empty ActionBar, that has the same color of your StatusBar.
If you use the default theme, your app will use it :
Beginning with Android 3.0 (API level 11), all activities that use the default theme have an ActionBar as an app bar.
It displays your Application's name, defined in your MainApplication's android:label on your AndroidManifest.xml (or MainActivity's if not found). As it's empty, there's just an empty space displayed.
As you manage your own navbar, you can disable with the base theme of your choice Theme.AppCompat.*.NoActionBar, on values/styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- You can set the color of your status bar here, or with RN - see further on the answer -->
<item name="android:statusBarColor">#color/dark</item>
</style>
Don't forget to apply this theme to your MainApplication, in your AndroidManifest.xml:
<application
android:name=".MainApplication"
android:theme="#style/AppTheme"
...
To illustrate better, here's what it looks like:
With the NoActionBar (code above)
With parent="Theme.AppCompat.Light" and <item name="android:statusBarColor">#color/dark</item>
With parent="Theme.AppCompat", and an empty app name.
For the second part of your question, you can either change the color of your status bar here (see the docs for this), or within React Native.
go to
android/app/src/main/res/values/styles.xmlandroid/app/src/main/res/values/styles.xml
and add this code. it will remove
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">
#000000
</item>
</style>
</resources>

Black screen on starting app

I have noticed that on android versions 6.0+,when someone starting app after login screen and submiting info,black screen appear and you have to wait 3-15 sec depending on devices.
I heard that it could be for heavy loadings,but this app is nothing special it just load listview with few images after login (i had 3 images while tested) so im not sure is it really that heavy plus it only happen on newer versions of android so im not sure what to do.
I can provide whole code or some snippet.
EDIT: I tried with various image sizes (full loaded with big images,and only 1 small image) and it have no effect at all.
Anyone???
Inside your manifest file .
In your Activity tag add this theme.
android:theme="#android:style/Theme.Translucent"
And then you need to extend your respective activity from Activity class.
It will work for sure
For those who face this error in future
<style name="FullscreenTheme" parent="MainTheme">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>

Unity android "freezes" with splash image

I have added a custom theme with background image to serve as "splash" image to make the app look nicer while unity player is loading.
That's the theme definition I have
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Test" parent="#android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="android:windowBackground">#drawable/launchimage</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
Now, when I refer to this theme in AndroidManifest.xml like:
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="#style/Theme.Test" ... ></activity>
the game just "freezes" – it's hard to tell in fact, because it just displays the splash image and ... that's it. Logcat doesn't show any warnings/errors either.
Removing the theme OR changing android:windowBackground property to a solid color make the game work, but window background appears black until the game is launched.
What is the correct way to set activity background to make Unity happy?
When your image is too large this issue happen. change your image with smaller and set centerCrop attribute may fixed this issue. (usually this show skip frame in your log)
Also if you use Android studio 2.0 there is newly issue with that you can find it here.

Activity should be transparent, but has black background

My use case is writing an overlay controller activity for a landscape camera preview. I followed the instructions from a couple of tutorials for writing a transparent theme.
So my res/values/style.xml looks like this:
<resources>
<style name="Theme" parent="android:Theme" />
<style name="Theme.Transparent">
<item name="android:windowBackground">#drawable/transparent_background</item>
</style>
<drawable name="transparent_background">#00000000</drawable>
</resources>
The activity snippet:
<activity android:name=".CameraPreview"
android:label="Camera"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Controlls"
android:label="Controlls"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Translucent">
</activity>
When I start this activity from my root activity, the layout gets drawn correctly, but the background stays black. I tried to use #android:style/Theme.Translucent instead, but this Theme inherits the orientation from the calling activity (landscape) and thats not what I want.
Edit:
The application holding the camera preview is set to landscape view as it does not display the preview correctly in portrait orientation. (see old google bug report)
What I wanted to do was to put an independent activity for user interaction interface in front of the camera surface holder (this activity should be set to 'portrait', or even better to 'sensor')
Here's a somewhat related answer for anyone else that has a similar problem.
tl;dr
Adding a new style where the name is a suffix of an existing style can cause problems (like making transparent activities have a black screen).
Problem:
Our transparent activity background was black after doing a large refactor. (The activity was already using a transparent theme.)
After several hours of going through commits I found what seemed to be the cause of the problem. In our app we use styles like CSS. There was an existing style like this that we applied to a TextView.
<style name="HeadLine.SM.White.MyFontBold">
<item name="android:fontFamily">#font/some_bold_font</item>
</style>
The non-bold variant of the style was added as a style before the bold variant as below.
//This style was added
<style name="HeadLine.SM.White.MyFont">
<item name="android:fontFamily">#font/some_font</item>
</style>
<style name="HeadLine.SM.White.MyFontBold">
<item name="android:fontFamily">#font/some_bold_font</item>
</style>
For some reason, after the non-bold style variant was added all transparent activities had a black screen. When we changed the non-bold variant style name to something else it fixed the problem for us.
Now our styles look like this (I know there are better ways to handle font styles - these styles are a few years old).
<style name="HeadLine.SM.White.MyFontRegular">
<item name="android:fontFamily">#font/some_font</item>
</style>
<style name="HeadLine.SM.White.MyFontBold">
<item name="android:fontFamily">#font/some_bold_font</item>
</style>
Conclusion
It seemed that adding a new style where the name is a suffix of an existing style caused problems. If you're adding a new style make sure the name is not a suffix of an existing style.
We did try cleaning the build, rebuilding, and invalidating Android Studio caches. None of these things solved our problem.
Try the built-in #android:style/Theme.Translucent instead of your custom one, according to this blog post. I haven't tried to do this myself, so I don't know if the technique written about there works or not.
I found out, that another important child element for the style description above is <item name="android:windowIsTranslucent">true</item> was lacking.
Problem:
That child element also causes synchronizing the activity's orientation with the calling one. (same effect as #android:style/Theme.Translucent)
I bumped into the same problem as you describe (regarding translucent background and screen orientation), but in the end I reconciled with the fact that this is just how it works. In fact it actually makes sense that it works this way. I can't think of any screen based system that supports mixing portrait and landscape views, so why should Android?
I guess the general rule is that all visible activities must have the same orientation, regardless of the attributes in the manifest-file. If all are set to "sensor" then they will all change, if one is fixed to portrait or landscape, then the others must follow (and whoever sets it last "wins").
I guess this was just so obvious to the developers that it didn't occur to them to document it :)
Remove and all its done
#Override
public void onAttachedToWindow() {}
Style name is having some effect on the transparent background to be black. I used below one and works fine.
<style name="Theme.AppCompat.Translucent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">#android:style/Animation</item>
</style>
<!-- AndroidManifest.xml -->
<activity android:name=".TranslucentThemeActivity"
android:theme="#style/Theme.AppCompat.Translucent"/>

Categories

Resources