最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to add "Set as Wallpaper" option in React Native app - Stack Overflow

programmeradmin3浏览0评论

How to enable option "set as wallpaper" ? I'm using expo and I'm not able to find any API to enable that functionality. I only able to download image. I want to trigger set as wallpaper option. I tried to use react-native-wallpaper-manager library but it has not worked for me.

How to enable option "set as wallpaper" ? I'm using expo and I'm not able to find any API to enable that functionality. I only able to download image. I want to trigger set as wallpaper option. I tried to use react-native-wallpaper-manager library but it has not worked for me.

Share Improve this question edited Oct 6, 2018 at 12:22 Nirbhay Singh 1,2981 gold badge12 silver badges19 bronze badges asked Apr 9, 2018 at 19:55 Nilesh KantNilesh Kant 3592 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

I found the proper solution to 'set wallpaper' (in android) using react-native-wallpaper-manager by ejecting the CRNA . But it seems like the npm release is not up to date with the repo. To get it to work you will have to implement the last pull fix manually by removing

@Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

from WallPaperPackage.java and make sure to link the package by react-native link react-native-wallpaper-manager

Note:- Right now there is no api working with expo or CRNA to 'set as wallpaper' in android

you can use NativeModules from react-native

import NativeModules from 'react-native';

NativeModules.WallPaperManager.setWallpaper(image,callback);
发布评论

评论列表(0)

  1. 暂无评论