This app was mentioned in 3 comments, with an average of 1.67 upvotes
Maybe Tasker can do it. IDK... Or you can give this app a try. It's still in beta or alpha (unreleased), so might have some bugs.
Wandle
I think you can do this with Wandle
Keep an eye on Wandle
https://play.google.com/store/apps/details?id=com.wandle.app