capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
237 stars 83 forks source link

question: For capacitor 3.0 do we need to edit MainActivity.java? #95

Closed mesqueeb closed 2 years ago

mesqueeb commented 2 years ago

The README still says:

on your MainActivity.java file add import com.getcapacitor.community.fcm.FCMPlugin; and then inside the init callback add(FCMPlugin.class);

But is this only for Capacitor 2.x? Or also required for Capacitor 3.x?

stewones commented 2 years ago

on Capacitor v3 plugins are loaded automatically (as long as they aren't built specifically for your application). For community plugins you can remove it safely.

 public class MainActivity extends BridgeActivity {
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        // Initializes the Bridge
-        this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
-            // Additional plugins you've installed go here
-            add(Plugin1.class);
-            add(Plugin2.class);
-        }});
-    }
 }