B4A Library FirebaseAnalytics - Analytics & Crash Reports

Discussion in 'Additional libraries, classes and official updates' started by Erel, Jun 9, 2016.

  1. daniel69

    daniel69 Member Licensed User

    I'm facing a strange behavior on stats....

    Testing my app I get no errors (compiling or running), on the FireBase consolle I can see the stats regarding any crash (generated on purpose) but I do not get any other stats after 24h ... (I've embedded the following line in the app create sub : Starter.analytics.SendEvent("app_open", null)

    The firebase notification messages are fine (I can send them successfully to the app), the firebase crash stats are fine and the Admob/Firebase link is correct ...

    The manifest is identical to the one suggested in the tutorial (without the authoring section), the json file is placed in the app dir, the FireBase libs are of course included (admob, analytics, notification), the services (Starter & FirebaseMessaging) are identical to the one suggested, google play and suggested repository are updated and the testing device has the correct google play (IsGooglePlayServicesAvailable is true)

    Development enviroment:
    B4A>> 6.0
    Android Support Repository >> 36
    Google Repository>> 32
    Google Play services>> 29

    Any suggestions?
  2. Erel

    Erel Administrator Staff Member Licensed User

    Two days have passed. Is there still no data?
  3. daniel69

    daniel69 Member Licensed User

    Hi Erel ... thank you for your answer ... still no data ... I've got the feeling that it may depend on the app package name .. it has some CAPITAL letters (it starts with B4A...) ... it is my first app and I did not know at that time about problems that may arise with capital letters ... I've checked the Jason file and the project info and the client info are correct (and the package name starts with B4A.)
  4. daniel69

    daniel69 Member Licensed User

    Hi Erel .. I was checking other values of the google-service.json file .. is the following OK? or should I change it to "status":2 ...

    "services": {

    "analytics_service": {

    "status": 1

  5. Erel

    Erel Administrator Staff Member Licensed User

    It should be 1.

    Have you checked the unfiltered logs for any message?
  6. daniel69

    daniel69 Member Licensed User

    In release mode sometimes (1 out of many) I get the following line

    LogCat connected to: B4A-Bridge: samsung GT-I9505
    --------- beginning of /dev/log/main
    ** Service (starter) Create **
    Failed to ensure directory: /storage/extSdCard/Android/data/anywheresoftware.b4a.b4abridge/files
    ** Service (starter) Start **

    <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: (CL3869936)

    In debug mode I get the following

    ** Activity (main) Resume **
    Installing file.
    GC_CONCURRENT freed 7253K, 32% free 18164K/26612K, paused 7ms+5ms, total 79ms
    WAIT_FOR_CONCURRENT_GC blocked 25ms
    ** Activity (main) Pause, UserClosed = false **
    PackageAdded: package:B4A.software
    Copying updated assets files (46)
    ** Service (starter) Create **
    ** Service (starter) Start **

    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    ** Service (firebasemessaging) Create **
    ** Service (firebasemessaging) Start **

  7. Erel

    Erel Administrator Staff Member Licensed User

    There is no error in both logs.

    Worth testing it with a new Firebase app with a different package name.
  8. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User


    I have the same problem as described above:

    - firebase messaging runs fine
    - firebase storage runs fine
    - crash reporting runs fine

    but when I do this:

    'test analytics
    Dim parameters As Map
    parameters.Put("version", NameVersion)
    parameters.Put("date", DateTime.Date(DateTime.Now))
    parameters.Put("time", DateTime.Time(DateTime.Now))
    analytics.SendEvent("test", parameters)

    nothing to see in the firebase console........

    I also noticed an interaction between the "starter" service and receiving messages:

    when you switch off the phone and send messages to the phone, those messages are waiting on the server for delivery to the phone.

    when you switch on the phone, the messages are delivered as soon as the phone makes contact with the internet.

    So, firebasemessaging starts the app, but that causes starter to run first.

    And that sequence results in the loss of 1 message!!!

    Note however that this is due to the underlying gcm-system: I have an app running with google gcm and that has the same problem.
    Last edited: Oct 18, 2016
  9. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    Push messages are not related to this thread.

    1. Monitor the unfiltered logs. There might be more information about the missing events.

    2. Test it with this event:
    analytics.SendEvent("search", CreateMap("search_term""test"))
  10. daniel69

    daniel69 Member Licensed User

    Hi Erel, thank you for your suggestion .. maybe before I'll try with a different event ...
  11. daniel69

    daniel69 Member Licensed User

    Hi Erel, today for the first time I can see the stats (relative to today, October 19th 12:00 AM), and nothing about the previous days (it looks like it started to collect data after some days: about 2 weeks!
  12. daniel69

    daniel69 Member Licensed User

    Hi Erel, with another app it took about 24 hours to see the first stats ... most likely the stats of the other app (app name with capital letters) was fixed by firebase support ...
  13. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User


    a question: is FirebaseAnalytics also working if one is using no starter service?

    I've included the code for FirebaseAnalytics in a service that is always running.

    Now it seems that fatal errors in this service are correctly reported but fatal errors in other services and activities are not reported!

    Or should I include FirebaseAnalytics in all services and activities when not using the starter service?
  14. Erel

    Erel Administrator Staff Member Licensed User

    Why aren't you using the starter service? It will only make your code simpler.
  15. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User

    Indeed, using the starter service would make my code a lot simpler.

    Unfortunately, there is an interaction between firebasemessaging and the starter service:

    - one sends a message to the phone while the phone is switched off
    - switch on the phone
    - the message is received by the phone and the app is automatically started by Android
    - now it seems to be that starting the service that handles the incoming firebase message causes the starter service to start and somewhere in this process, the message is lost.

    Note that this seems to be not specific for firebase messaging because I've seen the same effect happen using google GCM

    In a nutshell, that's the reason for not using the starter service...
  16. Erel

    Erel Administrator Staff Member Licensed User

    I'm not familiar with this issue. Many developers use push notifications with the starter service and as far as I remember you are the only one to report such issue.

    It is better to start a new thread and explain the issue.
  17. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User

    I will test the issue again, one never knows if something has changed, and start a new thread if the issue is still the same
  18. Alpandino

    Alpandino Member Licensed User

    So I must use a "Prescribed parameters" (as "search_term") in order to see the result in the firebase analytic console?
    I'm sending a lot of events with associated parameters but I can't see anything......
  19. Erel

    Erel Administrator Staff Member Licensed User

  20. Alpandino

    Alpandino Member Licensed User

    Thank you Erel.
    I logged the "search" event with the standard parameters "search_term". In the console I can see the "search" event, but I can't see the parameter. This is a limit of firebase console as reported here: https://groups.google.com/forum/#!topic/firebase-talk/W9w-YKkW4fc
    Here you can read: "Currently, not all suggested events provide parameter reporting, but we aim to add parameter reporting to all of them. In the meantime, your best options for viewing parameter reporting on these is to either use a different event (like select_content) or to view your data in BigQuery."
    I'll try the event "select_content"...

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice