Comments (7)
Please post the full code of MainActivity,java
from firebase-analytics.
That is the full code...
In the previous image I just cut the first line where there is my package name...
The app is created with ionic angular capacitor 3.
Everything works fine except firebase.
I repost here MainActivity.java:
package it.piemonte.arpa.meteo3RTest;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;
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
// Ex: add(TotallyAwesomePlugin.class);
add(FirebaseAnalytics.class);
}
}
);
}
}
Here my npx cap sync android
✔ Copying web assets from www to android/app/src/main/assets/public in 1.77s
✔ Creating capacitor.config.json in android/app/src/main/assets in 1.60ms
⠴ copy android [info] Found 4 Cordova plugins for android:
[email protected]
[email protected]
[email protected]
[email protected]
✔ copy android in 1.86s
✔ Updating Android plugins in 31.61ms
[info] Found 11 Capacitor plugins for android:
@capacitor-community/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
@capacitor/[email protected]
⠙ update android [info] Found 4 Cordova plugins for android:
[email protected]
[email protected]
[email protected]
[email protected]
✔ update android in 117.29ms
[info] Sync finished in 1.978s
Here my ionic info
Ionic:
Ionic CLI : 6.16.1 (/home/losciur/.nvm/versions/node/v14.17.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.8
@angular-devkit/build-angular : 12.0.3
@angular-devkit/schematics : 12.0.3
@angular/cli : 12.0.3
@ionic/angular-toolkit : 4.0.0
Capacitor:
Capacitor CLI : 3.0.0
@capacitor/android : 3.0.0
@capacitor/core : 3.0.0
@capacitor/ios : not installed
Utility:
cordova-res : 0.15.3
native-run : 1.3.0
System:
NodeJS : v14.17.0 (/home/losciur/.nvm/versions/node/v14.17.0/bin/node)
npm : 6.14.13
OS : Linux 5.4
from firebase-analytics.
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;
import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;
import java.util.ArrayList;
Add these imports in MainActivity.java
from firebase-analytics.
This is a duplicate of #94, closing.
from firebase-analytics.
Thanks for the help!
Mixing what you suggest and what in capacitor documentation and in #94 I think that the better solution is:
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(FirebaseAnalytics.class);
}
}
Maybe you may add this lines in the documentation of this plugin, because the lines you suggest are deprecated.
from firebase-analytics.
The capacitor documentation indicates that the registerPlugin
call is not needed for plugins installed via NPM, which is the case for the firebase-analytics plugin. You only need to call registerPlugin
if you have local custom plugins that you developed for your app and are not installing from NPM.
from firebase-analytics.
You're right about the capacitor documentation,
but if I leave the code you suggest:
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;
import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;
import java.util.ArrayList;
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
// Ex: add(TotallyAwesomePlugin.class);
add(FirebaseAnalytics.class);
}
}
);
}
}
I got this (Android Studio 4.2.1):
On the other side, when I install any official capacitor plugins via npm I don't have to modify the ManiActivity.java file in Android Studio (I don't know why).
Thank you very much for your work and this explanation words, I'm very happy to try to understand something more in plugin.
from firebase-analytics.
Related Issues (20)
- Capacitor 5 HOT 2
- Play Console Error : Manifest doesn't include Advertising ID permission HOT 2
- Expose setUserProperties to set multiple user properties at once
- Disable auto tracking screen_view on web, but still allow events
- No App Version in analytics since update to 5.0 HOT 1
- In_app_purchase and version log when using @capacitor-community/firebase-analytics HOT 2
- XCode 15 build failed - DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead HOT 1
- No data are visible in the firebase analytics console in localhost HOT 1
- Consent management HOT 4
- Android not tracked
- [IOS] [FirebaseAnalytics][I-ACS013000] Screen parameter value must be of type NSString: (nil) HOT 2
- In app purchases not reported from Android HOT 1
- [FEATURE]: Add required `Privacy Manifest` file for iOS HOT 5
- Question about the screen_view
- Question about the GDPR and the user consent
- Please update this plugin to support capacitor 6 version HOT 1
- Compatibility with @capacitor/core 6.0.0 HOT 1
- ERROR Error: Uncaught (in promise): Firebase analytics is not initialized. Make sure initializeFirebase() is called once HOT 1
- Using the latest version of the SDK for IOS HOT 6
- Disable Auto page_views for web
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-analytics.