Skip to content

Commit

Permalink
master
Browse files Browse the repository at this point in the history
Remove Registering the Plugin from capacitor
  • Loading branch information
unnaticleverpush committed Jul 24, 2024
1 parent 87b8c44 commit 29ba911
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions docs/sdks/capacitor/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,61 +99,3 @@ title: Setup
11. Select Login > My Certificates then right click on your key and click "Export (Apple Production iOS Push Services: com.your.bundle)..."
12. Give the file a unique name and press save, be sure to leave the password field blank!
13. Upload your certificate in the CleverPush channel settings
## Registering the Plugin
### Register the Plugin in iOS
Since Capacitor 6, We must register custom plugins on iOS so that Capacitor can bridge between Swift and JavaScript.
1. If using Custom View Controller (UIViewController)
Then add a `viewDidLoad()` method override and register the plugin:
```swift
import UIKit
import Capacitor
import CleverpushCapacitorSdk
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
bridge?.registerPluginInstance(CleverPushCapacitorPlugin())
}
}
```
2. If using Bridge View Controller (CAPBridgeViewController)
Then add a `capacitorDidLoad()` method override and register the plugin:
```swift
import UIKit
import Capacitor
import CleverpushCapacitorSdk
class MyViewController: CAPBridgeViewController {
override open func capacitorDidLoad() {
super.capacitorDidLoad()
bridge?.registerPluginInstance(CleverPushCapacitorPlugin())
}
}
```
### Register the Plugin in Android
Since Capacitor 6, We must register custom plugins on Android so that Capacitor can bridge between Java and JavaScript.
In your app's MainActivity.java, use `registerPlugin()` or `registerPlugins()` to register your custom plugin(s).
```java
public class MainActivity extends BridgeActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
registerPlugin(CleverPushCapacitorPlugin.class);
super.onCreate(savedInstanceState);
}
}
```

0 comments on commit 29ba911

Please sign in to comment.