μλ ,
λ΄ μ±μ 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
λ©νλ°μ΄ν°λ₯Ό λ³Ό μ μμ΅λλ€.
μ΄ λ¬Έμ λ₯Ό ν΄κ²°νλ λ°©λ²μ λν μ μ μ¬νμ΄ μμ΅λκΉ?
κ·νμ μ₯μΉκ° OneSignalμ λμ보λμ νμλ©λκΉ?
μ, κ·Έλ μ΅λλ€. μ€ν¬λ¦°μ·μ μ 곡νκ³ μμ΅λλ€.
λ¬Έμ ν΄κ²°λ¨. μΆμλ₯Ό μν΄ μ±μ λΉλν΄μΌ νλ€λ μ¬μ€μ λͺ°λμ΅λλ€. λλ²κ·Έ 릴리μ€μμ μ΄κ²μ ν μ€νΈν μ μλ λ°©λ²μ΄ μμ΅λκΉ?
μ
λ°μ΄νΈ - μ§μ§ μ΄μ λ μλ¦Ό μμ κΆνμ΄ μμκΈ° λλ¬Έμ΄λΌλ κ²μ μκ² λμμ΅λλ€. λ°λΌμ λμΌν λ¬Έμ κ° λ°μνλ κ²½μ° 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 νλ‘μ νΈμ μ€λ₯κ° μμ΅λλ€.
κ°μ λ¬Έμ .
μ΄λ€ μμ΄λμ΄?
λλ λν κ°μ λ¬Έμ μ μ§λ©΄νκ³ μμ΅λλ€.
λλ κ°μ λ¬Έμ λ₯Ό κ°μ§κ³ μλ€
μ΅μ λ²μ μ 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λ₯Ό μ κ²μΌλ‘ λ³κ²½νλλ° μλνμ΅λλ€.
λλ λν κ°μ λ¬Έμ μ μ§λ©΄νκ³ μμ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
μ, κ·Έλ μ΅λλ€. μ€ν¬λ¦°μ·μ μ 곡νκ³ μμ΅λλ€.