Do a Specific Task After Screen Unlock

I want to Create an App so that When ever User unlock His Phone a music plays (Like welcome etc) but i cant figure it out How it will Work.
It will be glad if someone help me with it.
Kindly share an extension (if required)
Or Is it Possible In Kodular?

Yes sure you can you particles extension and inbiuilt exo player component + phase extension to greet users with animation

You will need a background extension to keep it running all time if the app is closed.

Maybe it is possible to listen to the event when the user unlocks the phone.

Can You Show me Some Blocks How it will Be used for Playing Music on unlocking Phone.
I am New Here So please HELP​:pleading_face:

Action

xyz.kumaraswamy.lockinfo.aix (5.1 KB)

You can use my extension to listen to events when the phone is locked and unlocked.


Else you can also use the below extension to dynamically register any custom intent action.

xyz.kumaraswamy.activitylistener.aix (5.3 KB)

Both of them should be tested in a compiled app.

3 Likes

I tired it and I am getting a runtime error Receiver not registered: [email protected]

Try this: play_unlocked.apk (5.3 MB)

1 Like

That should not happen unless you are testing in a companion.
Where exactly it doesn’t work?

I just checked it.
The error only raises when you are calling the block two times as the receiver is already unregistered.

This should work fine:

O yeah It’s working Now
1 last Problem I am Facing Is that This only Works When App is running in Background (Recent apps) when i clear it from Their it Doesn’t work Any Solution.

Yeah this is possible, you just have to make them work with this extension:

A repeated mode will be needed to do it.

This does the same and works also with Companion:
play_unlocked2.aia (152.4 KB)

your background extension just flew above my head it’s to difficult to understand.
Can u just tell me which blocks should I use for my App
Which we discussed above just want to play music when user unlock his phone and I want that it should still work when user remove app from background(recent apps)

Sorry to hijack the topic, but I never saw those 2 extensions. Are they still in beta phase or are they available for anyone to use normally?

1 Like

@Xoma please create a new thread for each of these extensions in category #extensions and add a short documentation and how to use them etc… so everyone will be able to find the extensions later again when they are needed
thank you

Taifun

2 Likes

Those were quick extensions created by me. :sweat_smile:

Okay, do I need to create a new topic?

1 Like

I used your Method with some changes
1)Instead of button I used Switch which is working fine
2)Instead of Loop i only want music to play when user unlocks screen and Music should be played once Don’t want loop but it’s keep Looping can u find the mistake

See in the Designer settings (Player: loop). Disable it.

I disable it but it’s still looping

What exactly is to be achieved:

  1. open app
  2. Music is playing / not playing?
  3. The app goes to the background and / or the screen is locked
  4. Music is playing / not playing?
  5. The app comes to the foreground and / or the screen is unlocked

What is the purpose of the switch?