Android Google Play Services fixes

Discussion in 'Tutorials' started by Appsurd, Mar 18, 2019.

  1. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    Google Play Services fixes for GMS 1.4 and 2.2 for Android


    GM version: GM: Studio 1.4.9999 Standard (2018-08-30) and GM Studio 2.2.1 Mobile (2018-12-05)
    Target platform: Android
    Download: https://appsurdgames.com/tutorials.html
    Links: N/A
    Latest change: 2019-03-18
    Level: Advanced



    Summary

    In this small tutorial, we will present a few fixes for the Google Play Services asset. Specifically, the fixes are for version 3.0.1 from May 17, 2018, made by YoYo Games, which is downloadable for free on the Marketplace: https://marketplace.yoyogames.com/assets/2008/google-play-services. We present fixes for local/remote push notifications for GMS 1.4 and 2.2, improve the white rectangular notification icons when using Firebase for GMS 1.4 and changing the standard errors of logging in to Google Play Games for GMS 1.4 and 2.2. Moreover, we show a way for handling logins differently for GMS 1.4 and 2.2. The extension itself can be downloaded from https://appsurdgames.com/tutorials.html.

    Table of contents

    Problem 1: Local and remote push notifications do not work while using SDK 26 or up as maximum SDK
    Problem 2: I have GMS 1.4 and I experience white rectangular notification icons from my app
    Problem 3: I do not like the standard ‘failed-to-login’ Google Play Games messages
    Problem 4: I do not like the Toast message when a rewarded video ad has been watched
    Improvement 1: I do want to want to automatically login users for GPG
    Conclusion
    Frequently Asked Questions
    Changelog

    Introduction

    Google Play Services are an interesting feature for Android games to keep users interacted with each other using highscore lists, achievements and more. YoYo Games has provided an extension for this, however, it is outdated. It is not expected to be updated before Q3 2019: https://help.yoyogames.com/hc/en-us/articles/231719448-GMS2-Roadmap. Therefore we decided to write some step-by-step guides to improve / change some functionality of the asset. You do not need any Java knowledge, just follow the steps! In order to be prepared to understand this tutorial, I assume you have read https://help.yoyogames.com/hc/en-us/articles/360004274212-Android-Google-Play-Services-Logging-In about logging in to the Google Play Services.


    Problem 1: Local and remote push notifications do not work while using SDK 26 or up as maximum SDK

    Introduction
    Do you want to know how Push Notifications work? Then please read our tutorial: https://forum.yoyogames.com/index.php?threads/push-notifications-on-android.13769. In the GooglePlayServicesExtension, there is a Java class which sends the notifications. This is old / deprecated code, which doesn't work anymore when you select an API level which is 26 or up. Above API 26, it is obligatory to make use of “Channels” which is not incorporated in YoYo’s version. For API 25 and below, the functionality still works because of Google's backward compatibility policy. However, as you currently need to select API 26 or up to be able to create or update your app, it is very important to find a solution for this, which we did!

    What did you do?
    Warning, technical stuff coming up :) I created a channel which contains a channelId and a channelName. The channelId is the ID of the channel and the channelName is the name of the channel, which you can edit on lines 479 and 480 in GcmPush. Please note that the channelName is visible to users, so choose it wisely! (Perhaps the name of your app/game, or something like ‘Daily challenge’, or ‘General’). Most apps have notifications for multiple purposes, so they categorize these messages. This extension supports only one channel so ‘General’ or your app name would be a good choice. In the current (YoYo Games) extension, when the notification is created, only a so-called content is created. This is deprecated, you are now expected to deliver a channelId as well. This updated version of the GcmPush should solve this.

    Unfortunately, we need to do more work. The moment the app receives a notification, it creates a 'lock' such that the phone doesn't fall asleep. Then the notification icon is created and shown. Afterwards, the lock is removed. API 26+ has deprecated this 'lock', such that the code was completely ignored. Locking is simply not allowed anymore. To solve this, I decided to use JobScheduler to receive and handle the notification. You can read more information on how it works here: (https://medium.com/google-developers/scheduling-jobs-like-a-pro-with-jobscheduler-286ef8510129). I couldn’t reuse GcmIntentService so I had to make a new class because some different injections in the manifest were required. The only solution was to create a new Java file, which handles the notification correctly.

    Overview
    Added:
    • GcmJobService.java
    Updated:
    • GcmBroadcastReceiver.java
    • GcmPush.java
    Removed/deprecated:
    • GcmIntentService.java

    What do I need to do?
    When you already have the GooglePlayServices extension, make sure to remove it first and clean your cache. This is very important since GameMaker won’t notice when you replace an extension. Then download our Marketplace asset from https://appsurdgames.com/tutorials.html and add it to your project.

    Then go to the directory where the extension is located, which is "project.gmx/extensions/GooglePlayServicesExtension/AndroidSource/Java". Then go to lines 479 and 480 in GcmPush and change the channelName to something else. We recommend to change its value to ‘General’ or to the name of your app.

    When you download and inspect our code, you will notice one extra thing. Every notification has a group key. Therefore we added a summary notification, which combines each notification with the same group key. This is useful because you generally don’t want to receive every notification separately. This is done automatically (in our version), so you don’t need to edit things here.

    Conclusion
    Now you are done! All local and remote push notifications should be working again! Please report to us if it doesn’t work for you, so we can have a look at it.


    Problem 2: I have GMS 1.4 and I experience white rectangular notification icons from my app

    Introduction
    If you are still using GCM (Google Cloud Messaging) for push notifications, you will see colorful icons. However, this service is deprecated and will be shut down in April 2019. You can read more information on GCM here: https://developers.google.com/cloud-messaging/faq.

    Push notifications should be implemented using Firebase. You should create a new Firebase account (or login with your existing one) and add your app. The required API’s will automatically be added to your project on Google Cloud Platform (https://console.cloud.google.com/apis/). More information about push notifications can be found in our tutorial: https://forum.yoyogames.com/index.php?threads/push-notifications-on-android.13769.

    This all works great, but the only problem is the notification icon design. The following text was extracted from the official Android documentation: “Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.”

    GameMaker Studio simply takes the application icon as push notification. There is no way in GameMaker Studio to add a custom icon for the notification, so we have come up with a new method to fix this.

    What did you do?
    I tried to add custom icons to the APK file but that didn’t work. Also trying injecting the icons in the cache folder doesn’t work either. But then I found this article for GMS 2: https://help.yoyogames.com/hc/en-us/articles/360012115932-Android-How-To-Add-Adaptive-Icons-into-Projects-Made-with-GMS2-v2-1-5-or-v2-2-0 which shows a way to add adaptive icons to your APK file. I tried to do it the same way as described in the article with success! Now I was able to link to the custom files in the Java code in the extension.

    What do I need to do?
    Go to your GameMaker installation folder: “..\gamemaker_studio\Android\runner\ProjectFiles\src\main\res”. I’m using Steam and for me it was: “C:\Program Files (x86)\Steam\steamapps\common\gamemaker_studio\Android\runner\ProjectFiles\src\main\res”.

    Then you need to add the following folders:
    • drawable-mdpi-v4
    • drawable-hdpi-v4
    • drawable-xhdpi-v4
    • drawable-xxhdpi-v4
    • drawable-xxxhdpi-v4
    In each folder, you need to place an icon named “ic_notification.png”. This icon must be transparent! This means every pixel you place in the icon will be white. Make sure you remove the pixels you don’t want to see on the icon. Sizes of the icons are as follows:
    • mdpi 24px
    • hdpi 36px
    • xhdpi 48px
    • xxhdpi 72px
    • xxxhdpi 96px
    After you have added all icons, it is time to build your app. The folders containing the icons will be placed inside the cache of your GMS project. This means you can remove them from the installation folder after you built your app. BUT if you clean the cache of your project, you need to add them again and build the app again. WARNING: the installation folder is the same for every project. When you open another project, you have to remove the created folder structure or that project will get the same icons!

    You also need to change some lines in the Google Play Services extension. First download our Google Play Services Extension, and open GcmPush.java. Then scroll down to line 490 and 499. Change “R.drawable.icon” to “R.drawable.ic_notification” (or use the commented code). With this code, you are telling the notification it needs to use your custom icon.

    We just changed the icon and now we need to change this in the manifest as well. Right-click Extensions->GooglePlayServicesExtension in your project, open the Android tab, and insert the following code into the manifest under Application level:

    Code:
    <meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_notification" />
    
    Conclusion
    This is not a clean fix, however it is a possible method to get the right notifications. Official implementation needs to be done by YoYo Games, but for now, it could solve your problem. Please report if it doesn’t work for you.


    Problem 3: I do not like the standard ‘failed-to-login’ Google Play Services messages

    Introduction
    In YoYo’s asset, failing to login to Google Play Services pops up a show_message_async() message with some text pre-entered by YoYo Games. Most of the time, this text is “failed to login”. Now, this looks rather ugly and you might not want this. We have fixed this.

    What did you do?
    We changed every call from Java to the internal show_message_async() function into a call to show_debug_message(). This means the information isn’t lost while debugging but is not shown to end-users.

    What do I need to do?
    Nothing, just downloading our asset is enough. You can still use GameMaker’s functions to determine if the login was successful or not.


    Problem 4: I do not like the Toast message when a rewarded video ad has been watched

    Introduction
    In YoYo’s asset, when the user has watched a video advertisement, a Toast message will be displayed. This message contains which reward the player receives. A Toast message is a small popup with a line of text. It is possible to trigger the asynchronous event when a video has been watched. I prefer my own custom message to be displayed at that moment. You can do that inside the asynchronous event. See the official help article here: https://help.yoyogames.com/hc/en-us/articles/360002971751-iOS-and-Android-Google-Mobile-Ads-Setup

    What did you do?
    I found the line of code inside “GooglePlayServicesExtension.java”. I simply commented out line 256.

    What do I need to do?
    Nothing, just downloading our asset is enough. You can still use GameMaker’s functions to handle the completion of the rewarded video. If you in some case want to use this Toast message, then go to line 256 in “GooglePlayServicesExtension.java” and uncomment that line.


    Improvement 1: Google Play Games logs in automatically every time I start my application, and I don’t want that

    Introduction
    As described in https://help.yoyogames.com/hc/en-us/articles/360004274212-Android-Google-Play-Services-Logging-In, you need to handle the logging in into the Google Play Services yourself. However, some players may not want to use the Google Play Services. So when they are asked every time the app launches to login, they may become annoyed about your app and might possibly delete it. To prevent this, one could handle logging in in a different way. You could ask the user to login, and save the result in a variable if they actually logged in.

    What do I need to do?
    When a user opens your application for the first time, you need to try to let the user log in to the Google Play Services. You can do this either by showing a button where the player can click on, or just popup the GPS login by calling achievement_login(). Then, after a second or 2, you need to check whether the player is actually logged in or not. Then create a variable (for example global.googleplayservices) whether the player has logged in or not. Save the variable in your (local) settings file.

    On the next launch of your app, check the content of global.googleplayservices (which you need to load from your save file first) and based on that, try to login to Google Play Services or not.

    Conclusion
    Now you are done! You have gained more control (and more comfortability for the user) how and when the login to the Google Play Services takes place.


    Conclusion
    Hopefully you learned how you can change the Java files of YoYo’s Google Play Services extension from the official Marketplace in such a way that it does exactly as you want! If you have more ideas or other problems, you can always post them below and we’ll see if we can do anything about it.

    We will keep an eye on the developments by YoYo Games and Google, and will update / change / remove parts of this tutorial whenever necessary. Please feel free to comment on or post any ideas or relevant stuff on the topic below, we might have some time to answer them or discuss about it.


    Frequently Asked Questions

    Did you mention this to YoYo Games?
    Yes, I send in a bug report. Problem 2 is unlikely to be fixed, as they are not updating GMS 1.4 anymore. For problem 3 and 4, the behavior is probably intentional, and they will therefore not change its feature. For problem 1, YoYo Games should fix this as soon as possible.

    Why did you not upload the extension on the Marketplace?
    Unfortunately, due to some problems regarding uploading GMS 1.4 assets, we decided to not use the Marketplace. In the future, when the tutorial is updated for GMS 2, this will definitely something which we'll consider.

    Changelog

    Changelog, huh? Yes, it’s actually just for me to check when and what I changed in the tutorial. Any people contributing something will be added too. :)

    2019-03-18
    First English version of the tutorial was written.
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,036
    Though I don't depend on this extension myself, I applaud your efforts in investigating this long-standing issue and documenting a manual fix. This is a serious indictment on YoYo's efficacy as an official API integration vendor, that an ordinary community member would best a team of 50+ in fixing a key business use case.
     
    CombatCalamity and TheMagician like this.
  3. mootaz azaiez

    mootaz azaiez Member

    Joined:
    Jun 6, 2017
    Posts:
    26
    when i try to import the extension to gamemaker 2.2.1.375 it says "failed to verify the package" !
     
  4. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    We are currently investigating the issue. We have confirmed all went well for GMS 1.4, and hopefully we can find a solution for GMS 2 this weekend.
     
    mootaz azaiez likes this.
  5. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    277
    This comment is not related with the tutorial but I just wanted to write it here.

    For the notification part, you can use my extension (Firebase Cloud Messaging, I'll release it this saturday).

    You guys are worrying about notification icon; while I'm just showing up by
    1- Downloading an external image for the Big Picture of the notification.
    2- Set custom intents with the notification so that I can do some cool stuff it with it (Rewarding a player if they open the notification for ex.)
    3- Get the Analytical data of how many people received the notification and how many of them actually opened it.

    It's all FREE & Well Documented & Open Source(GitHub)


    Check GMDevBlog
     
    Last edited: Mar 19, 2019
  6. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    @Mert Thanks! Upon release, we will investigate your extension and possibly adjust / change / remove parts of this tutorial.

    GMS2 users: sorry we couldn't fix the issues immediately. Further investigation will take place this weekend.
     
    Mert likes this.
  7. mootaz azaiez

    mootaz azaiez Member

    Joined:
    Jun 6, 2017
    Posts:
    26
    hello ! do you guys still didnt fix the issue ?
     
  8. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    Unfortunately, no. We do not own a copy of GMS2, making testing rather difficult. Moreover, it appears YoYo has been working on the Google Play Services asset for GMS2. For the time being, we are waiting for YoYo to complete their work and possibly change this tutorial accordingly.
     
    Last edited: Apr 1, 2019
    mootaz azaiez likes this.
  9. Speederman

    Speederman Member

    Joined:
    Jun 23, 2016
    Posts:
    39
    Hi, Mert. Any news on the Firebase Cloud Messaging extension you were going to release?

    Thanks.
     
  10. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    277
    Sorry for the delay, had really busy weeks. The extension is finished, but I need to write the documentation as there are things that needs to be explained.
    I'll probably release Firebase Performance Monitoring tomorrow along with it.
     
  11. Jaime Lpz

    Jaime Lpz Member

    Joined:
    Aug 3, 2016
    Posts:
    15
    Hi Appsurd!

    Thanks so much for sharing and keeping these extensions updated. You saved my apps life with now being able to send local push notifications using SDK 26 or later :)

    I have another question, not sure if this is addressed in the Google Play Services extension. I may be doing something incorrectly -

    I have a leaderboard, which stopped working after Google depreciated Google+ - The leaderboard no longer shows, and I get a debug error stating the user is not logged in. Does your extension work with the new Google Sign in, or does it still rely on Google+ for leaderboard/achievements?

    Hope I am making sense here, thanks!
     
    mootaz azaiez likes this.
  12. sirano123

    sirano123 Member

    Joined:
    Aug 28, 2018
    Posts:
    5
    Since I can't import your extension to GMS 2, I tried commenting the line 256 to solve problem 4, however that line seems empty.
    Here's the part of the code from the extension
    Code:
    252:    @Override
    253:    public void onConnected(Bundle connectionHint)
    254:    {
    255:    }
    256:
    257    public double GooglePlayServices_Status()
    258:    {
    259:        return (double)GooglePlayServicesUtil.isGooglePlayServicesAvailable(RunnerJNILib.ms_context);
    260:    }
    
    Are you using the same version as the one yoyo games is using.
     
  13. Adriano_ppaula

    Adriano_ppaula Member

    Joined:
    Jun 22, 2017
    Posts:
    17
    Does anyone know if cloud save is working properly?

    I followed all the tutorials and made all the changes perfectly, it was working because after a while new users of my game reported that it is not working :/
    I use GM 1.4
     
  14. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    Unfortunately, it works with the Google+ login at the moment. We are currently trying to remove the Google+ functionality. Hopefully we can provide a solution within a week.

    No. We were, until YoYo Games decided to update the GMS2 version of the Google Play Services extension two weeks ago. For example, you now need to include Push Notifications by downloading a separate extension.
     
  15. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    277
    @Appsurd Oh, don't forget

    GoogleMobileAds_ConsentSetAllowPersonalizedAds(false) > GETS YOU PERSONALIZED AD
    GoogleMobileAds_ConsentSetAllowPersonalizedAds(true); > GETS YOU NON-PERSONALIZED AD

    The thing works in wrong order I suppose.
     
    Justice likes this.
  16. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    @Mert Never seen that before... We will take a look at it, thanks for mentioning!

    By the way, you were creating an extension for this as well, right? Any updates on that?
     
  17. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    277
    I was actually halted that one, decided to examine Yoyogames' extension. It's just finished but requires a good/smooth video. I'm almost completed Firebase Crashlytics extension. Awesome and good looking!
     
  18. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    277
  19. Adriano_ppaula

    Adriano_ppaula Member

    Joined:
    Jun 22, 2017
    Posts:
    17
    Hello @Appsurd How are you doing? I hope that well ^^

    So I wanted to share a modification I made can help you.
    I do not know if it's true, but in my case it solves perfectly!


    A few months ago, I noticed that for GM 1.4 some google play service functionality was not working. This is due to the fact that google has removed the google + API. I needed the save cloud to work properly. So I started to study google documentation for a response.

    Remove the Google + API login as follows.

    Exetensions / Open in explore (right-click on the extension)

    Edit file
    GooglePlayServicesExtension \ AndroidSource \ Java \ GooglePlayServicesExtension.java


    Remove this line - line 78
    Code:
    import com.google.android.gms.plus.Plus;
    
    Search for this part in code - Line 170
    Code:
    // Initialise sign in client
    GoogleSignInOptions.Builder optionsBuilder = new GoogleSignInOptions.Builder (GoogleSignInOptions.DEFAULT_SIGN_IN);
    optionsBuilder.requestScopes (Games.SCOPE_GAMES, Plus.SCOPE_PLUS_LOGIN);
    optionsBuilder.requestProfile ();
    
    // Update scopes for cloud saving
    RunnerActivity.CurrentActivity.mYYPrefs.getBoolean ("Debug");
    mCloudServicesEnabled = RunnerActivity.CurrentActivity.mYYPrefs.getBoolean ("YYGoogleCloudSavingEnabled");
    if (mCloudServicesEnabled)
    {
    optionsBuilder.requestScopes (Drive.SCOPE_APPFOLDER);
    }
    
    And substitute for this part
    Code:
    // Initialise sign in client
    GoogleSignInOptions.Builder optionsBuilder = new GoogleSignInOptions.Builder (GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
    optionsBuilder.requestScopes (Drive.SCOPE_APPFOLDER);
    optionsBuilder.build ();
    
    // Update scopes for cloud saving
    RunnerActivity.CurrentActivity.mYYPrefs.getBoolean ("Debug");
    mCloudServicesEnabled = RunnerActivity.CurrentActivity.mYYPrefs.getBoolean ("YYGoogleCloudSavingEnabled");
    if (mCloudServicesEnabled)
    {
    optionsBuilder.requestScopes (Drive.SCOPE_APPFOLDER);
    }
    

    I followed the google site data to base myself on this modification and remove the google + API login from the GM 1.4 extension: https://developers.google.com/games/services/android/savedgames


    I do not know if it will help, but it worked perfectly with me. The save cloud for new users of my game now works perfectly! I am very happy!

    Additional build info
    Code:
    Buid Tools: 28.0.3
    Support LIb: 28.0.0
    Target SDK 18
    Min SDK: 16
    Compile SDK: 18
    
    Java JDK: 1.8.0_202
    Android NDK: android-ndk-r19c
    
    
     
  20. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
  21. Adriano_ppaula

    Adriano_ppaula Member

    Joined:
    Jun 22, 2017
    Posts:
    17
    Hello!
    Can you tell if the achievement_show_achievements() and achievement_show_leaderboards() functions are currently working on GM14?

    I'm not getting the google overlay screen to appear. :(

    I also noticed that the achievements did not appear notification. That is, no interaction with google UI is working T_T
     
  22. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    Certainly, they are so easy to use that nothing can go wrong, except for the user not being logged in. Reading your previous post, this is however strange. Could you check whether the user is logged in?
     
  23. Charzendat

    Charzendat Member

    Joined:
    Nov 4, 2016
    Posts:
    7
    Hi.
    I am trying to get IAPs working in my game and am running 1.4.9999. Saw that I needed Google Play Services Extension and this was the only 1.4 version I could find so I've installed it (marketplace only seems to have it for GMS2). App builds fine without the extension, but with it I get 11 errors.


    Code:
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:10: error: cannot find symbol
    import android.support.v4.app.JobIntentService;
                                 ^
      symbol:   class JobIntentService
      location: package android.support.v4.app
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:25: error: cannot find symbol
    public class GcmJobService extends JobIntentService 
                                       ^
      symbol: class JobIntentService
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:34: error: method enqueueWork in class GcmJobService cannot be applied to given types;
            enqueueWork(context, GcmJobService.class, NOTIFICATION_ID, intent);
            ^
      required: Context,Intent
      found: Context,Class<GcmJobService>,int,Intent
      reason: actual and formal argument lists differ in length
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:44: error: cannot find symbol
            super.onCreate();    //crashes if we don't do this...nice!
            ^
      symbol:   variable super
      location: class GcmJobService
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:59: error: method does not override or implement a method from a supertype
        @Override
        ^
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:62: error: incompatible types: GcmJobService cannot be converted to Context
            GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
                                                                        ^
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:157: error: cannot find symbol
                        GcmPush.storeMessage( getApplicationContext(), GcmPush.PUSH_EVENT_REMOTE, json);
                                              ^
      symbol:   method getApplicationContext()
      location: class GcmJobService
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:167: error: cannot find symbol
                            GcmPush.sendNotification( getApplicationContext(), notTitle, notMessage );
                                                      ^
      symbol:   method getApplicationContext()
      location: class GcmJobService
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmJobService.java:176: error: cannot find symbol
                                GcmPush.sendNotification( getApplicationContext(), notTitle, notMessage );
                                                          ^
      symbol:   method getApplicationContext()
      location: class GcmJobService
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmPush.java:489: error: constructor Builder in class Builder cannot be applied to given types;
            Notification notification = new NotificationCompat.Builder(context, channelId)
                                        ^
      required: Context
      found: Context,String
      reason: actual and formal argument lists differ in length
    Z:\com.COMPANY.APPNAME\src\main\java\com\COMPANY\APPNAME\GcmPush.java:498: error: constructor Builder in class Builder cannot be applied to given types;
            Notification summaryNotification = new NotificationCompat.Builder(context, channelId)
                                               ^
      required: Context
      found: Context,String
      reason: actual and formal argument lists differ in length
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
    11 errors
    :com.COMPANY.APPNAME:compileReleaseJavaWithJavac FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':com.COMPANY.APPNAME:compileReleaseJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    
    I recently udated my android SDK and am running Java 1.8.0_131. If anybody has any advice it would be appreciated. Thank you.
     
  24. Appsurd

    Appsurd Member

    Joined:
    Jun 20, 2016
    Posts:
    213
    For which API version are compiling? And which build tools do you use?

    I would also like to point out from the 1.4.9999 Required SDK page:
    In other words, from August, 2019, it is necessary to use GMS2 to publish / update games on the Play Store. I would advice you (if you want to publish) to port your project to GMS2.
     
  25. Charzendat

    Charzendat Member

    Joined:
    Nov 4, 2016
    Posts:
    7
    Hmmmm... Thank you for letting me know that 1.4 android will no longer be possible to publish to Android with. I'll port it to GMS2 and try with that.
     
    Appsurd likes 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