Android 9 TV Box: acting on remote control

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Android 9 TV Box: acting on remote control

Post by trevix » Fri Jul 09, 2021 10:52 am

I am deploying a LC 9.6.3 standalone in a Android 9 TV Box (T9 RK3318), that runs very well.
As you may know, beside attaching a hardware keyboard, or use the infrared remote control "mouse" mode, in most TV box you can go from button to button or field to field using the left/top/right/bottom commands of the infrared remote control.

I haven't figured out how i can intercept in LC these command and act accordingly on the UI.
Somebody has been able to do it?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Android 9 TV Box: acting on remote control

Post by Klaus » Fri Jul 09, 2021 11:04 am

Maybe you can handle the "focusin" message somehow?
IF that message is being sent here...

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Android 9 TV Box: acting on remote control

Post by trevix » Fri Jul 09, 2021 12:43 pm

Before the control can receive a FocusIn, I should be able to focus on it (using what I found to be named D-Pad). And it doesn't.
I guess this stuff should be coded:
https://developer.android.com/training/ ... navigation
Out of my knowledge possibilities
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Android 9 TV Box: acting on remote control

Post by AxWald » Fri Jul 09, 2021 10:20 pm

Hi,

just to be sure: This doesn't shows anything?

Code: Select all

on rawkeydown what
   answer what
end rawkeydown
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Android 9 TV Box: acting on remote control

Post by trevix » Sat Jul 10, 2021 1:18 pm

No.
Both on the Tv box and on a Android 7 phone the rawkeydown does not react.
The native field takes control, I guess
Being able to code this navigation may open up a market for LC on android TV and android TV box: games, utilities , etc.
I thin LC should do an LCB extension for it
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Android 9 TV Box: acting on remote control

Post by trevix » Sun May 28, 2023 8:06 pm

Strange enough, the back key on the remote control reaches the "backKey" message in LC, like if using the cell hardware back button.
Also, LC answer and ask dialogs behave perfectly on the Android TvBox: you can navigate, using the remote wheel, from the field to the OK and Cancel buttons and back.

So, apparently, what is sent from the infrared remote does reach the LC engine.
Could it just be that there is a way to make it work but I don't know how?
I tried to look at the code of the ask and answer dialog, but I could not find a clue.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Android 9 TV Box: acting on remote control

Post by jacque » Mon May 29, 2023 4:52 pm

Since the backkey works, maybe an arrowkey handler would work too?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Android 9 TV Box: acting on remote control

Post by trevix » Mon May 29, 2023 6:02 pm

No. Nothing.

BackKey: OK
arrowKey: no
rawkeyDown: no
rawkeyUp: no
keyDown: no
keyUp: no
no other buttons on the remote has any effect (except of course for home and shutDown) on LC
Amazing
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Android 9 TV Box: acting on remote control

Post by jacque » Mon May 29, 2023 7:34 pm

Well, that's disappointing. 🙁
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Android 9 TV Box: acting on remote control

Post by trevix » Mon May 29, 2023 9:34 pm

Yeah. But what is bizarre, as I said, is that left/right/focus select from the remote works fine inside the ask and answer LC dialogs.
There is a lot of code in this dialogs that I don’t understand. But I wonder if I could duplicate that stack and transform it for my own use.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Android 9 TV Box: acting on remote control

Post by trevix » Wed May 31, 2023 4:13 pm

I did a test (spoiler: it doesn't work)
Since the Answer/ask dialogs are listed on the standalone setting inclusions, probably they have code in the engine that allow them to respond, as they do, to infrared remot control, for navigating between buttons focus, field, etc. for reasons that escape me.

So I created a copy, with a different name, of the IDE "Answer dialog" stack, and I set it as a substack of a main stack.
I did some minor change to the code, removing a command which I don't understand but mainly acts on stack closing, that get sent to the revIDELibrary

Code: Select all

  if the environment is "development" then
      send "ideMessageSend" && "ideAnswerDialogClosed" to stack "revIDELibrary" in 0 millisecs
   end if
Unfortunately, opening the stack as modal, works as a regular modal stack but does not responde to the remote control.
Any knowledge guy can clear the light on this or make some suggestions?

I attach the stack, in case you care.
Thanks
Attachments
TvBoxAnswerDialog.livecode.zip
(5.9 KiB) Downloaded 64 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Android 9 TV Box: acting on remote control

Post by jacque » Wed May 31, 2023 5:16 pm

I remember when mobile was first developed, LC said they had to create specialized ask and answer dialogs. There must be more to it than just the stack. If LC is calling out to the OS then that would explain why the remote works there but not otherwise.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Android 9 TV Box: acting on remote control

Post by Klaus » Fri Mar 22, 2024 1:45 pm

kideveloper11 wrote:
Fri Mar 22, 2024 1:29 pm
On an Android 9 TV Box, commands from a TV remote control can be intercepted by using the mobile control message in LiveCode.
Well, we have already been this far actually... 8)

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Android 9 TV Box: acting on remote control

Post by SparkOut » Fri Mar 22, 2024 2:02 pm

Not even a mention of using accelerometer to catch TV remote messages. Perhaps*this time* it really is genuine :lol: :lol: :lol: :lol:

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Android 9 TV Box: acting on remote control

Post by Klaus » Fri Mar 22, 2024 3:05 pm

I've checked the user, he/she already made some vaild postings a long time ago.
But I might repeat myself, I have an eye on everything here! :D

Post Reply

Return to “Android Deployment”