update readme
This commit is contained in:
parent
e68fdb2bc7
commit
935eec2a4b
195
README.md
195
README.md
|
@ -1,35 +1,47 @@
|
||||||
Android SDK
|
# Android SDK
|
||||||
===================
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
- [Import](#import)
|
|
||||||
- [Installation](#installation)
|
- [Import](#import)
|
||||||
- [Project](#project)
|
- [Installation](#installation)
|
||||||
- [Settings](#settings)
|
- [Project](#project)
|
||||||
- [App](#app)
|
- [Settings](#settings)
|
||||||
- [Add fragment](#fragment)
|
- [App](#app)
|
||||||
- [Troubleshooting](#troubleshooting)
|
- [Add fragment](#fragment)
|
||||||
- [Authors](#authors)
|
- [Troubleshooting](#troubleshooting)
|
||||||
|
- [Authors](#authors)
|
||||||
|
|
||||||
<a name="import"></a>
|
<a name="import"></a>
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
You must use git to download the sdk from [repository](https://github.com/tecnaviapress/newsmemory-android-sdk)
|
You must use git to download the sdk from [repository](https://github.com/tecnaviapress/newsmemory-android-sdk)
|
||||||
|
|
||||||
1. The repository is private, to clone it you must generate an ssh key, see the [guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
1. The repository is private, to clone it you must generate an ssh key, see the [guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
||||||
2. Once the key is generate you must send to Tecnavia the public key and wait a confirmation that you are enabled
|
2. Once the key is generate you must send to Tecnavia the public key and wait a confirmation that you are enabled
|
||||||
3. Inside root folder run the following command, replace TAG with the latest release, see the list on [releases](https://github.com/tecnaviapress/newsmemory-android-sdk/releases)
|
3. Inside root folder run the following command, replace TAG with the latest release, see the list on [releases](https://github.com/tecnaviapress/newsmemory-android-sdk/releases)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --depth 1 --brach TAG git@github.com:tecnaviapress/newsmemory-android-sdk.git
|
git clone --depth 1 --brach TAG git@github.com:tecnaviapress/newsmemory-android-sdk.git
|
||||||
```
|
```
|
||||||
|
|
||||||
4. if you already has the module you could update to another release by the following commands
|
4. if you already has the module you could update to another release by the following commands
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd newsmemory-android-sdk
|
cd newsmemory-android-sdk
|
||||||
git checkout tags/TAG
|
git checkout tags/TAG
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="installation"></a>
|
<a name="installation"></a>
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
<a name="project"></a>
|
<a name="project"></a>
|
||||||
|
|
||||||
### Project Gradle
|
### Project Gradle
|
||||||
|
|
||||||
1. check main gradle repositories and dependencies
|
1. check main gradle repositories and dependencies
|
||||||
|
|
||||||
```java
|
```java
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -69,45 +81,46 @@ allprojects {
|
||||||
```
|
```
|
||||||
|
|
||||||
2. if you are using sdk for amazon and it is built for it add the following maven repository
|
2. if you are using sdk for amazon and it is built for it add the following maven repository
|
||||||
|
|
||||||
```java
|
```java
|
||||||
maven {
|
maven {
|
||||||
url "https://s3.amazonaws.com/android-listener/mvn-repo"
|
url "https://s3.amazonaws.com/android-listener/mvn-repo"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
3. you could customize all dependencies version by updating the following variables, !pay attention, because the sdk may not starts or works properly add these variables to ext object in main gradle file, see below example.
|
3. you could customize all dependencies version by updating the following variables, !pay attention, because the sdk may not starts or works properly add these variables to ext object in main gradle file, see below example.
|
||||||
|
|
||||||
| variable | default | Description |
|
| variable | default | Description |
|
||||||
|:---------------------------------- |:-------:|:-------------------------------------------------------------- |
|
| :--------------------------------------------------------------------------------------------------- | :-----: | :-------------------------------------------------------- |
|
||||||
| compileSdk | 33 | |
|
| compileSdk | 33 | |
|
||||||
| targetSdk | 33 | |
|
| targetSdk | 33 | |
|
||||||
| minSdk | 24 | |
|
| minSdk | 24 | |
|
||||||
| frescoVersion | 2.5.0 | used by react native to display some images |
|
| frescoVersion | 2.5.0 | used by react native to display some images |
|
||||||
| soLoaderVersion | 0.10.1 | used to load needed system native libraries |
|
| soLoaderVersion | 0.10.1 | used to load needed system native libraries |
|
||||||
| okHttpVersion | 4.9.2 | |
|
| okHttpVersion | 4.9.2 | |
|
||||||
| glideVersion | 4.12.0 | |
|
| glideVersion | 4.12.0 | |
|
||||||
| kotlinGradleVersion | 1.5.0 | |
|
| kotlinGradleVersion | 1.5.0 | |
|
||||||
| kotlinVersion | 1.4.0 | |
|
| kotlinVersion | 1.4.0 | |
|
||||||
| webkitVersion | 1.4.0 | |
|
| webkitVersion | 1.4.0 | |
|
||||||
| androidxVersion | 1.5.0 | |
|
| androidxVersion | 1.5.0 | |
|
||||||
| androidxWorkRuntimeVersion | 1.5.0 | |
|
| androidxWorkRuntimeVersion | 1.5.0 | |
|
||||||
| androidxAnnotationVersion | 1.4.0 | |
|
| androidxAnnotationVersion | 1.4.0 | |
|
||||||
| androidxViewpager2Version | 1.0.0 | |
|
| androidxViewpager2Version | 1.0.0 | |
|
||||||
| androidxFragmentVersion | 1.4.1 | |
|
| androidxFragmentVersion | 1.4.1 | |
|
||||||
| androidxBrowserVersion | 1.4.0 | |
|
| androidxBrowserVersion | 1.4.0 | |
|
||||||
| androidxTransitionVersion | 1.1.0 | |
|
| androidxTransitionVersion | 1.1.0 | |
|
||||||
| androidxCoordinatorlayoutVersion | 1.1.0 | |
|
| androidxCoordinatorlayoutVersion | 1.1.0 | |
|
||||||
| androidxSwiperefreshlayoutVersion | 1.0.0 | |
|
| androidxSwiperefreshlayoutVersion | 1.0.0 | |
|
||||||
| androidxAppcompatVersion | 1.0.2 | |
|
| androidxAppcompatVersion | 1.0.2 | |
|
||||||
| androidxLegacySupportVersion | 1.0.0 | |
|
| androidxLegacySupportVersion | 1.0.0 | |
|
||||||
| playServiceiidVersion | 17.0.0 | |
|
| playServiceiidVersion | 17.0.0 | |
|
||||||
| playServiceBaseVersion | 18.0.1 | |
|
| playServiceBaseVersion | 18.0.1 | |
|
||||||
| **The following variables are used if you include on of the optional library listed in description** |
|
| **The following variables are used if you include on of the optional library listed in description** |
|
||||||
| playServiceAnalyticsVersion | 18.0.1 | react-native-google-analytics-bridge |
|
| playServiceAnalyticsVersion | 18.0.1 | react-native-google-analytics-bridge |
|
||||||
| playServiceAdsVersion | 20.2.0 | react-native-prebid, react-native-dfp, react-native-admob |
|
| playServiceAdsVersion | 20.2.0 | react-native-prebid, react-native-dfp, react-native-admob |
|
||||||
| playServiceMapsVersion | 17.0.0 | react-native-maps |
|
| playServiceMapsVersion | 17.0.0 | react-native-maps |
|
||||||
| playBillingVersion | 5.0.0 | react-native-iap for google |
|
| playBillingVersion | 5.0.0 | react-native-iap for google |
|
||||||
| amazonSdkVersion | 3.0.3 | react-native-iap for amazon |
|
| amazonSdkVersion | 3.0.3 | react-native-iap for amazon |
|
||||||
|
|
||||||
```java
|
```java
|
||||||
ext {
|
ext {
|
||||||
|
@ -116,50 +129,60 @@ ext {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="settings"></a>
|
<a name="settings"></a>
|
||||||
### Settings Gradle
|
|
||||||
|
### Settings Gradle
|
||||||
|
|
||||||
```java
|
```java
|
||||||
include ':newsmemory-android-sdk'
|
include ':newsmemory-android-sdk'
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="app"></a>
|
<a name="app"></a>
|
||||||
|
|
||||||
### App Gradle
|
### App Gradle
|
||||||
|
|
||||||
add the following lines if missing
|
add the following lines if missing
|
||||||
```java
|
|
||||||
|
```java
|
||||||
plugin: "com.android.application"
|
plugin: "com.android.application"
|
||||||
apply plugin: "com.google.gms.google-services"
|
apply plugin: "com.google.gms.google-services"
|
||||||
//add crashlytics only if the aar file is included
|
//add crashlytics only if the aar file is included
|
||||||
apply plugin: 'com.google.firebase.crashlytics'
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
|
|
||||||
android{
|
android{
|
||||||
...
|
...
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
...
|
...
|
||||||
//This line is required by react-native-iap, not included by default
|
//This line is required by react-native-iap, not included by default
|
||||||
missingDimensionStrategy "store", "play"
|
missingDimensionStrategy "store", "play"
|
||||||
}
|
}
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
pickFirst "lib/x86/libc++_shared.so"
|
pickFirst "lib/x86/libc++_shared.so"
|
||||||
pickFirst "lib/x86_64/libc++_shared.so"
|
pickFirst "lib/x86_64/libc++_shared.so"
|
||||||
pickFirst "lib/arm64-v8a/libc++_shared.so"
|
pickFirst "lib/arm64-v8a/libc++_shared.so"
|
||||||
pickFirst "lib/armeabi-v7a/libc++_shared.so"
|
pickFirst "lib/armeabi-v7a/libc++_shared.so"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies{
|
dependencies{
|
||||||
implementation project(":newsmemory-android-sdk")
|
implementation project(":newsmemory-android-sdk")
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="fragment"></a>
|
<a name="fragment"></a>
|
||||||
|
|
||||||
## Add fragment to activity
|
## Add fragment to activity
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class YourActivity extends AppCompatActivity {
|
public class YourActivity extends AppCompatActivity {
|
||||||
...
|
...
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -194,7 +217,7 @@ public class YourActivity extends AppCompatActivity {
|
||||||
//TODO implement it and return true if you consume the event
|
//TODO implement it and return true if you consume the event
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleTokenExpired(){
|
public boolean handleTokenExpired(){
|
||||||
//TODO implement it and return true if you consume the event
|
//TODO implement it and return true if you consume the event
|
||||||
|
@ -229,11 +252,13 @@ public class YourActivity extends AppCompatActivity {
|
||||||
```
|
```
|
||||||
|
|
||||||
the following constant is required by SDK to be authorized
|
the following constant is required by SDK to be authorized
|
||||||
|
|
||||||
```java
|
```java
|
||||||
bundle.putString(TaConstants.TA_API_KEY, "");
|
bundle.putString(TaConstants.TA_API_KEY, "");
|
||||||
```
|
```
|
||||||
|
|
||||||
the following constants are required by SDK otherwise there will be some inconsinstecies and bugs
|
the following constants are required by SDK otherwise there will be some inconsinstecies and bugs
|
||||||
|
|
||||||
```java
|
```java
|
||||||
bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME));
|
bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME));
|
||||||
bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE));
|
bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE));
|
||||||
|
@ -242,11 +267,12 @@ the following constants are required by SDK otherwise there will be some inconsi
|
||||||
bundle.putBoolean(TaConstants.TA_IS_ADDON, true);
|
bundle.putBoolean(TaConstants.TA_IS_ADDON, true);
|
||||||
```
|
```
|
||||||
|
|
||||||
1. The activity that load TaFragment must implement the following interface *DefaultHardwareBackBtnHandler*
|
1. The activity that load TaFragment must implement the following interface _DefaultHardwareBackBtnHandler_
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class YourActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
|
public class YourActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
|
||||||
...
|
...
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invokeDefaultOnBackPressed() {
|
public void invokeDefaultOnBackPressed() {
|
||||||
//TODO handle finish
|
//TODO handle finish
|
||||||
|
@ -254,15 +280,18 @@ public class YourActivity extends AppCompatActivity implements DefaultHardwareBa
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. you could extends activity class with TaActivity that already has an implementation of *DefaultHardwareBackBtnHandler* but also add some other methods to force locale.
|
2. you could extends activity class with TaActivity that already has an implementation of _DefaultHardwareBackBtnHandler_ but also add some other methods to force locale.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class YourActivity extends TaActivity {
|
public class YourActivity extends TaActivity {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Troubleshooting Guide
|
||||||
|
|
||||||
|
1. **Google Play Services Build Issues**: If you encounter build issues related to Google Play Services versions, consider adding the following setting to your `build.gradle` file:
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
1. if you have some build issues related to google play services versions you could add the following setting to build.gradle
|
|
||||||
```java
|
```java
|
||||||
android {
|
android {
|
||||||
...
|
...
|
||||||
|
@ -272,11 +301,33 @@ android {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
2. if you have the following error during the build `Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module`
|
|
||||||
add `--add-opens=java.base/java.io=ALL-UNNAMED` option to `org.gradle.jvmargs` entry in `gradle.properties`
|
2. **Java Base Access Error**: If you receive an error during the build process that reads `Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module`, add the `--add-opens=java.base/java.io=ALL-UNNAMED` option to the `org.gradle.jvmargs` entry in your `gradle.properties` file:
|
||||||
```
|
|
||||||
|
```plaintext
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 --add-opens=java.base/java.io=ALL-UNNAMED
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 --add-opens=java.base/java.io=ALL-UNNAMED
|
||||||
```
|
```
|
||||||
|
|
||||||
|
3. **Orientation Change Crash**: If your application crashes when the orientation changes, add the following attributes to your activity in the Android manifest:
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
configChanges="...|screenLayout|screenSize|smallestScreenSize"
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, refer to this [GitHub issue comment](https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-923950313).
|
||||||
|
|
||||||
|
4. **Background or Awakening Crash**: If your application crashes when it moves to the background or wakes up, try adding the following to your activity:
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(null);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, refer to this [GitHub issue comment](https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067).
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
Nicolò Aquilini, iOS Software developer, Tecnavia
|
Nicolò Aquilini, iOS Software developer, Tecnavia
|
||||||
Andrea Mauri, Android Software developer, Tecnavia
|
Andrea Mauri, Android Software developer, Tecnavia
|
||||||
|
|
Loading…
Reference in New Issue