Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting data on Android #10

Closed
trkfabi opened this issue Dec 14, 2017 · 26 comments
Closed

Not getting data on Android #10

trkfabi opened this issue Dec 14, 2017 · 26 comments

Comments

@trkfabi
Copy link

trkfabi commented Dec 14, 2017

Hi,

I'm using analytics and core just to log some events. iOS works fine but I don't see any data going to Firebase under the Android project.
Settings seem to be just fine, the google-services.json is under /app/assets/android/ and no errors are begin logged in the console.
I'm using Ti SDK 6.3.0 and I don't use any other module that could conflict with this one.

I'd appreciate any clue of where to look at.

Thanks

@hansemannn
Copy link
Owner

I do not personally use the Android one, but maybe @miga or @AppWerft can help?

@mitulbhalia
Copy link

Hello @trkfabi
Did you find any solution for your issue?
Also can you please tell me how to configure android module?
I added google-services.json in /app/assets/android/ but when i tried run the demo, it shows me below error.

Uncaught TypeError: Alloy.Globals.FA.configure is not a function

I declare this module in alloy.js as below
Alloy.Globals.FA = require('firebase.analytics');
Alloy.Globals.FA.configure();
Please let me know.

@trkfabi
Copy link
Author

trkfabi commented Jan 1, 2018 via email

@hansemannn
Copy link
Owner

I noticed that you use an outdated version of the module that didn't play nice with playservices at that time. With 7.0.0+, the google play services are managed in a central place, the ti.playservices module. The updated module version (2.x) requires that module and firebase.core to be included.

Example:

<module>ti.playservices<module>
<module>firebase.core<module>
<module>firebase.analytics<module>

In addition, if the problem still occurs with titanium-firebase-analytics 2.0.0 (current stable), I've prepared a 2.0.1 version that attempts to pass the activity different than before. Let me know if that works out!

Preprelease:
firebase.analytics-android-2.0.1.zip

@mitulbhalia
Copy link

Ok @trkfabi Let me know when you find solution.

@hansemannn My main concern is that i am not using latest version of mac os so i need to use ti sdk 7.0 then i have to first update my mac os then xcode version so is there any older which i can use for my iphone app?

@trkfabi
Copy link
Author

trkfabi commented Jan 2, 2018 via email

@hansemannn
Copy link
Owner

Sorry, I think your post is missing some screens / code.

@trkfabi
Copy link
Author

trkfabi commented Jan 2, 2018

Sorry. I have updated the post.

@trkfabi
Copy link
Author

trkfabi commented Jan 2, 2018

OMG, wait... I copied/pasted <module>firebase.analytics<module> from somewhere.... the closing tag is wrong!! (i'm crying).
Sorry for wasting your time. I'll test this and report back if it works for Android.

@hansemannn
Copy link
Owner

I've just changed an activity reference to initialize the instance and now the app doesn't crash for me anymore. Unfortunately, I still receive the following logs on Android when logging with Analytics.log('test_event', {});.

It says:

[INFO]  FA: App measurement is starting up, version: 11020
[INFO]  FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
[ERROR] FA: GoogleService failed to initialize, status: 10, Missing google app id value from from string resources with name google_app_id.
[ERROR] FA: Scheduler not set. Not logging error/warn
[INFO]  FA: To enable faster debug mode event logging run:
[INFO]  FA:   adb shell setprop debug.firebase.analytics.app com.appc.firebasedemo
[ERROR] FA: AppMeasurementReceiver not registered/enabled
[ERROR] FA: AppMeasurementService not registered/enabled
[ERROR] FA: Uploading is not possible. App measurement disabled
[INFO]  FA: Tag Manager is not found and thus will not be used

Probably pasted the google-services.json incorrectly? I only personally tested the iOS version so far, so if we can get Android running together, we should be good!

@trkfabi
Copy link
Author

trkfabi commented Jan 2, 2018

I'm not an Android fan either.
I got it working!!! by adding these services to the tiapp.xml under <application> tag:
(replace mypackagename with your com.blabla.myapp)

<!-- this is to make FA work -->
<service android:name="com.google.android.gms.measurement.AppMeasurementService" android:enabled="true" android:exported="false"/>	

<receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver" android:enabled="true">
   <intent-filter>
      <action android:name="com.google.android.gms.measurement.UPLOAD" />
   </intent-filter>
</receiver>  

<service android:name="mypackagename.gcm.GcmIntentService" android:exported="false">
   <intent-filter>
      <action android:name="com.google.android.c2dm.intent.RECEIVE" />
   </intent-filter>
</service>

<service android:name="mypackagename.gcm.GcmIntentService" android:exported="false">
   <intent-filter>
      <action android:name="com.google.android.c2dm.intent.SEND" />
   </intent-filter>
</service>

<service android:name="mypackagename.gcm.GcmIDListenerService" android:exported="false">
   <intent-filter>
      <action android:name="com.google.android.gms.iid.InstanceID" />
   </intent-filter>
</service>

 <service android:name="mypackagename.gcm.RegistrationIntentService" android:exported="false"/>
<!-- this is to make FA work -->

and also had to add <string name="google_app_id">my firebase application id</string> to the string.xml file (still looking if there's a better place to set this prop, i.e: tiapp.xml like gsm.senderid)
to get rid of this error:

[ERROR] FA: GoogleService failed to initialize, status: 10, Missing google app id value from from string resources with name google_app_id.
[ERROR] FA: Scheduler not set. Not logging error/warn

and DEBUG VIEW is also working:
image

just run this command in a terminal to start debugging (genymotion emulator):
./adb shell setprop debug.firebase.analytics.app com.blabla.myapp

and to stop debugging:
./adb shell setprop debug.firebase.analytics.app .none.

@trkfabi
Copy link
Author

trkfabi commented Jan 3, 2018

Custom parameters are not working on Android.
This sentence: Alloy.Globals.FirebaseAnalytics.log('logout', {username: "a4@a.com"});

logs this on Android:
image

and this on iOS:
image

@hansemannn
Copy link
Owner

Thanks @trkfabi, great progress! The custom events are only not working, because it right now checks for dedicated custom keys like ACHIEVEMENT_ID.

I think we can remove that check and just bridge all String keys to it. Let me see how other do that. I'll also update the readme today to reflect the installation steps.

@hansemannn
Copy link
Owner

hansemannn commented Jan 3, 2018

Added an own paragraph for the installation here. Closing this issue, will likely do a PR to add custom events. Thanks again everyone for participating!

@hansemannn
Copy link
Owner

2.0.1 drafted, including an attempt to implement custom events: https://github.com/hansemannn/titanium-firebase-analytics/releases/tag/android-2.0.1

@trkfabi
Copy link
Author

trkfabi commented Jan 3, 2018

custom events are working fine with the latest 2.0.1.
well done!

@ghost
Copy link

ghost commented Jan 4, 2018

Excellent work! However, I had to add another service in the AndroidManifest section of the tiapp.xml file, this allowed the App Measurement Service to run:

<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>

Without this addition, I still received:

[ERROR] FA: AppMeasurementReceiver not registered/enabled
[ERROR] FA: AppMeasurementService not registered/enabled

@hansemannn
Copy link
Owner

Thanks @DGJMaxwell, added that note!

@hansemannn
Copy link
Owner

.. and an example app: https://github.com/hansemannn/titanium-firebase-demo

@LilianAlvarez
Copy link

LilianAlvarez commented Jan 14, 2018

I experimented the same issue reported by Fabian Martinez with firebase analytics. I can not figure it out how to setup firebase analytics.

I get the same error : GoogleService failed to initialize, status: 10, Missing google app id value from from string resources with name google_app_id.

I did add the 1:1XXXXXX:android:XXXXXXXX in platform/android/res/values

I added the google-services.json in assets/android

I added the require info in the tiapp.xml quoted below.

My Tiapp.xml :

ti.map : 4.0.0 (android)
Latest ti.playservices
latest firebase.core & firebase.analytics

@trkfabi
Copy link
Author

trkfabi commented Jan 14, 2018 via email

@LilianAlvarez
Copy link

Here it is @trkfabi. In my strings.xml i added :
1:10XXXXXX3:android:XXXXXXXXXa

capture d ecran 2018-01-19 a 00 48 04

@trkfabi
Copy link
Author

trkfabi commented Jan 19, 2018 via email

@LilianAlvarez
Copy link

I try and i still get the same error @trkfabi

[ERROR] FA: Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI

@trkfabi
Copy link
Author

trkfabi commented Jan 24, 2018 via email

@LilianAlvarez
Copy link

@trkfabi : thanks for the lead i got it work by using the international system.

Thanks a lot @trkfabi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants