3

I'm trying to implement App Invites in our application, but I can't get the iOS clients to link to the App Store. They always show the Play store link.

According to the documentation, we need to call setOtherPlatformsTargetApplication if we have more than one iOS client id in our project in developers console. The thing is, if I try to add our iOS app client id, the email is never sent

.setOtherPlatformsTargetApplication(PROJECT_PLATFORM_IOS,
                    "104XXXXXXXXXX-i089XXXXXXXXXXXX.apps.googleusercontent.com")

If I omit this call, the email is sent but it points to Play store.

Anyway, inspecting google-services.json only shows one iOS client id

{
    "project_info": {
        ...
    },
    "client": [
        {
            "client_info": {
                "package_name": "com.mycompany"
            },
            "oauth_client": [
                ...
            ],
            "api_key": [

            ],
            "services": {
                "appinvite_service": {
                    "status": 2,
                    "other_platform_oauth_client": [
                        {
                            "client_id": "XXXXXX-YYYYY.apps.googleusercontent.com",
                            "client_type": 2,
                            "ios_info": {
                                "bundle_id": "com.mycompany.app",
                                "app_store_id": "123456789"
                            }
                        },
                        {
                            "client_id": "XXXXXX-JJJJJJJJ.apps.googleusercontent.com",
                            "client_type": 3
                        }
                    ]
                }
            }
        },
        [
            another client info for the debug package name
        ],
        "client_info": [

        ],
        "ARTIFACT_VERSION": "1"
    }

I don't know what else I can try, any idea is welcome

I'm using AS 2.0 preview 9, and 2.0.0-alpha9 versions for android and google-services' gradle plugin. Also, as stated in the documentation, I've placed the apply plugin at the bottom of app/build.gradle

Maragues
  • 37,861
  • 14
  • 95
  • 96

1 Answers1

1

The problem was that I had 2 credentials that shared the same Bundle ID.

Furthermore, the most recently added (and the only one listed in google-services.json) was not being used. Once I deleted it, the real credential was added to the json file and the call to setOtherPlatformsTargetApplication worked just fine.

Maragues
  • 37,861
  • 14
  • 95
  • 96
  • Can you share your google-service.json structure, where iOS app is working? – qpator Nov 17 '16 at 17:58
  • the google-services.json is in the question, I didn't have to change the structure, only the client_id. Anyway this is 9 months old now and invites was in beta, maybe they've changed something. To start with, it looks like it's been integrated into Firebase. I've tested on my app (old project I no longer work on) and the link generated for the email seems to work fine on apps but not when opened from desktop browser. – Maragues Nov 18 '16 at 15:27