рд╡рд┐рд╡рд░рдг:
рдкрдВрдЬреАрдХреГрдд рдбрд┐рд╡рд╛рдЗрд╕ OneSignal рдбреИрд╢рдмреЛрд░реНрдб рдкрд░ рдПрдХ рддреНрд░реБрдЯрд┐ рджреЗрддрд╛ рд╣реИ, рдЗрд╕рд▓рд┐рдП рдкреБрд╢ рд╕реВрдЪрдирд╛рдПрдВ рдкреНрд░рд╛рдкреНрдд рдХрд░рдиреЗ рдореЗрдВ рдЕрд╕рдорд░реНрде рд╣реИред
рд╡рд╛рддрд╛рд╡рд░рдг
react-native -v
react-native-cli: 2.0.1
react-native: 0.55.4
рдкреИрдХреЗрдЬ.рдЬреЗрд╕рди
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-onesignal": "^3.2.3"
}
рд╕рдорд╕реНрдпрд╛ рдХреЛ рдкреБрди: рдЙрддреНрдкрдиреНрди рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрджрдо:
compile project(':react-native-onesignal')
рдбрд╛рд▓реЗрдВред рдпрд╣ рдЙрд╕ рдирд┐рд░реНрднрд░рддрд╛ рдХреЗ рдмрд┐рдирд╛ рд╕рдВрдХрд▓рд┐рдд рдирд╣реАрдВ рд╣реЛ рд╕рдХрддрд╛редOneSignal.addEventListener('ids', device => {
console.log('[OneSignal]>>ids: ', device);
});
Init рдкрд░ рдЕрдкрдирд╛ рдРрдк рдЖрдИрдбреА рдбрд╛рд▓реЗрдВред
рдФрд░ рдХреБрдЫ:
E/OneSignal(31234): Unknown error getting FCM Token
E/OneSignal(31234): java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.onesignaltest-1/base.apk)
E/OneSignal(31234): at com.google.firebase.FirebaseApp.zza(Unknown Source)
E/OneSignal(31234): at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
E/OneSignal(31234): at com.onesignal.PushRegistratorFCM.initFirebaseApp(PushRegistratorFCM.java:64)
E/OneSignal(31234): at com.onesignal.PushRegistratorFCM.getToken(PushRegistratorFCM.java:50)
E/OneSignal(31234): at com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.java:97)
E/OneSignal(31234): at com.onesignal.PushRegistratorAbstractGoogle.access$100(PushRegistratorAbstractGoogle.java:37)
E/OneSignal(31234): at com.onesignal.PushRegistratorAbstractGoogle$1.run(PushRegistratorAbstractGoogle.java:84)
E/OneSignal(31234): at java.lang.Thread.run(Thread.java:818)
рд╕рдВрдкрд╛рджрд┐рдд рдХрд░реЗрдВ 1:
рдореИрдВрдиреЗ рдЙрдирдХреЛ рдХрд░рдиреЗ рдХреА рдХреЛрд╢рд┐рд╢ рдХреА рд╣реИ, рд▓реЗрдХрд┐рди рд╕рдлрд▓рддрд╛ рдХреЗ рдмрд┐рдирд╛:
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
рдЬреЛрдбрд╝реЗрдВ@DaniloCouto рдпрд╣ рдирд┐рд╢реНрдЪрд┐рдд рд░реВрдк рд╕реЗ рдПрдХ рдПрдВрдбреНрд░реЙрдЗрдб рд╕рдкреЛрд░реНрдЯ рд▓рд╛рдЗрдмреНрд░реЗрд░реА рд╡рд░реНрдЬрди рдЗрд╢реНрдпреВ рд╣реИред рдХреНрдпрд╛ рдЖрдк рдЕрдкрдирд╛ app/build.gradle
рдкреЛрд╕реНрдЯ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ?
@DaniloCouto рдирдП рд╕рдВрд╕реНрдХрд░рдг 3.2.4 рдХреА рдЬрд╛рдБрдЪ рдХрд░реЗрдВ, рд╡реЗ рдЗрд╕реЗ рдареАрдХ рдХрд░рддреЗ рд╣реИрдВред
@adirzoari , рдЕрднреА рднреА 3.2.4 рдкрд░ рд╣реЛрддрд╛ рд╣реИ, Adb logcat рдФрд░ Onesignal рдЙрдкрдпреЛрдЧрдХрд░реНрддрд╛ рдбреИрд╢рдмреЛрд░реНрдб рдкрд░ рд╕рдорд╛рди рддреНрд░реБрдЯрд┐рдпреЛрдВ рдХреЗ рд╕рд╛рдеред
yarn add [email protected]
рдкреИрдХреЗрдЬ.рдЬреЗрд╕рди
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-onesignal": "3.2.4"
},
@ Nightsd01 рдирд┐рд╢реНрдЪрд┐рдд рдмрд╛рдд, рдпрд╣рд╛рдБ рдпрд╣ рд╣реИ:
app/build.gradle
(рдореИрдВрдиреЗ рдЬреЗрдирд░реЗрдЯ рдХреА рдЧрдИ рдЯрд┐рдкреНрдкрдгрд┐рдпреЛрдВ рдХреЛ рд╣рдЯрд╛ рджрд┐рдпрд╛ рд╣реИ)
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.onesignaltest"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) {
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-onesignal') // I just added this line
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
рд╕рдВрдкрд╛рджрд┐рдд рдХрд░реЗрдВ 1:
рдореИрдВрдиреЗ рдЗрдиреНрд╣реЗрдВ рдлрд╝рд╛рдЗрд▓ рдХреА рд╢реБрд░реБрдЖрдд рдореЗрдВ рдЬреЛрдбрд╝рд╛ рд╣реИред рдХреБрдЫ рднреА рдирд╣реАрдВ рдмрджрд▓рд╛:
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'
...
...
...
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
...
...
}
рдмреЗрд╢рдХ, рдореИрдВрдиреЗ рдПрдВрдбреНрд░реЙрдЗрдб рдкреНрд░реЛрдЬреЗрдХреНрдЯ рдХреЛ gradlew clean
рд╕реЗ рд╕рд╛рдл рдХрд░ рджрд┐рдпрд╛ рд╣реИ рдФрд░ рдкреБрдирд░реНрдирд┐рд░реНрдорд╛рдг рдХрд░рдиреЗ рдХреА рдХреЛрд╢рд┐рд╢ рдХреА рд╣реИред
@DaniloCouto рдХреНрдпрд╛ рдЖрдк рдХреЗрд╡рд▓ рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛-рдореВрд▓-рд╡рдирд╕рд┐рдЧреНрдирд▓ example
рдкреНрд░реЛрдЬреЗрдХреНрдЯ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░ рд░рд╣реЗ рд╣реИрдВ ...?
рдХреНрдпрд╛ рдЖрдк рдЕрдкрдиреА AndroidManifest.xml
рдлрд╝рд╛рдЗрд▓ рднреА рдкреЛрд╕реНрдЯ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ? рдзрдиреНрдпрд╡рд╛рдж
@ Nightsd01 рдореИрдВрдиреЗ рдПрдХ рдирдпрд╛ рд░рд┐рдПрдХреНрдЯ-рдиреЗрдЯрд┐рд╡ рдкреНрд░реЛрдЬреЗрдХреНрдЯ рдмрдирд╛рдпрд╛ рд╣реИ рдФрд░ рдпрд╛рд░реНрди рдХреЗ рдорд╛рдзреНрдпрдо рд╕реЗ рд░рд┐рдПрдХреНрдЯ-рдиреЗрдЯрд┐рд╡-рд╡рдирд╕рд┐рдЧреНрдирд▓ рдкреИрдХреЗрдЬ рдЬреЛрдбрд╝рд╛ рд╣реИред
рдпрд╣ рд░рд╣рд╛:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.onesignaltest">
<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"/> <!-- Onesignal Instruction -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- Onesignal Instruction -->
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme"
> <!-- android:launchMode="singleTop" I Was wrong at this line-->
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop"> <!-- brunoandradebr made a pretty nice observation right here -->
<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" />
</application>
</manifest>
рд╕рдВрдкрд╛рджрд┐рдд рдХрд░реЗрдВ 1:
#387 рд╕реЙрд▓реНрдпреВрд╢рди рдХреЗ рдмрд╛рдж, рдореИрдВрдиреЗ рдЗрд╕ рд▓рд╛рдЗрди рдХреЛ рдЬреЛрдбрд╝рд╛ рд╣реИред рдХреБрдЫ рднреА рдирд╣реАрдВ рдмрджрд▓рд╛
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
2 рд╕рдВрдкрд╛рджрд┐рдд рдХрд░реЗрдВ:
рдЬреИрд╕рд╛ рдХрд┐ @brunoandradebr рджреНрд╡рд╛рд░рд╛ рджреЗрдЦрд╛ рдЧрдпрд╛ рд╣реИ, android:launchMode="singleTop"
рдХреЛ рдЧрддрд┐рд╡рд┐рдзрд┐ рдЯреИрдЧ рдкрд░ рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдП рди рдХрд┐ рдПрдкреНрд▓рд┐рдХреЗрд╢рди рдЯреИрдЧ рдкрд░ред
рд▓реЗрдХрд┐рди рдпрд╣ рдЕрднреА рднреА рдХрд╛рдо рдирд╣реАрдВ рдХрд░ рд░рд╣рд╛ рд╣реИ ..
рдпрд╣рд╛рдБ рднреА рдпрд╣реА рд╕рдорд╕реНрдпрд╛ рд╣реИ, @DaniloCouto рдЖрдк рдЗрд╕реЗ рдареАрдХ рдХрд░реЗрдВ ???
рдореБрдЭреЗ рд╡рд╣реА рд╕рдорд╕реНрдпрд╛ рдорд┐рд▓реА .. @DaniloCouto рдХреНрдпрд╛ рдЖрдкрдиреЗ рдЗрд╕реЗ рдареАрдХ рдХрд░рдиреЗ рдХрд╛ рдкреНрд░рдмрдВрдзрди рдХрд┐рдпрд╛? рдореИрдВрдиреЗ рдЗрд╕рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рд╣рд░ рдЬрдЧрд╣ рдЦреЛрдЬрд╛ рдФрд░ рдЕрднреА рднреА рдХреЛрдИ рдХрд╛рдо рдирд╣реАрдВ рдХрд┐рдпрд╛ :(
@ifanfaizal , @lahed рдпрд╣ рд╕реБрдирдХрд░ рдЦреЗрдж рд╣реИ, рд▓реЗрдХрд┐рди рдореИрдВ рдпрд╣рд╛рдВ рд╕рдорд╛рдзрд╛рди рднреА рдвреВрдВрдв рд░рд╣рд╛ рд╣реВрдВ ...
рдореИрдВрдиреЗ рд╕рдлрд▓рддрд╛ рдХреЗ рдмрд┐рдирд╛ рдЙрдирдХрд╛ рдЕрдиреБрд╕рд░рдг рдХрд░рдиреЗ рдХреА рдХреЛрд╢рд┐рд╢ рдХреА рд╣реИ:
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
рдЬреЛрдбрд╝реЗрдВрдбреИрдирд┐рд▓реЛ, рдЖрдк рдбрд╛рд▓рдиреЗ рд╡рд╛рд▓реЗ рд╣реИрдВ
android:launchMode="singleTop"
рдЧрддрд┐рд╡рд┐рдзрд┐ рд╕рдВрджрд░реНрдн рдХреЗ рдЕрдВрджрд░ рдЖрд╡реЗрджрди рдореЗрдВ onesignal рдирд┐рд░реНрджреЗрд╢ рдХреЗ рд░реВрдк рдореЗрдВ рдирд╣реАрдВред
рдмреАрдЯреАрдбрдмреНрд▓реНрдпреВ рдпрд╣ рднреА рдХрд╛рдо рдирд╣реАрдВ рдХрд░ рд░рд╣рд╛ рд╣реИ = [
@brunoandradebr рдЕрдЪреНрдЫреА рддрд░рд╣ рд╕реЗ рдореЗрд░реЗ рд╕рд╛рдереА рджреЗрд╢рд╡рд╛рд╕реА рдХреЛ рджреЗрдЦрд╛ред
рдЬреИрд╕рд╛ рдЖрдкрдиреЗ рдХрд╣рд╛, рдпрд╣ рдЕрднреА рднреА рдХрд╛рдо рдирд╣реАрдВ рдХрд░ рд░рд╣рд╛ рд╣реИред
compile "com.google.android.gms:play-services-gcm:+"
рдПрдВрдбреНрд░реЙрдЗрдб рд╕реНрдЯреВрдбрд┐рдпреЛ рдПрд╕рдбреАрдХреЗ рдореИрдиреЗрдЬрд░ рд╕реЗ Google Play рд╕реЗрд╡рд╛ рд╕реНрдерд╛рдкрд┐рдд рдХрд░рдиреЗ рдХреЗ рдмрд╛рдж рдЗрд╕реЗ рдирд┐рд░реНрднрд░рддрд╛ рдореЗрдВ рдЬреЛрдбрд╝рд╛ рдЧрдпрд╛, рдФрд░ рдХрд┐рд╕реА рддрд░рд╣ рдХрд╛рдо рдХрд┐рдпрд╛, рд▓реЗрдХрд┐рди рдРрдк рдХреНрд░реИрд╢ рд╣реЛ рдЧрдпрд╛, рдлрд┐рд░ рдореИрдВрдиреЗ onesignal рдЙрдкрдпреЛрдЧрдХрд░реНрддрд╛ рд╕реВрдЪреА рдХреЛ рд░реАрдлреНрд░реЗрд╢ рдХрд┐рдпрд╛ рдФрд░ рддреНрд░реБрдЯрд┐ рдмрдиреА рд░рд╣рддреА рд╣реИ = [
рдореБрдЭреЗ рд▓рдЧрддрд╛ рд╣реИ рдХрд┐ рдпрд╣ рдЕрдм рдХрд╛рдо рдХрд░ рд░рд╣рд╛ рд╣реИ! рдореИрдВрдиреЗ рдПрдВрдбреНрд░реЙрдЗрдб рд╕реНрдЯреВрдбрд┐рдпреЛ рд╕реЗ Google Play рд╕реЗрд╡рд╛ рд╕реНрдерд╛рдкрд┐рдд рдХреА рд╣реИ, рдпрд╣ рдХрд┐рд╕реА рднреА рд▓рд╛рдЗрди рдХреЛ рд╕рдореНрдорд┐рд▓рд┐рдд рдХрд░рдиреЗ рд╡рд╛рд▓рд╛ рдирд╣реАрдВ рд╣реИ, рдЖрдкрдХреЛ рдмрдВрдбрд▓ рдмрдВрдж рдХрд░рдиреЗ рдФрд░ рдлрд┐рд░ рд╕реЗ рд╕рдВрдХрд▓рд┐рдд рдХрд░рдиреЗ рдХреА рдЖрд╡рд╢реНрдпрдХрддрд╛ рд╣реИред рдпрд╣ рдПрдХ рдЪреЗрдХ рдЖрдЗрдХрди рдХреЗ рд╕рд╛рде рд╕рдмреНрд╕рдХреНрд░рд╛рдЗрдмреНрдб рджрд┐рдЦрд╛ рд░рд╣рд╛ рд╣реИ! рдореИрдВрдиреЗ onesignal рдЕрддрд┐рд░рд┐рдХреНрдд рд▓рд╛рдЗрдиреЗрдВ рднреА рдирд╣реАрдВ рдбрд╛рд▓реА рд╣реИрдВ, рдпрд╣ рдЙрд╕реА рддрд░рд╣ рд╣реИ рдЬреИрд╕реЗ рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛ рджреЗрд╢реА рдиреЗ рдмрдирд╛рдИ рд╣реИред
@brunoandradebr @DaniloCouto @ifanfaizal рдореИрдВ рдареАрдХ рдХрд░рддрд╛ рд╣реВрдВ, рдореИрдВ sdkVersion рдФрд░ рд╕рдВрд╕реНрдХрд░рдг appcompat рдмрджрд▓рддрд╛ рд╣реВрдВ
рдкрд░рд┐рд╡рд░реНрддрди:
рдРрдк/рдмрд┐рд▓реНрдб.рдЧреНрд░реЗрдбрд▓
compileSdkVersion 26
buildToolsVersion "26.0.2"
рдирд┐рд░реНрднрд░рддрд╛ рдореЗрдВ
рдкрд░рд┐рд╡рд░реНрддрди
compile "com.android.support:appcompat-v7:23.0.1"
рдкреНрд░рддрд┐
compile "com.android.support:appcompat-v7:26.0.1"
рдореЗрд░рд╛ рдмрд┐рд▓реНрдб.рдЧреНрд░реЗрдбрд▓ (рдПрдВрдбреНрд░реЙрдЗрдб)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { // <-- THIS
url 'https://maven.google.com/' // <-- THIS
name 'Google' // <-- THIS
} // <-- THIS
}
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 {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { // <-- THIS
url 'https://maven.google.com/' // <-- THIS
name 'Google' // <-- THIS
} // <-- THIS
}
}
cmd рдореЗрдВ: cd android && gradlew clean
рдореЗрд░реЗ рдПрд╡реАрдбреА рд╕реЗ рдРрдк рдХреЛ рдЕрдирдЗрдВрд╕реНрдЯреЙрд▓ рдХрд░реЗрдВ рдФрд░ рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛-рдореВрд▓ рдХреЗ рд╕рд╛рде рд╕рдВрдХрд▓рд┐рдд рдХрд░реЗрдВ
@lahed Aahhh рдпрд╣ рдХрд╛рдо рдХрд░ рд░рд╣рд╛ рд╣реИ рднрд╛рдИ !! рдЖрдкрдХреЗ рд╕рдорд╛рдзрд╛рди рдХреЗ рд▓рд┐рдП рдмрд╣реБрдд-рдмрд╣реБрдд рдзрдиреНрдпрд╡рд╛рдж .. рдореИрдВрдиреЗ рдЗрд╕реЗ рдХрд╛рдо рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП 3 рджрд┐рди рдмрд┐рддрд╛рдП рд▓реЗрдХрд┐рди рдХреЛрдИ рдирддреАрдЬрд╛ рдирд╣реАрдВ рдирд┐рдХрд▓рд╛ .. рдФрд░ рдЖрдЬ, рдЖрдкрдиреЗ рдореЗрд░реА рдЬрд╛рди рдмрдЪрд╛рдИ
@lahed , рдПрдХ рдЖрдХрд░реНрд╖рдг рдХреА рддрд░рд╣ рдХрд╛рдо рдХрд░рддрд╛ рд╣реИ, thxред
рдореБрдЭреЗ рд▓рдЧрддрд╛ рд╣реИ рдХрд┐ рдпрд╣ рдмрдВрдж рд╣реИ...?
OneSignal рдХреА рдЯреАрдо рдЗрд╕ рдмрд╛рд░реЗ рдореЗрдВ рдХреНрдпрд╛ рдХрд░ рд╕рдХрддреА рд╣реИ?
рдПрдХ рдмреЗрд╣рддрд░ рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛-рдореВрд▓ рд▓рд┐рдВрдХ?
@lahed ty, рдЗрд╕рдХрд╛ рдХрд╛рдо
рдореЗрд░реЗ рдкрд╛рд╕ рдПрдХ рд╕рд┐рдЧреНрдирд▓ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдХреЗ 2 рдкреНрд░реЛрдЬреЗрдХреНрдЯ рд╣реИрдВ
рдкреНрд░реЛрдЬреЗрдХреНрдЯ 1 рдХреА рдЖрд╡рд╢реНрдпрдХрддрд╛ рдирд╣реАрдВ рд╣реИ OneSignal.init
рд▓реЗрдХрд┐рди рдкреНрд░реЛрдЬреЗрдХреНрдЯ 2 рдХреЛ OneSignal.init . рдХреА рдЖрд╡рд╢реНрдпрдХрддрд╛ рд╣реИ
рдХреЛрдИ рдЗрд╕реЗ рд╕рдордЭрд╛ рд╕рдХрддрд╛ рд╣реИ?
@ stevanus1997 рд╢рд╛рдпрдж рдЖрдкрдиреЗ рдкреНрд░реЛрдЬреЗрдХреНрдЯ 2 (?) рдореЗрдВ рдмрд┐рд▓реНрдб.рдЧреНрд░реЗрдбрд▓ рдкрд░ рдкрд╣рд▓реЗ рд╕реЗ рд╣реА init рдХреЛ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд┐рдпрд╛ рд╣реИ (рджреВрд╕рд░реЗ рд╢рдмреНрджреЛрдВ рдореЗрдВ, рдЖрдкрдиреЗ рдкреБрд░рд╛рдиреЗ рддрд░реАрдХреЗ рд╕реЗ OneSignal init рдХреЛ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд┐рдпрд╛ рд╣реИ) рдЗрд╕рд▓рд┐рдП рдЖрдкрдХреЛ App.js рдореЗрдВ рдлрд┐рд░ рд╕реЗ init рдХрд░рдиреЗ рдХреА рдЖрд╡рд╢реНрдпрдХрддрд╛ рдирд╣реАрдВ рдереА
рдкреНрд░реЛрдЬреЗрдХреНрдЯ 1
defaultConfig {
applicationId "com.xxxxx"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [
onesignal_app_id: "xxxxxxxxx",
onesignal_google_project_number: "xxxxxxxxx"
]
}
рдкрд░рд┐рдпреЛрдЬрдирд╛ 2
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [
onesignal_app_id : "xxxxx",
onesignal_google_project_number: "xxxxx"
]
multiDexEnabled true
}
@ifanfaizal рдореЗрд░реА рдмрд┐рд▓реНрдб.рдЧреНрд░реЗрдбрд▓ рд╣реИ
@lahad рдмрд╣реБрдд рдмрд╣реБрдд рдзрдиреНрдпрд╡рд╛рджред рдЕрдм рдпрд╣ рдЖрдХрд░реНрд╖рдг рдХреА рддрд░рд╣ рдХрд╛рдо рдХрд░ рд░рд╣рд╛ рд╣реИ...!!!
рдореИрдВрдиреЗ @lahed рдХреЗ рд╕рдорд╛рдзрд╛рди рдХрд╛ рдЕрдиреБрд╕рд░рдг рдХрд┐рдпрд╛ рд▓реЗрдХрд┐рди рдореБрдЭреЗ рдЕрднреА рднреА OneSignal рдХреЗ рдбреИрд╢рдмреЛрд░реНрдб рд╕реЗ рд╡рд╣реА рддреНрд░реБрдЯрд┐ рдорд┐рд▓рддреА рд╣реИ ... рдХреНрдпрд╛ рдХреЛрдИ рдореБрдЭреЗ рдЕрдкрдирд╛ рдирд┐рд╢реНрдЪрд┐рдд android/build.gradle
рдФрд░ android/app/build.gradle
рджрд┐рдЦрд╛ рд╕рдХрддрд╛ рд╣реИ?
рдХреНрд▓реЛрдЬ рдХрдВрдкрд╛рдЗрд▓рд░ рдХрд╛ рдкреНрд░рдпрд╛рд╕ рдХрд░реЗрдВ рдФрд░ рдкреБрди: рд╕рдВрдХрд▓рд┐рдд рдХрд░реЗрдВред
рдРрд╕рд╛ рдкрд╣рд▓реЗ рд╣реА рдХрдИ рдмрд╛рд░ рдХрд┐рдпрд╛ рд╣реИ
рдХреНрдпрд╛ рдЖрдкрдиреЗ Android Studio рдХреЗ рд╕рд╛рде Google Play рд╕реЗрд╡рд╛ рд╕реНрдерд╛рдкрд┐рдд рдХреА рд╣реИ?
рд╣рд╛рдБ, рдЗрд╕рдХрд╛ рдирд╡реАрдирддрдо рд╕рдВрд╕реНрдХрд░рдг, рдореИрдВ Android 8.0 . рдкрд░ рдЪрд▓ рд░рд╣рд╛ рд╣реВрдБ
android/app/build.gradle
:
apply plugin: "com.android.application"
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "xxx"
minSdkVersion 16
targetSdkVersion 27
versionCode 31
versionName "0.3.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_google_project_number: "xxx"]
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
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"
signingConfig signingConfigs.release
}
}
// 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
}
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile project(':react-native-image-picker')
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:+'
compile project(':react-native-svg')
compile project(':react-native-dialogs')
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(':react-native-vector-icons')
compile project(':react-native-i18n')
compile project(':react-native-fetch-blob')
compile (project(':react-native-camera')) {
exclude group: "com.android.support"
exclude group: "com.google.android.gms"
}
compile ("com.google.android.gms:play-services-vision:+") {
force = true;
}
compile ('com.android.support:exifinterface:27.0.2') {
force = true;
}
compile "com.android.support:appcompat-v7:27.0.2"
compile 'com.android.support:support-vector-drawable:27.0.2'
compile 'com.android.support:animated-vector-drawable:27.0.2'
compile "com.facebook.react:react-native:+" // From node_modules
}
// 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'
}
android/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'
}
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.1, 0.99.99]'
// 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'
}
maven { url "https://jitpack.io" }
}
}
рдПрдХ рд╕рд┐рдЧреНрдирд▓ рд╕реВрдЪреА рдХреЗ рдЕрдВрджрд░, рд╡рд╛рд╕реНрддрд╡рд┐рдХ рдбрд┐рд╡рд╛рдЗрд╕ рдХреЛ рд╣рдЯрд╛ рджреЗрдВ рд╡рд┐рдХрд▓реНрдк> рд╣рдЯрд╛рдПрдВ, рдбрд┐рдмрдЧ рдРрдк рдХреЛ рдЕрдирдЗрдВрд╕реНрдЯреЙрд▓ рдХрд░реЗрдВ рдФрд░ рдлрд┐рд░ рд╕реЗ рд╕рдВрдХрд▓рд┐рдд рдХрд░реЗрдВред
+1 рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛ рджреЗрд╢реА js . рд╕реЗ init рдХреЙрд▓ рдХреЗ рд╕рд╛рде onIds рдкреНрд░рд╛рдкреНрдд рдирд╣реАрдВ рдХрд░рддрд╛ рд╣реИ
@conngguyen91 рдпрд╣реА рдЕрдкреЗрдХреНрд╖рд┐рдд рд╣реИред onIds
рдИрд╡реЗрдВрдЯ рдХреЗрд╡рд▓ рддрднреА рд╕рдХреНрд░рд┐рдп рд╣реЛрдЧрд╛ рдЬрдм рд╕рджрд╕реНрдпрддрд╛ рд╕реНрдерд┐рддрд┐ (рдЖрдИрдбреА) рд╡рд╛рд╕реНрддрд╡ рдореЗрдВ рдмрджрд▓ рдЬрд╛рдПрдЧреАред
рдпрджрд┐ рдЖрдк onIds
рдХреЛ рдЖрдЧ рд▓рдЧрд╛рдиреЗ рдХреЗ рд▓рд┐рдП рдмрд╛рдзреНрдп рдХрд░рдирд╛ рдЪрд╛рд╣рддреЗ рд╣реИрдВ, рддреЛ рдЖрдк рдЖрд░рдВрдн рдХрд░рдиреЗ рдХреЗ рдмрд╛рдж OneSignal.configure()
рдкрд░ рдХреЙрд▓ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред рдпрд╣ рднреНрд░рдорд┐рдд рдХрд░рдиреЗ рд╡рд╛рд▓рд╛ рд╣реИ, рдореБрдЭреЗ рдкрддрд╛ рд╣реИ, рдпрд╣ рд╡рд┐рд░рд╛рд╕рдд рд╣реИред рдЗрд╕реЗ рдХрдо рднреНрд░рдорд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рд╣рдо рдЕрдЧрд▓реА рдкреНрд░рдореБрдЦ рд░рд┐рд▓реАрдЬрд╝ рдореЗрдВ рд░рд┐рдлреИрдХреНрдЯрд░рд┐рдВрдЧ рдХрд░реЗрдВрдЧреЗред
рд╣рд╛рдп @lahed , рдХреНрдпрд╛ рдореИрдВ рдЖрдкрдХреЗ рдкреНрд░рд╕реНрддрд╛рд╡рд┐рдд рдкрд░рд┐рд╡рд░реНрддрдиреЛрдВ рдХреЛ рд╕рд╣реА рджреЗрдЦ рд░рд╣рд╛ рд╣реВрдБ https://github.com/geektimecoil/react-native-onesignal/issues/525#issuecomment -392224930, min. рдЖрд╡рд╢реНрдпрдХ compileSdkVersion
рдФрд░ buildToolsVersion
рдЕрдм 26 рд╣реИ (рдЬрд┐рд╕рдХрд╛ рдЕрд░реНрде рд╣реИ Android 8.0 )? (рдЬреЛ рд╕реЗрдЯрдЕрдк рдЧрд╛рдЗрдб рдореЗрдВ рдиреЛрдЯреНрд╕ рд╕реЗ рдореЗрд▓ рдЦрд╛рддрд╛ рд╣реИ: https://documentation.onesignal.com/v5.0/docs/react-native-sdk-setup#section-adding-the-gradle-plugin)ред
рдХреНрдпрд╛ рдЗрд╕рдХрд╛ рдорддрд▓рдм рдпрд╣ рд╣реИ рдХрд┐ Android 6.x рдЕрдм рд╕рдорд░реНрдерд┐рдд рдирд╣реАрдВ рд╣реИ, рдХреНрдпреЛрдВрдХрд┐ рдореЗрд░рд╛ рд╡рд░реНрддрдорд╛рди compileSdkVersion
рдФрд░ buildToolsVersion
23 рдФрд░ 23.0.2 рд╣реИред
рдЖрдкрдХреА рд╕рд╣рд╛рдпрддрд╛рдХреЗ рд▓рд┐рдП рдзрдиреНрдпрд╡рд╛рдж!
@natterstefan рдореИрдВ рд▓рдЧрднрдЧ рдирд┐рд╢реНрдЪрд┐рдд рд░реВрдк рд╕реЗ рдирд╣реАрдВ рд╣реВрдБред рдЬреЛ рдирд┐рдЪрд▓реЗ рдЙрдкрдХрд░рдгреЛрдВ рдХреЛ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд░рддрд╛ рд╣реИ рд╡рд╣ minSdkVersion рд╣реИ, рдЗрд╕рд▓рд┐рдП, рд╕рдм рдХреБрдЫ рдкреВрд░реА рддрд░рд╣ рд╕реЗ рдХрд╛рдо рдХрд░рдирд╛ рдЪрд╛рд╣рд┐рдП, рдЬрдм рддрдХ рдХрд┐ рдПрдХ рджреЗрд╢реА рдПрдкреАрдЖрдИ рд╕рдорд░реНрдерд┐рдд рди рд╣реЛред рдореИрдВрдиреЗ рдПрдВрдбреНрд░реЙрдЗрдб 4.4 рдкрд░ рдкрд░реАрдХреНрд╖рдг рдХрд┐рдпрд╛ рдФрд░ рдпрд╣ рдареАрдХ рдХрд╛рдо рдХрд░рддрд╛ рд╣реИ
рдореИрдВрдиреЗ рдпрд╣рд╛рдВ рд╣рд▓ рдХрд┐рдпрд╛ ....
рдореИрдВрдиреЗ google play services рд╕рдВрдХреБрд▓ рдФрд░ onesignal рдХреЛ рдХреНрд░рдо рд╕реЗ рдЕрдирдЗрдВрд╕реНрдЯреЙрд▓ рдХрд░ рджрд┐рдпрд╛ред
рдЗрд╕рдХреЗ рдмрд╛рдж рдореИрдВрдиреЗ onesignal рд╕реНрдерд╛рдкрд┐рдд рдХрд┐рдпрд╛ рдФрд░ рдЕрдм рд╕рдм рдХреБрдЫ рдХрд╛рдо рдХрд░рддрд╛ рд╣реИред
Ps: рдирд┐рд░реНрдорд╛рдг рдХреЗ рдмрд╛рдж рдмрдирд╛рдП рдЧрдП рдЕрднрд┐рд▓реЗрдЦрд╛рдЧрд╛рд░ рдореЗрдВ рджреЗрдЦреЗрдВ рдФрд░ рд╕рддреНрдпрд╛рдкрд┐рдд рдХрд░реЗрдВ рдХрд┐ рдХреНрдпрд╛ Google Play рд╕реЗрд╡рд╛рдПрдВ dll рд╣реИред
P2s: рдореИрдВ xamarin рдЕрдиреБрдкреНрд░рдпреЛрдЧреЛрдВ рдХреЗ рд╕рд╛рде onesignal рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░ рд░рд╣рд╛ рд╣реВрдБред
рд╣рдордиреЗ рдпрд╣ рд╕реБрдирд┐рд╢реНрдЪрд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдЕрдкрдиреЗ рджрд╕реНрддрд╛рд╡реЗрдЬрд╝ рдЕрдкрдбреЗрдЯ рдХрд┐рдП рд╣реИрдВ рдХрд┐ compileSdkVersion
рдФрд░ buildToolsVersion
26+ рд╣реИрдВред
https://documentation.onesignal.com/docs/react-native-sdk-setup#section -adding-the-gradle-plugin
рдпрд╣ https://github.com/geektimecoil/react-native-onesignal/issues/525#issuecomment -392224930 рдореЗрдВ рд╕реБрдЭрд╛рдИ рдЧрдИ рдЪреАрдЬреЛрдВ рдореЗрдВ рд╕реЗ рдПрдХ рд╣реИред
рджреВрд╕рд░рд╛ рдирдпрд╛ рд╣рд┐рд╕реНрд╕рд╛ рдЖрдкрдХреЗ рдкреНрд░реЛрдЬреЗрдХреНрдЯ рдореЗрдВ OneSignal Gradle рдкреНрд▓рдЧрдЗрди рдЬреЛрдбрд╝ рд░рд╣рд╛ рд╣реИред рдЗрд╕рдХреЗ рд╕рд╛рде рдЖрдкрдХреЛ рдЕрдкрдиреЗ app/build.gradle
рдореЗрдВ рдореИрдиреНрдпреБрдЕрд▓ рд░реВрдк рд╕реЗ appcompat-v7
рдХреЛ рдЕрдкрдбреЗрдЯ рдирд╣реАрдВ рдХрд░рдирд╛ рд╣реЛрдЧрд╛ рдФрд░ рдЕрдиреНрдп рдкреНрд▓рдЧрдЗрдиреНрд╕ рдореЗрдВ рдкрд░рд╕реНрдкрд░ рд╡рд┐рд░реЛрдзреА рд╕рдВрд╕реНрдХрд░рдг рдХреЗ рд╕рд╛рде рд╕рдорд╕реНрдпрд╛рдУрдВ рдХрд╛ рд╕рдорд╛рдзрд╛рди рдХрд░рдирд╛ рд╣реЛрдЧрд╛ред
рд╕реБрдирд┐рд╢реНрдЪрд┐рдд рдХрд░реЗрдВ рдХрд┐ рдЖрдкрдиреЗ рдПрдХ рдирдпрд╛ рдореБрджреНрджрд╛ рдмрдирд╛рдиреЗ рд╕реЗ рдкрд╣рд▓реЗ рдирдП Adding the Gradle Plugin
рдЕрдиреБрднрд╛рдЧ рдХрд╛ рдкрд╛рд▓рди рдХрд┐рдпрд╛ рд╣реИ рдпрд╛ рдпрджрд┐ рдЖрдк рдПрдХ рд╣реА рд╕рдорд╕реНрдпрд╛ рджреЗрдЦ рд░рд╣реЗ рд╣реИрдВ рддреЛ рдпрд╣рд╛рдВ рдЬрд╡рд╛рдм рджреЗрдВ
@lahed рдмрд╣реБрдд рдмрд╣реБрдд рдзрдиреНрдпрд╡рд╛рдж, рдореИрдВрдиреЗ рдЗрд╕ рдореБрджреНрджреЗ рдХреЛ 2 рджрд┐рдиреЛрдВ рдХреЗ рд▓рд┐рдП рд╕рдордЭрдиреЗ рдХреА рдХреЛрд╢рд┐рд╢ рдХреА рд╣реИ, рдФрд░ рдЕрдВрдд рдореЗрдВ рдпрд╣рд╛рдВ рдПрдХ рдмрд╣реБрдд рд╣реА рдЙрдкрдпреЛрдЧреА рдкрд╛рдпрд╛, рдзрдиреНрдпрд╡рд╛рджред
рдореЗрд░реЗ рдкрд╛рд╕ рд╡рд╣реА рдерд╛, рд▓реЗрдХрд┐рди рдЗрд╕реЗ onesignal.configure() рдЗрд╕ рддрд░рд╣ рдХреЙрд▓ рдХрд░рдХреЗ рдХрд╛рдо рдХрд░ рд░рд╣рд╛ рдерд╛:
OneSignal.init ("my-onesignal-id");
рд╡рдирд╕рд┐рдЧреНрдирд▓.рдХреЙрдиреНрдлрд╝рд┐рдЧрд░ ();
рдЗрд╕рдХреЗ рд╕рд╛рде рдерд╛:
"рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛-рдореВрд▓": "~ 0.56.0",
"рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛-рдореВрд▓-рдПрдХ рд╕рдВрдХреЗрдд": "^ 3.2.6",
рдШрдВрдЯреА рдХреЗ рд▓рд┐рдП onesignal рдкреНрд░рд▓реЗрдЦрди рдХрд╛ рдкрд╛рд▓рди рдХрд┐рдпрд╛ рдФрд░ рдерд╛
рдкреНрд▓рдЧрдЗрди рд▓рд╛рдЧреВ рдХрд░реЗрдВ: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
рдЕрдиреНрдп рд╕реВрдЪрдирд╛:
рдЧреНрд░реЗрдб 3.1.3
рдЕрддрд┐рд░рд┐рдХреНрдд {
рдХрдВрдкрд╛рдЗрд▓рдПрд╕рдбреАрдХреЗрд╡рд░реНрд╕рди = 27
рдмрд┐рд▓реНрдбрдЯреВрд▓реНрд╕рд╡рд░реНрдЬрди = "27.0.3"
minSdkVersion = 16
targetSdkVersion = 27
рд╕рдкреЛрд░реНрдЯрд▓рд┐рдмрд╡рд░реНрд╕рди = "27.1.1"
googlePlayServicesVersion = "12.0.1"
playServicesVersion = googlePlayServicesVersion
}
рдореЗрд░реЗ рдорд╛рдорд▓реЗ рдореЗрдВ, рдореБрдЭреЗ OneSignal рдбреИрд╢рдмреЛрд░реНрдб рдкрд░ рдХрднреА рдХреЛрдИ рддреНрд░реБрдЯрд┐ рдирд╣реАрдВ рдорд┐рд▓реА; рдбрд┐рд╡рд╛рдЗрд╕ рд╡рдирд╕рд┐рдЧреНрдирд▓ рдлрд╛рдЗрди рдХреЗ рд╕рд╛рде рдкрдВрдЬреАрдХреГрдд рд╣реЛ рд░рд╣рд╛ рдерд╛ред onIds
рд╕рд┐рд░реНрдл рдлрд╛рдпрд░рд┐рдВрдЧ рдирд╣реАрдВ рдХрд░ рд░рд╣реЗ рдереЗред
OneSignal.init () рдХреЗ рдмрд╛рдж рдореЗрд░реА рд╕рдорд╕реНрдпрд╛ рдХреЛ рдареАрдХ рдХрд░рдиреЗ рдХреЗ рдмрд╛рдж рдЗрд╕реЗ рдЬреЛрдбрд╝рдирд╛:
OneSignal.configure();
рдЖрд╢рд╛ рд╣реИ рдХрд┐ рдпрд╣ рджреВрд╕рд░реЛрдВ рдХреА рдорджрдж рдХрд░рддрд╛ рд╣реИред
рдпрд╣рд╛рдБ рдПрдХ рд╣реА рдореБрджреНрджрд╛
рдкреИрдХреЗрдЬ.рдЬреЗрд╕рди:
{
"name": "smartial",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"android-linux": "npx react-native run-android --terminal \"$PWD/shkonsole\""
},
"dependencies": {
"@react-native-community/google-signin": "^4.0.3",
"react-native-onesignal": "^3.7.3",
"@sentry/react-native": "^1.4.1",
"react-native-code-push": "^6.2.1",
"react-native-google-places": "^3.1.2",
"@react-native-community/datetimepicker": "^2.4.2",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/material-bottom-tabs": "^5.2.12",
"@react-navigation/native": "^5.4.3",
"@react-navigation/stack": "^5.4.0",
"react-native-gesture-handler": "^1.6.1",
"native-base": "^2.13.12",
"react-native-paper": "^3.10.1",
"react-native-safe-area-context": "^2.0.3",
"react-native-reanimated": "^1.9.0",
"react-native-screens": "^2.8.0",
"apisauce": "^1.1.1",
"react-native-config": "^1.2.1",
"react-native-easy-app": "^1.7.3",
"react-native-vector-icons": "^6.6.0",
"@thallyssonklein/border-layout-react-native": "^1.0.14",
"recoil": "github:eveningkid/Recoil#react-native",
"react": "16.13.1",
"react-native": "0.63.2"
},
"devDependencies": {
"@babel/core": "^7.10.0",
"@babel/runtime": "^7.10.0",
"@bam.tech/react-native-make": "^3.0.0",
"@react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^26.0.1",
"eslint": "^7.1.0",
"jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:3.6.3')
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
android/app/build.gradle
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. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // 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 = [
enableHermes: false, // clean and rebuild if changing
]
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
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.smartial"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 24
versionName "3.0.9"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file('smartial-app.jks')
storePassword KEYSTORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
// 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:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
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 {
implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation 'com.google.android.gms:play-services-auth:18.0.0'
// implementation "com.google.android.gms:play-services-base:16.0.1"
// implementation "com.google.firebase:firebase-core:16.0.6"
// implementation "com.google.firebase:firebase-messaging:17.3.4"
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
compile 'com.android.support:multidex:1.0.1' //enter the latest version
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation project(':react-native-config')
compile project(':react-native-onesignal') // I just added this line
}
// 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'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply plugin: 'com.google.gms.google-services' // <--- this should be the last line
src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.smartial">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<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|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<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" />
</application>
</manifest>
src/debug/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>
рд╕рдмрд╕реЗ рдЙрдкрдпреЛрдЧреА рдЯрд┐рдкреНрдкрдгреА
@brunoandradebr @DaniloCouto @ifanfaizal рдореИрдВ рдареАрдХ рдХрд░рддрд╛ рд╣реВрдВ, рдореИрдВ sdkVersion рдФрд░ рд╕рдВрд╕реНрдХрд░рдг appcompat рдмрджрд▓рддрд╛ рд╣реВрдВ
рдкрд░рд┐рд╡рд░реНрддрди:
рдРрдк/рдмрд┐рд▓реНрдб.рдЧреНрд░реЗрдбрд▓
рдирд┐рд░реНрднрд░рддрд╛ рдореЗрдВ
рдкрд░рд┐рд╡рд░реНрддрди
compile "com.android.support:appcompat-v7:23.0.1"
рдкреНрд░рддрд┐
compile "com.android.support:appcompat-v7:26.0.1"
рдореЗрд░рд╛ рдмрд┐рд▓реНрдб.рдЧреНрд░реЗрдбрд▓ (рдПрдВрдбреНрд░реЙрдЗрдб)
cmd рдореЗрдВ: cd android && gradlew clean
рдореЗрд░реЗ рдПрд╡реАрдбреА рд╕реЗ рдРрдк рдХреЛ рдЕрдирдЗрдВрд╕реНрдЯреЙрд▓ рдХрд░реЗрдВ рдФрд░ рдкреНрд░рддрд┐рдХреНрд░рд┐рдпрд╛-рдореВрд▓ рдХреЗ рд╕рд╛рде рд╕рдВрдХрд▓рд┐рдд рдХрд░реЗрдВ