React-native-onesignal: Google Play μ„œλΉ„μŠ€ 라이브러리 였λ₯˜

에 λ§Œλ“  2018λ…„ 02μ›” 08일  Β·  35μ½”λ©˜νŠΈ  Β·  좜처: OneSignal/react-native-onesignal

μ•ˆλ…•,

λ‚΄ 앱을 OneSignal에 μ—°κ²°ν•  수 μ—†λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€. 앱이 μ„±κ³΅μ μœΌλ‘œ μ»΄νŒŒμΌλ˜μ—ˆμ§€λ§Œ μ•Œλ¦Όμ„ 받지 μ•ŠμŠ΅λ‹ˆλ‹€.

κ΄€λ¦¬μ—μ„œ Users/All Users 둜 μ΄λ™ν•˜λ©΄ 연결이 ν‘œμ‹œλ˜μ§€λ§Œ Google Play services library initialization error. Check for conflicting plugins and make sure "com.google.android.gms.version" is in your AndroidManifest.xml. Check the logcat for more details. λΌλŠ” 였λ₯˜κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.
AndroidManifest.xml 에 μžˆλŠ” android/app/build/intermediates/manifests/full/debug ν–ˆκ³  κ±°κΈ°μ—μ„œ com.google.android.gms.version 메타데이터λ₯Ό λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

이 문제λ₯Ό ν•΄κ²°ν•˜λŠ” 방법에 λŒ€ν•œ μ œμ•ˆ 사항이 μžˆμŠ΅λ‹ˆκΉŒ?

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

예, κ·Έλ ‡μŠ΅λ‹ˆλ‹€. μŠ€ν¬λ¦°μƒ·μ„ μ œκ³΅ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

image

image

λͺ¨λ“  35 λŒ“κΈ€

κ·€ν•˜μ˜ μž₯μΉ˜κ°€ OneSignal의 λŒ€μ‹œλ³΄λ“œμ— ν‘œμ‹œλ©λ‹ˆκΉŒ?

예, κ·Έλ ‡μŠ΅λ‹ˆλ‹€. μŠ€ν¬λ¦°μƒ·μ„ μ œκ³΅ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

image

image

문제 해결됨. μΆœμ‹œλ₯Ό μœ„ν•΄ 앱을 λΉŒλ“œν•΄μ•Ό ν•œλ‹€λŠ” 사싀을 λͺ°λžμŠ΅λ‹ˆλ‹€. 디버그 λ¦΄λ¦¬μŠ€μ—μ„œ 이것을 ν…ŒμŠ€νŠΈν•  수 μžˆλŠ” 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

μ—…λ°μ΄νŠΈ - μ§„μ§œ μ΄μœ λŠ” μ•Œλ¦Ό μˆ˜μ‹  κΆŒν•œμ΄ μ—†μ—ˆκΈ° λ•Œλ¬Έμ΄λΌλŠ” 것을 μ•Œκ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ”°λΌμ„œ λ™μΌν•œ λ¬Έμ œκ°€ λ°œμƒν•˜λŠ” 경우 AndroidManifest.xml λ‹€μŒ 쀄이 μžˆλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€.

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

λ‚˜λŠ” 같은 λ¬Έμ œκ°€ 있고이 μ½”λ“œλ₯Ό μΆ”κ°€ν–ˆμ§€λ§Œ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€ :-(λ„μ™€μ£Όμ„Έμš”.

같은 문제

@LuckyLuky @wpyar @yaseralimardany 해결책이 μžˆμŠ΅λ‹ˆκΉŒ? 감사..

μ œκ°€ μ œκ³΅ν•œ μ†”λ£¨μ…˜μ΄ μ €μ—κ²Œ νš¨κ³Όμ μ΄μ—ˆμŠ΅λ‹ˆλ‹€.

ν•„μš”ν•œ κΆŒν•œμ΄ ν¬ν•¨λœ 경우 λΉŒλ“œ 쀑에 μƒμ„±λœ AndroidManifest.xml 의 디버그 버전을 ν™•μΈν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. 그렇지 μ•ŠμœΌλ©΄ λͺ¨λ¦…λ‹ˆλ‹€.

같은 문제

@LuckyLuky @yaseralimardany λ‚˜λŠ” 이것을 μ–»μ—ˆμŠ΅λ‹ˆλ‹€. 제 μƒν™©μ—μ„œλŠ” λΉŒλ“œ 버전 λ¬Έμ œμž…λ‹ˆλ‹€ ...
gradle, gmsλ₯Ό μ—…λ°μ΄νŠΈν•œ ν›„ λ§ˆμΉ¨λ‚΄ μž‘λ™ν•©λ‹ˆλ‹€.
λ‘˜ λ‹€ κ°μ‚¬ν•©λ‹ˆλ‹€.

logcatμ—μ„œ λ‹€μŒ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.
E/OneSignal: FCM 토큰을 κ°€μ Έμ˜€λŠ” λ™μ•ˆ μ•Œ 수 μ—†λŠ” 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.
java.lang.NoSuchMethodError: Landroid/support/v4/content/ContextCompat ν΄λž˜μŠ€μ— 정적 λ©”μ†Œλ“œ isDeviceProtectedStorage(Landroid/content/Context;)Zκ°€ μ—†μŠ΅λ‹ˆλ‹€. λ˜λŠ” 슈퍼 클래슀('android.support.v4.content.ContextCompat' 선언은 /data/app/com.motoshubapp-2/base.apk에 λ‚˜νƒ€λ‚¨)
com.google.firebase.FirebaseApp.zzaμ—μ„œ(μ•Œ 수 μ—†λŠ” μ†ŒμŠ€)
com.google.firebase.FirebaseApp.initializeAppμ—μ„œ(μ•Œ 수 μ—†λŠ” μ†ŒμŠ€)
com.onesignal.PushRegistratorFCM.initFirebaseApp(PushRegistratorFCM.java:64)
com.onesignal.PushRegistratorFCM.getToken(PushRegistratorFCM.java:50)
com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.java:97)
com.onesignal.PushRegistratorAbstractGoogle.access$100(PushRegistratorAbstractGoogle.java:37)
com.onesignal.PushRegistratorAbstractGoogle$1.run(PushRegistratorAbstractGoogle.java:84)
java.lang.Thread.run(Thread.java:818)μ—μ„œ

μ‹€μ œ μž₯μΉ˜μ—μ„œ pushToken은 nullμž…λ‹ˆλ‹€. onesignl ν”„λ‘œμ νŠΈμ— 였λ₯˜κ°€ μžˆμŠ΅λ‹ˆλ‹€.

Google Play μ„œλΉ„μŠ€ 라이브러리 였λ₯˜

같은 문제.

μ–΄λ–€ 아이디어?

λ‚˜λŠ” λ˜ν•œ 같은 λ¬Έμ œμ— μ§λ©΄ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

λ‚˜λŠ” 같은 문제λ₯Ό κ°€μ§€κ³ μžˆλ‹€

μ΅œμ‹  λ²„μ „μ˜ onesignal λ¬Έμ œμž…λ‹ˆλ‹€. androidmanifest에 μ•± IDλ₯Ό 넣은 이전 λ²„μ „μž…λ‹ˆλ‹€.

@yaseralimardany λ™μΌν•œ 였λ₯˜μ— μ§λ©΄ν•˜κ³  있으며 ν‘Έμ‹œ 토큰도 nullμž…λ‹ˆλ‹€. μƒˆλ‘œμš΄κ±°μ•Ό??

@LuckyLuky κΆŒν•œμ΄ μžˆμ—ˆκ³  μ—¬μ „νžˆμ΄ λ¬Έμ œκ°€ λ°œμƒν•©λ‹ˆλ‹€.

@adirzoari λΉŒλ“œ 쀑에 μƒμ„±λœ AndroidManifest.xml 의 디버그/릴리슀 버전에 이 κΆŒν•œμ΄ μžˆλŠ”μ§€ ν™•μΈν•©λ‹ˆλ‹€. 그렇지 μ•ŠμœΌλ©΄ λΆˆν–‰νžˆλ„ λͺ¨λ¦…λ‹ˆλ‹€.

react-native-firebaseκ°€ 있고 ν•¨κ»˜ μž‘λ™ν•˜μ§€ μ•ŠκΈ° λ•Œλ¬ΈμΌ 수 μžˆμŠ΅λ‹ˆκΉŒ?

같은 문제

5μ›” 21일에 릴리슀된 μ΅œμ‹  3.2.4 OneSignal SDKκ°€ μžˆλŠ”μ§€ ν™•μΈν•˜κ³  이 μƒˆλ‘œμš΄ μΆ”κ°€ μ„€μ • Gradle ν”ŒλŸ¬κ·ΈμΈ μΆ”κ°€ 단계λ₯Ό λ”°λ₯΄μ„Έμš”.

예, μƒˆλ‘œμš΄ ν”„λ‘œμ νŠΈλ₯Ό μ‹œλ„ν–ˆμ§€λ§Œ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€ :(

여기에 같은 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€ ... xamarinκ³Ό ν•¨κ»˜ onesignal을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

μ—¬κΈ°μ„œ ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€....
Google Play μ„œλΉ„μŠ€ νŒ¨ν‚€μ§€μ™€ onesignal을 μ°¨λ‘€λ‘œ μ œκ±°ν–ˆμŠ΅λ‹ˆλ‹€.
이 ν›„ onesignal을 μ„€μΉ˜ν–ˆκ³  λͺ¨λ“  것이 이제 μž‘λ™ν•©λ‹ˆλ‹€.
μΆ”μ‹ : λΉŒλ“œ ν›„ μƒμ„±λœ μ•„μΉ΄μ΄λΈŒλ₯Ό μ‚΄νŽ΄λ³΄κ³  google play services dll이 μžˆλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€.
P2s: μ €λŠ” xamarin μ• ν”Œλ¦¬μΌ€μ΄μ…˜κ³Ό ν•¨κ»˜ onesignal을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

λ‹Ήμ‹ μ˜ compileSdkVersion 26 buildToolsVersion "26.0.0"의 @lahed, 단지 버전이 μΌμΉ˜ν•΄μ•Ό 컴파일 "com.android. 지원 : APPCOMPAT-V7 : 26.0.0λ₯Ό". app/build.gradle을 μ°Έμ‘°ν•˜μ„Έμš”.

+1

#525 확인

@lahed , μ•Œλ¦Όμ„ λ°›κ³  μžˆμ§€λ§Œ μ•Œλ¦Όμ„ 받은 ν›„ 앱이 μΆ©λŒν•©λ‹ˆλ‹€. ν•΄κ²° 방법????????????????????

λ‚΄ build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { 
            url 'https://maven.google.com/' 
            name 'Google'
        } 
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven { 

            url "$rootDir/../node_modules/react-native/android"
        }
        maven { 
            url 'https://maven.google.com/' 
            name 'Google' 
        }
    }
}

μ•±/λΉŒλ“œ.gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal 
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "com.driverapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
         manifestPlaceholders = [onesignal_app_id: "7cb17176-6d1d-48cb-89aa-2df617123eba",
                                onesignal_google_project_number: "REMOTE"]
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-mauron85-background-geolocation')
    compile project(':react-native-image-picker')
    compile project(':react-native-onesignal')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:26.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    compile 'com.google.android.gms:play-services-base:+'
    compile 'com.google.android.gms:play-services-maps:+'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}


ν•˜λ‚˜μ˜ μ‹ ν˜Έ μ½”λ“œ

 OneSignal.init("7cb17176-6d1d-48cb-89aa-2df617123eba")
      OneSignal.setSubscription(true);
     // OneSignal.inFocusDisplaying(2);


      OneSignal.addEventListener('received', this.onReceived);
      OneSignal.addEventListener('opened', this.onOpened);
      OneSignal.addEventListener('ids', this.onIds);

      OneSignal.configure();  // if device info not working 


    }


    onReceived = (notification) => {
      console.log("Notification received: ", notification);
    }

    onOpened = (openResult) => {
      console.log('Message: ', openResult.notification.payload.body);
      console.log('Data: ', openResult.notification.payload.additionalData);
      console.log('isActive: ', openResult.notification.isAppInFocus);
      console.log('openResult: ', openResult);
    }

    onIds = (device)=> {
      console.log('Device info: ', device);
    }




    componentWillUnmount() {
      OneSignal.removeEventListener('received', this.onReceived);
      OneSignal.removeEventListener('opened', this.onOpened);
      OneSignal.removeEventListener('ids', this.onIds);

    }

androidmanifesto.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.driverapp">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:launchMode="singleTop">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
       <meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="key"/>
    </application>

</manifest>

<activity ...> <service android:name="com.google.firebase.components.ComponentDiscoveryService" > <meta-data android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" android:value="com.google.firebase.components.ComponentRegistrar" /> </service> ... </activity>

그것은 λ‚˜λ₯Ό μœ„ν•΄ μž‘λ™ν•©λ‹ˆλ‹€

여기에 μ œμ•ˆλœ μ†”λ£¨μ…˜ 쀑 μ–΄λŠ 것도 νš¨κ³Όκ°€ μ—†μ—ˆμŠ΅λ‹ˆλ‹€. μ €λŠ” onesignal νŒ¨ν‚€μ§€ 버전 2.6.0을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ‹œλ„ν•΄ λ³Ό λ§Œν•œ λ‹€λ₯Έ 것이 μžˆμŠ΅λ‹ˆκΉŒ? 감사

여기에 λ™μΌν•œ λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€. 이 λ‹€λ₯Έ λ¬Έμ œμ— λŒ€ν•œ ꡬ성 νŒŒμΌμ„ κ²Œμ‹œν–ˆμŠ΅λ‹ˆλ‹€.

https://github.com/OneSignal/react-native-onesignal/issues/525#issuecomment -668732429

μ•±μ—μ„œ onesignal의 app_idλ₯Ό μƒˆ κ²ƒμœΌλ‘œ λ³€κ²½ν–ˆλŠ”λ° μž‘λ™ν–ˆμŠ΅λ‹ˆλ‹€.

λ‚˜λŠ” λ˜ν•œ 같은 λ¬Έμ œμ— μ§λ©΄ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰