APK don't open and stay in splahs icon

Please provide the following:

  1. SDK Version: “expo”: “~40.0.0”,
  2. Platforms(Android/iOS/web/all): Android

Hi, when I build my apk for android and installed on my device, the app open and stay in splash icon and white background.

I test with expo start --no-dev --minify and the app works perfect, but with the APK has this error. I install Sentry but don’t report any error when open the apk

Screen when I open my app and stay in this screen forever:

I had this problem once, because I forgot to call the hide function on the Splashscreen…for some reason, it still went away in dev mode, but once the app was a standalone APK, the Splashscreen never got away.

Hi, what is the hide function? I only have AppLoading (from expo-app-loading) that shows before the fonts load.

This is my main App.js:

import React from "react";
import AppLoading from 'expo-app-loading';
import * as Font from 'expo-font';
import {Ionicons} from '@expo/vector-icons';
import AppNavigator from "./navigations";
import * as Notifications from 'expo-notifications';
import * as Permissions from 'expo-permissions';
import Constants from 'expo-constants';

Notifications.setNotificationHandler({
    handleNotification: async () => ({
        shouldShowAlert: true,
        shouldPlaySound: false,
        shouldSetBadge: false,
    }),
});

export default class App extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            isReady: false,
            token: '',
        };
    }

    async componentDidMount() {

        await this.registerForPushNotificationAsync();

        await Font.loadAsync({
            Roboto: require('native-base/Fonts/Roboto.ttf'),
            Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
            ...Ionicons.font,
        });
        this.setState({ isReady: true });
    }

    async registerForPushNotificationAsync () {
        let token;
        if (Constants.isDevice) {
            const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
            let finalStatus = existingStatus;
            if (existingStatus !== 'granted') {
                const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
                finalStatus = status;
            }
            if (finalStatus !== 'granted') {
                alert('Failed to get push token for push notification!');
                return;
            }
            token = (await Notifications.getExpoPushTokenAsync()).data;
            console.log(token);
        } else {
            alert('Must use physical device for Push Notifications');
        }

        if (Platform.OS === 'android') {
            Notifications.setNotificationChannelAsync('default', {
                name: 'default',
                importance: Notifications.AndroidImportance.MAX,
                vibrationPattern: [0, 250, 250, 250],
                lightColor: '#FF231F7C',
            });
        }

        return token;
    }

    render() {
        if (!this.state.isReady) {
            return <AppLoading />;
        }

        return (
            <AppNavigator />
        );
    }
}

I wasn’t the one who began the project, so I didn’t write this, but we use “expo-splah-screen”. In the App constructor, we use “SplashScreen.preventAutoHideAsync();”

We redirect the user to a different page depending on the environment, and whether the user is logged in or not. We use SplashScreen.hideAsync(); in whichever page the user lands on when we’re done loading things.

I try to add hideAsync in all components and the problem still persist

UPDATE

I remove this line to prevent generate de token for push notification and the app works fine:

await this.registerForPushNotificationAsync();

So the problem is the function that generates the token. I try to see what is the problem

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.