gpt4 book ai didi

android - OneSignal:推送通知不起作用

转载 作者:行者123 更新时间:2023-12-05 00:19:12 26 4
gpt4 key购买 nike

我有这个应用程序,我想从我的管理面板发送推送通知。我认为我做的一切都很好,但是 OneSignal 仅在我将其安装在我的模拟器中时才会检测到我的应用程序已安装,但是当我在手机上安装 apk 时,它不会检测到这一点。我有一部安卓 10 手机。这是我的文件:
build.cradle(应用程序):

buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.8, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
maven { url 'https://maven.google.com' }
}

apply plugin: 'com.android.application'

android {
compileSdkVersion 29
defaultConfig {
applicationId 'ga.nabukoapps.materialwallpaper'

manifestPlaceholders = [onesignal_app_id: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]

minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName '1.0'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
useLibrary 'org.apache.http.legacy'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'com.google.android.gms:play-services-ads:19.3.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.8'
implementation 'com.balysv:material-ripple:1.0.2'
//noinspection GradleDependency
implementation 'com.onesignal:OneSignal:[3.15.0, 3.99.99]'
//implementation 'com.onesignal:OneSignal:3.11.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.bogdwellers:pinchtozoom:0.1'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.karumi:dexter:4.2.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
implementation 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'commons-io:commons-io:2.4'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-analytics:17.5.0'

}

apply plugin: 'com.google.gms.google-services'
build.cradle(项目):
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}

最佳答案

https://stackoverflow.com/a/39283454/8393749
我从未使用过 OneSignal,但出现此问题的原因之一是 应用包名插入正在寻找的是不同的。也许你可以专注于此。
在上面的链接中,您可以将 build.gradle(应用程序级别)文件的一部分作为引用。它提到在 manifestPlaceholders 区域中添加 manifestApplicationId 键和您的应用程序包名称作为值,如下所示:

release {
defaultConfig {
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "22222222-2222-2222-2222-222222222222",
onesignal_google_project_number: "222222222"]
}
}
p.s.如果你没有使用任何风格,也许你应该从你的代码中删除这部分:
productFlavors {
}

关于android - OneSignal:推送通知不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63580625/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com