【问题标题】:Meaning of implementation project(':urbanairship-fcm')实施项目的意义(':urbanairship-fcm')
【发布时间】:2019-05-02 05:04:55
【问题描述】:

我在阅读 https://github.com/urbanairship/android-library 时发现了这个:

dependencies {
    ...
    // Urban Airship SDK - FCM
    implementation 'com.urbanairship.android:urbanairship-fcm:9.7.1'
}

https://github.com/urbanairship/android-library 的示例项目中,他们正在使用这个:

dependencies {
    ...
    // Urban Airship - FCM
    implementation project(':urbanairship-fcm')
    ...
}

我希望示例项目具有implementation 'com.urbanairship.android:urbanairship-fcm:9.7.1' 而不是implementation project(':urbanairship-fcm')'project(:urbanairship-fcm') 是指包含urbanairship-fcm 库/代码的文件夹吗?是指这个文件夹吗?:https://github.com/urbanairship/android-library/tree/master/urbanairship-fcm

谢谢。

更新 1: 基本上,我熟悉这种语法:implementation 'com.urbanairship.android:urbanairship-fcm:9.7.1'。我不熟悉这种语法:implementation project(':urbanairship-fcm')。如果我理解正确,implementation project(':urbanairship-fcm') 意味着有一个名为urbanairship-fcm 的文件夹包含com.urbanairship.android:urbanairship-fcm 库的源代码。对吗?

【问题讨论】:

    标签: android push-notification firebase-cloud-messaging urbanairship.com android-push-notification


    【解决方案1】:

    当您看到implementation project(':urbanairship-fcm') 时,这意味着它是从本地模块而不是远程包中提取的。该示例设置为使用库源,因此我们可以使用示例应用来测试我们的开发更改。

    【讨论】:

    • 谢谢 Ralepinski。在github.com/urbanairship/android-library 中使用会不会更好,像这样?:implementation 'com.urbanairship.android:urbanairship-fcm:9.7.1'。我想知道 implementation project(':urbanairship-fcm') 使用的是什么版本的 Airship。希望不是旧版本,因为我想使用版本 9.7.1 测试我的项目,如果不是最新版本,它是今天可用的最新版本之一。
    • 如果您从 repo 中提取,它始终使用最新版本 - github.com/urbanairship/android-library/blob/master/…。版本 9.7.1 是最新的。
    • 太棒了!谢谢。
    【解决方案2】:

    https://github.com/urbanairship/android-library/tree/master/sample 的示例项目已过时。例如,https://github.com/urbanairship/android-library/blob/master/sample/src/main/java/com/urbanairship/sample/SampleAutopilot.java 的 Autopilot 最后一次更新是在 2018 年 1 月 29 日。它不包含 Airship 在https://docs.airship.com/platform/android/getting-started/#sdk-installation 提到的以下代码:

    // Android O
      if (Build.VERSION.SDK_INT >= 26) {
          Context context = UAirship.getApplicationContext();
          NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    
          NotificationChannel channel = new NotificationChannel("customChannel",
                  context.getString(R.string.custom_channel_name,
                  NotificationManager.IMPORTANCE_DEFAULT);
    
          notificationManager.createNotificationChannel(channel);
      }
    

    所以我最好联系 Airship 支持以请求更新版本的示例项目或跟进,因为我无法使用非常旧的示例项目作为参考。事实上,查看https://github.com/urbanairship/android-library/blob/master/CHANGELOG.md,2019 年 1 月 28 日,当时可用的最新 Urban Airship SDK 是“版本 8.9.7 - 2018 年 1 月 22 日”。我看不出该项目如何整合当今可用的最新 google-services、play-services 和 Firebase 版本。

    【讨论】:

    • 示例项目是最新的并且工作正常。 UA SDK 定义了一个默认通道,因此您没有定义它。我看到文档对此感到困惑,因此我将对其进行更新。
    猜你喜欢
    • 2011-09-26
    • 1970-01-01
    • 2016-04-18
    • 2018-05-30
    • 2022-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-03
    相关资源
    最近更新 更多