Can you reveal the API used to get the current home screen page?

Not really looking for a trade secret. But it is clear that Kustom can get the home screen page from at least some launchers - like Nova in $si(screen)$. I have to replicate this but cannot seem to find the mechanism used. Any hints/tips are appreciated. Thanks

I’m not sure I understand. I think you’re saying you want to be able to have Kustom tell your launcher to switch to a specific page? If so I think you’d have to set up a launcher shortcut to use as a Touch action. Or possibly an intent?

I am sorry. I am basically asking for the code used in Kustom to implement its function $si(screen)$.

I need to replicate this and cannot find a way to get the info from the Launcher (Nova in this case). I have looked for a standard Android API, looked for content provider from Nova, maybe it does a broadcast?

Thanks

Hi there,

This may not be the solution to your need, but maybe you can use Tasker or Automate to get the info about the homescreen page.

I hope this would help.
:smiling_face::+1:

1 Like

I haven’t a clue about that. Probably only @frank can answer that, if he wishes to release any code.

1 Like

Thanks. It really need not be code, per se, but at least some clue as to how this is done. Best

Yes, I was planning on using Tasker. But without this information about the currently displayed home page, I cannot get what I want - which is the display of a webview scene - but only if on a specific home screen page.

I would much prefer to do this inside of Kustom. But Kustom has no mechanism for actually displaying rendered HTML. Not a complaint, just a report.

But you made me think, perhaps there is a way I can send the result of $si(screen)$ to Tasker as it changes within Kustom. Maybe I can send an intent or similar.

Best

I wanted to report back on what I have managed to do - which is to communicate the value that, somehow, Kustom knows (ie, which home screen page is currently displayed by Nova Launcher) to Tasker so IT can know as well.

In Kustom at the top level, I created a flow triggered by a change in the formula $si(screen)$. That flow contains 2 actions:

(a) a formula $si(screen)$ - while clearly redundant with the trigger, this is needed to get the value of this expression into the variable #last - which is the value sent in the send data action in (b).

(b) a send data action that takes the value of #last - from the action (a) - and broadcasts to the package net.dinglish.android.taskerm with a var name of home_screen_page. The var name can be about anything as can the action name - for which I simply used com.kwlp.sending.

The result of this is that every time the value of the home screen page changes, an intent is sent to Tasker which can use the data to update the value of a Tasker global variable.

So in Tasker I:

(c) created an intent received event profile with an action = com.klwp.sending - from (b) above - that, upon receipt,

(d) fires a task with a single, variable set action to assign the Tasker global variable %Home_Page_Num to the intent variable %home_screen_page - from (b) above.

In this way, Kustom “informs” Tasker every time the home screen page number changes.

Beware that there are times when these numbers can change VERY QUICKLY - as in the case where you have “infinite scroll” turned on in Nova Launcher and you wrap around from the right-most home page to the left-most one. For reasons unclear to me, the value does NOT simple go from, say, 9 to 1. What happens is that it quickly changes 8,7,6,5,4,3,2,1 - go figure.

But the result of this is that going from page 9 to page 1 sets off a flurry of intents and they can be hard to service quickly enough otherwise Tasker will kill those that follow while the 1st is still running its associated task. This can be dealt with in at least a couple ways. But I will not go into that here.

Anyhow, thanks @Baju_Santiko for getting me started down this road.

I still would love to get a hint from @frank as to how he has managed to get Kustom to “know” this value in the 1st place.

1 Like

You can set tasker up to jump from 9 to 1 without triggering (8,7,6,5,4,3,2) by setting a page delay in milliseconds of course, I personally don’t remember what to write in tasker as I have been doing Python, Bash, Java lately so Tasker stuff is kinda in my brain lost in a sea of code!

Have you gone to the reddit r/tasker ? There are some good people in there that are helpful, there jerks to, so don’t get discouraged! Tasker is amazing Android app, nothing else comes close!

Yes, something like that might work. Thanks!

And yes the Tasker app, dev, and forums (both on Reddit and google Groups) are great. And I have been lucky enough to NOT encounter the jerks in my time.

Best!

1 Like

Dumb question, have you set up Google Cloud Console? It is a bit scary if you are not used to API’s. But you might want to look into it, that’s how you get certain things working like Natural Speaking in Auto-Voice (tasker plugin) as well as Google Maps, Street Addresses, Google world & Street View! You want to start building a digital world in your hand, this Cloud Console is the first step

So far, I have not. Not yet used the new Tasker remote action features either. I have long gotten by using ssh commands and the like for such stuff and see no reason (yet) to involve Google. Best

If you wanna know behind scenes I can only guess either he implemented his own code or every launcher needs to add broadcast home screen page to kustom. And looking at how it work that it also recognizes pixel launcher home screen page is probably that dev coded his own or idk because when it comes to smartlauncher it breaks it show me I’m on 17th home page and I have total of 33.(Which is I’m pretty sure I don’t have that many but smartlauncher is made with latest programming stuff which I can only guess from my knowledge it contains compose and hilt dagger but I think smart launcher initialisms many screen but doesn’t show it to user) Which leads me to speculation that it is private android API that is not on android documentation because it was deemed unstable but it is unreleased API. Or I’m just guessing with some darn bluffing mind of my own based on info and experience(xp) of browsing through android dev documentation.

Thanks. You may well be correct. I recall seeing, several years ago by now, something about this on the web - maybe in a forum that is now dead because I cannot re-find it. As I recall, there was some co-operation provided by at least some launchers. No idea how extensive that list was then or now. Best