Skip to content

Commit 3e22d39

Browse files
authored
doc(adroid): use pluginInitialize instead of initialize (#1387)
1 parent aae367f commit 3e22d39

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

www/docs/en/12.x-2025.01/guide/platforms/android/plugin.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,20 @@ referenced by a call from JavaScript, unless `<param>` with an `onload`
8080
</feature>
8181
```
8282

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

8585
```java
86+
/**
87+
* Called after plugin construction and fields have been initialized.
88+
*/
8689
@Override
87-
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
88-
super.initialize(cordova, webView);
89-
// your init code here
90+
protected void pluginInitialize() {
91+
// Your code here ...
9092
}
9193
```
9294

95+
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.
96+
9397
Plugins also have access to Android lifecycle events and can handle them
9498
by extending one of the provided methods (`onResume`, `onDestroy`, etc).
9599
Plugins with long-running requests, background activity such as media playback,

www/docs/en/12.x/guide/platforms/android/plugin.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,20 @@ referenced by a call from JavaScript, unless `<param>` with an `onload`
8080
</feature>
8181
```
8282

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

8585
```java
86+
/**
87+
* Called after plugin construction and fields have been initialized.
88+
*/
8689
@Override
87-
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
88-
super.initialize(cordova, webView);
89-
// your init code here
90+
protected void pluginInitialize() {
91+
// Your code here ...
9092
}
9193
```
9294

95+
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.
96+
9397
Plugins also have access to Android lifecycle events and can handle them
9498
by extending one of the provided methods (`onResume`, `onDestroy`, etc).
9599
Plugins with long-running requests, background activity such as media playback,

www/docs/en/dev/guide/platforms/android/plugin.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,20 @@ referenced by a call from JavaScript, unless `<param>` with an `onload`
8080
</feature>
8181
```
8282

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

8585
```java
86+
/**
87+
* Called after plugin construction and fields have been initialized.
88+
*/
8689
@Override
87-
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
88-
super.initialize(cordova, webView);
89-
// your init code here
90+
protected void pluginInitialize() {
91+
// Your code here ...
9092
}
9193
```
9294

95+
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.
96+
9397
Plugins also have access to Android lifecycle events and can handle them
9498
by extending one of the provided methods (`onResume`, `onDestroy`, etc).
9599
Plugins with long-running requests, background activity such as media playback,

0 commit comments

Comments
 (0)