react-native-background-fetch icon indicating copy to clipboard operation
react-native-background-fetch copied to clipboard

please need your complete guidance/support on how to implement a daily wallpaper changer in react native ( run task even when the app is closed ).

Open zakirtest123 opened this issue 1 year ago • 4 comments

Your Environment

  • Plugin version:
  • Platform: Android
  • OS version:
  • Device manufacturer / model:
  • React Native version (react-native -v):
  • Plugin config

Expected Behavior

Actual Behavior

Steps to Reproduce

Context

please need your complete guidance/support on how to implement a daily wallpaper changer in react native ( run task even when the app is closed ).

Debug logs

zakirtest123 avatar Apr 14 '24 20:04 zakirtest123

I don’t know what a “wallpaper changer” is (nor am I interested).

For Android, this plug-in implements the WorkManager API, which can execute your provided callback function about every 15 minutes.

what you do in your callback is your business. The only thing I’m interested is seeing your callback execute (eg a console.log showing up in your logs).

see the readme to learn how to simulate events.

christocracy avatar Apr 14 '24 20:04 christocracy

For terminated state, see api docs in readme enableHeadless and learn how to implement a “HeadlessTask”

christocracy avatar Apr 14 '24 20:04 christocracy

I went through several docs... including the https://reactnative.dev/docs/headless-js-android... could not follow as it is in Java. "Wallpaper changer" : this wallpaper app will change the wallpaper of the phone daily (every 24 hours) automatically, even if the app is in foreground, background and terminated state.

On Mon, Apr 15, 2024 at 2:20 AM Chris Scott @.***> wrote:

For terminated state, see api docs in readme enableHeadless and learn how to implement a “HeadlessTask”

— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/react-native-background-fetch/issues/492#issuecomment-2054180631, or unsubscribe https://github.com/notifications/unsubscribe-auth/BH2LPFTDV3DFDSV6LDNMIA3Y5LTYHAVCNFSM6AAAAABGGJ3RZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJUGE4DANRTGE . You are receiving this because you authored the thread.Message ID: @.*** .com>

zakirtest123 avatar Apr 15 '24 05:04 zakirtest123

Stop concentrating on “wallpaper change” and just focus on the simple task of logging a simple message in your callback.

you don’t need to “read Java”. All the api docs are linked in the readme

christocracy avatar Apr 15 '24 13:04 christocracy

Ok, so you mean to say that if the stopOnTerminate: true and enableHeadless: true is set then no need of adding any Java code?

mdzakir avatar May 14 '24 09:05 mdzakir

Why don’t you try it and see?

christocracy avatar May 14 '24 11:05 christocracy

wow! that's awesome!!! It works. Able to simulate setting the wallpaper in all states (foreground, background and terminated) of the device. thanks a ton @christocracy 🎉

mdzakir avatar May 22 '24 16:05 mdzakir