Splash Screen not rendering

KenNickersonKenNickerson USMember ✭✭✭
edited August 19 in Xamarin.Android

Manifest entries relating to splash screen:

    <activity android:label="OpenAppAndroid" android:name="md55708a975dafaf85755de3b76db4e804a.OpenAppAndroid" />
    <activity android:configChanges="orientation|screenSize" android:name="md55708a975dafaf85755de3b76db4e804a.MainActivity">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:noHistory="true" android:theme="@style/Theme.Splash" android:name="md55708a975dafaf85755de3b76db4e804a.SplashScreen" />

What's in SplashScreen.cs:

 [Activity(MainLauncher = true, Theme = "@style/Theme.Splash", NoHistory = true)]

What's in styles.xml

  <style name="Theme.Splash" parent="android:Theme">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@drawable/splashscreen</item>

What's in drawable/splashscreen:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <color android:color="#585858"/>
  </item>
  <item>
    <bitmap
        android:src="@drawable/launchimage"
        android:tileMode="disabled"
        android:gravity="center"/>
  </item>
</layer-list>

Can anyone identify why the splash screen inst rendering. If you need more information, please reply.

thanks

Answers

  • mirkarammirkaram Member ✭✭

    Set property MainLauncher=true for your splash activity

  • KenNickersonKenNickerson USMember ✭✭✭

    @mirkaram Thank you for the response. I believe I have the following in the splash screen renderer:

    [Activity(MainLauncher = true, Theme = "@style/Theme.Splash", NoHistory = true)]. Were you referring to somewhere in the manifest?

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    @KenNickerson Do you want to achieve the splash result like following GIF?

    In you code, If you have annotation in your code by [Activity(MainLauncher = true, Theme = "@style/Theme.Splash", NoHistory = true)], you did not need to declare in Manifest. Here is my demo, you can refer to it.

  • KenNickersonKenNickerson USMember ✭✭✭

    @LeonLu Thanks for the example, however, when I remove all but the application tag in the manifest, I get 2 laucnh icons on the device. One is the actual app name without the icon, the other is called splashscreen with the app icon. I also still have the drawable folders and referencing them in the manifest and launchscreen.xml. I appreciate your help

  • KenNickersonKenNickerson USMember ✭✭✭

    This is the application tag. When I remove the activity for the splash screen I get weird results like 2 installs, missing icons, but the splash screen works,

            <activity android:name="com.myco.myapp">
            <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http" />
            <data android:scheme="https" />
            <data android:host="www.myco/mobile" />
         </intent-filter>
        </activity>
        <activity android:label="OpenAppAndroid" android:name="md55708a975dafaf85755de3b76db4e804a.OpenAppAndroid" />
       <activity android:configChanges="orientation|screenSize" android:name="md55708a975dafaf85755de3b76db4e804a.MainActivity">
          <intent-filter>
             <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" /> 
            </intent-filter>
     </activity>
            <activity android:noHistory="true" android:theme="@style/Theme.Splash" android:name="md55708a975dafaf85755de3b76db4e804a.SplashScreen" />
            <receiver android:enabled="true" android:exported="false" android:label="Essentials Connectivity Broadcast Receiver" android:name="md5d630c3d3bfb5f5558520331566132d97.ConnectivityBroadcastReceiver" />
            <receiver android:enabled="true" android:exported="false" android:name="md51558244f76c53b6aeda52c8a337f2c37.PowerSaveModeBroadcastReceiver" />
            <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="1999999999" android:authorities="com.myco.myapp.mono.MonoRuntimeProvider.__mono_init__" />
    
     </application>
    
  • KenNickersonKenNickerson USMember ✭✭✭

    @LeonLu This project had no issues with the splash screen before I rebuilt the project using the latest template. I also want to note there is a custom theme on the application in the manifest which is still needed. So I am not sure how that should work with the splash screen theme. Obviously can't have the theme parameter appear twice on the application tag.
    Is it possible to integrate the splash screen theme in the android:theme on the application level? Thank you

    <application android:label="MyApp" android:icon="@drawable/icon" android:theme="@style/CustomToolbar" android:allowBackup="true" android:name="android.app.Application">
    
    
        <activity android:noHistory="true" android:theme="@style/Theme.Splash" android:name="md55708a975dafaf85755de3b76db4e804a.SplashScreen" />
    
  • KenNickersonKenNickerson USMember ✭✭✭

    I have tried multiple things. I can either get the single app without the splash screen or I get 2 icons, one that luanches without the splash screen and another icon with the app name of splash screen that does launch with the splash screen.

  • KenNickersonKenNickerson USMember ✭✭✭

    @LeonLu I am sorry for peppering this question with replies, however I wanted to give an update if you are still with me on this. I removed the tags in the manifest as you suggested. The issue is that I have another custom theme I used for inside the app. I don;t know how to reference both on the application tag. I do have the splash references in the styles. I have a single install but still no splash screen. If you can assist, it is greatly apprecaited.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    First of all, I want to confirm with your question: Splash screen cannnot render custom theme correctly?

    I uploaded my demo, Is this demo could render successfully?
    If you can running normally with my demo. This issue related to your project, Could you provide your demo?

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    @KenNickerson said:
    This is the application tag. When I remove the activity for the splash screen I get weird results like 2 installs, missing icons, but the splash screen works,























    In the above AndroidManifest.xml, you have set the MAIN LAUNCHER to your MainActivity, you splash screen is not MAIN LAUNCHER, this first activity is MainActivity when you open your application.

       <activity android:configChanges="orientation|screenSize" 
            android:name="md55708a975dafaf85755de3b76db4e804a.MainActivity">
          <intent-filter>
             <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" /> 
        </intent-filter>
     </activity>
    
  • KenNickersonKenNickerson USMember ✭✭✭

    @LeonLu That is correct. In the main activity, I have a custom theme called CustomToolBar. I need that theme as well as the splash screen. I didnt explicitly add the activity tag with the splash screen theme. I believe after I upgraded the project and built it, VS added it. In my original project I just had the customtoolbar theme referenced on the application tag and had the splash screen referenced in the splashscreen.cs. When I removed the activity tag, with the splash screen tag, I dont get a splash screen, When I included it I get 2 installs, one with the splash screen and one without.

    I noticed the new project template created the mipmap folders which I use now for the icons and launch screen image, however, I still use the drawable folders for my in-app images. I still have my splash screen xml in there.

    I will put a demo project together asap and upload it. Thank you for the ongoing support.

  • KenNickersonKenNickerson USMember ✭✭✭

    @LeonLu Attached is a mock up of my Android project. The manifest in its current state produces 2 icons on the install. The application tag references the custom ToolBar. When I remove the activity tags for the splash screen I get a single install but no splash screen. Thank you for your help. It is greatly appreciated!!!

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Actually, you create a xamarin forms projec, normally, you can create a spalsh view in the PCL folder, not in the DroidFix.Android, change the NavigationPage = new NavigationPage(new SplashPage()); in your App.xaml.cs

Sign In or Register to comment.