Android Gradle build with Google Firebase

Discussion in 'GameMaker Studio 2 Community Tech Support' started by clee2005, Jun 22, 2018.

  1. clee2005

    clee2005 Member

    Joined:
    Jun 25, 2016
    Posts:
    169
    I managed to get Firebase Crashlytics to build but I have to put the "google-services.json" in the android/runner/project folder for it to get picked up by the build. This is fine for this one app... I'd rather not have to switch this file out for each build of different apps. Is there a place to put this file where it will belong to the GMS2 project and get seen by the Gradle build?

    Thanks,
    Chris
     
  2. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    132
    I'll just up this topic, exactly needed
     
    Animus Audax likes this.
  3. clee2005

    clee2005 Member

    Joined:
    Jun 25, 2016
    Posts:
    169
    I have another issue where I have api_key.txt for Amazon Login. I'm using it for Amazon Underground and Amazon App store. I need to swap this file out in the Included Files folder of the IDE before each build since it's the same filename. What would be nice is a pre-build macro or process that could be kicked off... simple as executing a batch file or something before the build is run ... this could solve both problems and many others I'm sure.
     
  4. Animus Audax

    Animus Audax Member

    Joined:
    Nov 27, 2018
    Posts:
    2
    Anybody solved this issue with swapping "google-services.json" ?
    Maybe it's possible to change names that Firebase is looking for?
     
  5. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    132
    I've successfully ported Crashlytics and Performance Monitoring along with Remote Configurations, Analytics and Firestore. Also be impletementing Machine Learning kits once I have some free time.

    Currently, there's no way to change google-services.json file on GMS2 IDE. You'd have to manually put it on (The folder is for me, but should be same for you too) Program Data folder is hidden, so you have to set Windows to see hidden files.

    C:/Program Data/GameMakerStudio2/Cache/runtimes/runtime-2.2.0.261/android/runner/ProjectFiles/

    Check the runtime you use on GMS2 IDE, that's the folder you're going to put it on.
     
    Animus Audax likes this.
  6. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    132
    ++
    Things so far I've discovered.

    ANALYTICS
    When I switch to another room in my app, Firebase logs that as "user_engagement" as if it switches to another Activity. (perhaps it does). I want to set the current screen to log in Firebase, but Game Maker creates random screen ID for each room, just makes the analytics too unreadable for this. Firebase docs implies that you can set screens manually, but has to be called from Main Thread. Here's how I did that. Put it on Room's Creation Code.

    AnalyticsSetCurrentScreen("Main Menu"); for example

    mFirebaseAnalytics is set when I call the function AnalyticsInit
    Code:
    public void AnalyticsSetCurrentScreen(final String arg0) {
         
            RunnerActivity.CurrentActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
              mFirebaseAnalytics.setCurrentScreen(RunnerActivity.CurrentActivity, arg0, null);
            }//public void run() {
            });
        }
    However, it logs two events on analytics. One : When Game Maker changes the room(with random room ID), and this one where you can see screen name properly. Not looks neat, but does the job. Best option is to avoid changing rooms(use one room throughout the game)

    PERFORMANCE MONITORING
    It can track basics, like network timing and the time it takes to open the application etc. I can't do custom traces since Game Maker builds the game with its library, and anything you put on, let's say CREATE EVENT, may be put on another part of the final java file. I'll need more information from Yoyogames about how Yoyogames do these stuff.

    CRASHLYTICS
    Game Maker doesn't use proguard, so I wouldn't need mapping etc. The only issue with this is that we don't have try <> catch <> exception, as Crashlytics can capture exceptions and log those on Firebase panel. Even though I've seen posts from Yoyogames to bring exception to Game Maker, I don't know whether we can use this feature with Crashlytics.

    REMOTE CONFIGURATIONS
    All works perfectly. The only issue is the tiny tiny data conversion issue where Game Maker can only pass either string or double to/from java file. I use long and boolean too. I have Social Async call once the remote configurations are loaded, and can get these values non-async.

    CLOUD MESSAGING
    I've managed to receive Cloud Messages from Firebase panel to Game Maker, but didn't have much time to do further. I'm planning to complete it and get notifications etc.

    CLOUD STORAGE
    Must not be too hard, also on my list.

    I am planning to create a tutorial here. I also currently use Firebase remote configurations and features in my Android app Flax
     
    Animus Audax and Justice like this.

Share This Page

  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