Skip to content

Commit

Permalink
doc(adroid): use pluginInitialize instead of initialize (#1387)
Browse files Browse the repository at this point in the history
  • Loading branch information
GitToTheHub authored Feb 14, 2025
1 parent aae367f commit 3e22d39
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
12 changes: 8 additions & 4 deletions www/docs/en/12.x-2025.01/guide/platforms/android/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,20 @@ referenced by a call from JavaScript, unless `<param>` with an `onload`
</feature>
```

Plugins should use the `initialize` method for their start-up logic.
Plugins should use `pluginInitialize` for their start-up logic.

```java
/**
* Called after plugin construction and fields have been initialized.
*/
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
// your init code here
protected void pluginInitialize() {
// Your code here ...
}
```

Do not use [CordovaPlugin#initialize(CordovaInterface cordova, CordovaWebView webView)](https://github.com/apache/cordova-android/blob/dff2fc633121f995b6827a9d1a211c3c54d60c7d/framework/src/org/apache/cordova/CordovaPlugin.java#L68) anylonger, as this will be deprecated in the future. `CordovaPlugin` has the public members `cordova` and `webView` which you can access in your plugin.

Plugins also have access to Android lifecycle events and can handle them
by extending one of the provided methods (`onResume`, `onDestroy`, etc).
Plugins with long-running requests, background activity such as media playback,
Expand Down
12 changes: 8 additions & 4 deletions www/docs/en/12.x/guide/platforms/android/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,20 @@ referenced by a call from JavaScript, unless `<param>` with an `onload`
</feature>
```

Plugins should use the `initialize` method for their start-up logic.
Plugins should use `pluginInitialize` for their start-up logic.

```java
/**
* Called after plugin construction and fields have been initialized.
*/
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
// your init code here
protected void pluginInitialize() {
// Your code here ...
}
```

Do not use [CordovaPlugin#initialize(CordovaInterface cordova, CordovaWebView webView)](https://github.com/apache/cordova-android/blob/dff2fc633121f995b6827a9d1a211c3c54d60c7d/framework/src/org/apache/cordova/CordovaPlugin.java#L68) anylonger, as this will be deprecated in the future. `CordovaPlugin` has the public members `cordova` and `webView` which you can access in your plugin.

Plugins also have access to Android lifecycle events and can handle them
by extending one of the provided methods (`onResume`, `onDestroy`, etc).
Plugins with long-running requests, background activity such as media playback,
Expand Down
12 changes: 8 additions & 4 deletions www/docs/en/dev/guide/platforms/android/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,20 @@ referenced by a call from JavaScript, unless `<param>` with an `onload`
</feature>
```

Plugins should use the `initialize` method for their start-up logic.
Plugins should use `pluginInitialize` for their start-up logic.

```java
/**
* Called after plugin construction and fields have been initialized.
*/
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
// your init code here
protected void pluginInitialize() {
// Your code here ...
}
```

Do not use [CordovaPlugin#initialize(CordovaInterface cordova, CordovaWebView webView)](https://github.com/apache/cordova-android/blob/dff2fc633121f995b6827a9d1a211c3c54d60c7d/framework/src/org/apache/cordova/CordovaPlugin.java#L68) anylonger, as this will be deprecated in the future. `CordovaPlugin` has the public members `cordova` and `webView` which you can access in your plugin.

Plugins also have access to Android lifecycle events and can handle them
by extending one of the provided methods (`onResume`, `onDestroy`, etc).
Plugins with long-running requests, background activity such as media playback,
Expand Down

0 comments on commit 3e22d39

Please sign in to comment.