Saturday, 29 August 2020

OneSignal: push notification doesn't work

I have this app and I want to send push notifications from my admin panel. I think I did everything OK, but OneSignal detects my app installed only when I install it in my emulator, but when I install the apk on my phone, it doesn't detect that. I have an android 10 phone. Here are my files:

build.cradle (app):

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 (project):

// 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" }
    }
}


from OneSignal: push notification doesn't work

No comments:

Post a Comment