Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use manual mode start? #20

Closed
ghost opened this issue Sep 7, 2023 · 4 comments
Closed

How to use manual mode start? #20

ghost opened this issue Sep 7, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@ghost
Copy link

ghost commented Sep 7, 2023

I set startMode: 'manual' in my capacitor.config.ts

I have my built application in public/nodejs so it gets copied into the build.

I call it like this: await NodeJS.start({ script: 'dist/index.js', env: { NODE_ENV: 'production' } });

The file s located at /data/data/com.example.myApp/files/nodejs/public/dist/index.js (via android device explorer)

I added Logger.info(CapacitorNodeJSPlugin.LOGGER_TAG, "NATIVE START" + Arrays.toString(arguments)); right before the call to nativeStart(arguments, environmentVariables, true); in NodeProcess.java and I see: NATIVE START[node, /data/user/0/com.example.myApp/files/nodejs/public/dist/index.js] so it does seem like it should use that file. However it doesnt seem to actually start my App. Before I go any farther in debugging, is this all I need to do?

EDIT: I should say that when i turn off manual mode and switch back to whenReady() the app boots as expected

@hampoelz
Copy link
Owner

hampoelz commented Sep 7, 2023

You have to use whenReady() to wait until the runtime is fully started, regardless of the start mode.

I should probably improve the documentation on this.

@hampoelz hampoelz added the documentation Improvements or additions to documentation label Sep 7, 2023
@ghost
Copy link
Author

ghost commented Sep 7, 2023

aha! I'll give it a go. thanks. It'd be nice to see it in one of the examples at some point.

hampoelz added a commit to hampoelz/HTL_Diplomarbeit_Dokumentation that referenced this issue Sep 7, 2023
@ghost
Copy link
Author

ghost commented Sep 11, 2023

I tried that approach and it didn't work. Is it possible you could try it in one of the examples?

@hampoelz hampoelz reopened this Sep 11, 2023
@hampoelz
Copy link
Owner

hampoelz commented Oct 1, 2023

The example was unfortunately out of date. I've updated everything and added some new examples. Take a look at the example/manual_start branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant