I have a second and final scripting question for today.
I’m trying to write a script that does one thing if LL is the default launcher, but another if Nova is the default.
I am now able to detect which launcher is the default, so I just need to call Nova with the correct parameters.
I currently have this:
intent = new Intent(‘com.teslacoilsw.launcher.ACTION’);
intent.setClassName(‘com.teslacoilsw.launcher’,
‘com.teslacoilsw.launcher.NovaShortcutHandler’);
intent.setComponent(new ComponentName(‘com.teslacoilsw.launcher’,
‘com.teslacoilsw.launcher.NovaShortcutHandler’));
intent.putExtra(‘LAUNCHER_ACTION’, ‘GOTO_SCREEN’);
intent.putExtra(‘PAGE_NUMBER’, 3);
LL.startActivity(intent);
This produces no error, but also doesn’t work. 🙁
The various Nova parameters are known to be correct. They work if I use Tasker to send them as an intent like this:
Action: com.teslacoilsw.launcher.ACTION
Extra: LAUNCHER_ACTION:GOTO_SCREEN
Extra: PAGE_NUMBER:3
Package: com.teslacoilsw.launcher
Class: com.teslacoilsw.launcher.NovaShortcutHandler
Target: Activity
Evidently, I’m not translating this correctly to the proper JavaScript methods.
Can anyone tell me how to map the Tasker Send Intent fields to their equivalent Javascript methods?
]]>
< ![CDATA[
It might be that the second call to putExtra doesn’t catch the right java method. I believe it may use the version with double instead of int (JS numbers are all doubles, even 3).
Try with a specific method selection this way:
Intent[“putExtra(java.lang.String,int)”](‘PAGE_NUMBER’, 3);
(not tested)
Also the setClassName call can probably be removed since the setComponent call set it too.
]]>
< ![CDATA[
Thanks for the great support, Pierre Hébert.
Unfortunately, that doesn’t fix it, so I’ll have to rely on the working Tasker version for now:
LL.sendTaskerIntent(new TaskerIntent(‘Nova: Page ‘ + page), false);
I have to create a few almost identical tasks in Tasker for the various pages, but at least it works.
Thanks again for all of the detailed help.
]]>
< ![CDATA[
I am sorry it doesn’t work, it seemed like a simple task 🙁 Well, I am glad you found a workaround anyway.
]]>
< ![CDATA[
No worries. Thank you again for your help.
]]>