skip to Main Content

I’m able to setWallpaper in Android while app is in foreground and in background using background task. However I’m not able to set the wallpaper when the app is terminated (cleared from the recents). Is this possible, if so how can achieve this in react native? With expo or without.

2

Answers


  1. I don’t think you can do this if the app is terminated. You could try this workaround to keep the app minimized instead?

    https://www.npmjs.com/package/react-native-minimize

    import React from "react";
    import {BackHandler} from "react-native";
    import RNMinimizeApp from 'react-native-minimize';
    
    
    ComponentWillMount(){
      BackHandler.addEventListener('hardwareBackPress', function() {
        RNMinimizeApp.minimizeApp();
      });
    
      componentWillUnmount() {
        BackHandler.removeEventListener('hardwareBackPress')
      }
    
    
    }
    
    Login or Signup to reply.
  2. This can not be done.
    Once app is terminated from memory it cant perform any task.
    Maybe you should try firebase messaging, alarm or other notification channel.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search