Skip to content

Commit

Permalink
Add Localization Support for update message
Browse files Browse the repository at this point in the history
  • Loading branch information
appupgrade-dev committed Jan 15, 2023
2 parents 614af85 + baacbb4 commit e6460b1
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 35 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ All notable changes will be documented in this file.

## [1.0.1] - 2023-01-12

* Update dependecies.
* Update dependencies.

## [1.0.0] - 2023-01-10

* Hello World!.
* Hello World!.
99 changes: 71 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Android SDK for [App Upgrade](https://appupgrade.dev)

App Upgrade is a service let your users know when to upgrade your apps or force them to upgrade the app.

[![Twitter](https://img.shields.io/twitter/follow/app_upgrade?style=social)](https://twitter.com/app_upgrade)
[![YouTube](https://img.shields.io/youtube/channel/subscribers/UC0ZVJPYHFVuMwEsro4VZKXw?style=social)](https://www.youtube.com/channel/UC0ZVJPYHFVuMwEsro4VZKXw)
[![](https://jitpack.io/v/appupgrade-dev/app-upgrade-android-sdk.svg)](https://jitpack.io/#appupgrade-dev/app-upgrade-android-sdk)

Many times we need to force upgrade mobile apps on users' mobile. Having faced this issue multiple times decided to find a better way to tackle this problem. After doing some research on how people are doing this there are so many custom solutions or checking with the play store or AppStore API if there is a new version available. Although this works if we just want to nudge users that there is a new version available. It doesn't solve the problem where we want to make a decision.. whether it's a soft graceful update or we want to force update. So here is this product that will make developers' life easy. We can set custom messages.. see the versions in beautify dashboard, and many exciting features in the roadmap ahead.

Expand All @@ -29,7 +28,7 @@ dependencyResolutionManagement {
}
}
```
If you are using gradel version prior to 7.x.x add the following in your build.gradle at the end of repositories:
If you are using gradle version prior to 7.x.x add the following in your root build.gradle at the end of repositories:
```
allprojects {
repositories {
Expand All @@ -39,68 +38,112 @@ allprojects {
}
```

For Kotlin build.gradle.kts syntax is:
```
allprojects {
repositories {
...
maven ("https://jitpack.io")
}
}
```

2. Add the dependency to your project
```groovy
dependencies {
implementation 'com.github.appupgrade-dev:app-upgrade-android-sdk:1.0.2'
}
```

3. Internet Permission required. Add the following in AndroidManifest.xml file if not already present.
```
<uses-permission android:name="android.permission.INTERNET" />
```

## How to use it.
1. Register on App Upgrade and follow the instructions to create project and get the x-api-key.
2. Use the SDK.

#### Kotlin
Add the following code in your MainActivity.kt -> onCreate method.

```kotlin
val xApiKey = "ZWY0ZDhjYjgtYThmMC00NTg5LWI0NmUtMjM5OWZkNjkzMzQ5"

val appInfo = AppInfo(
appId = "com.android.com",
appName = "Wallpaper app",
appVersion = "1.0.0",
platform = "android",
environment = "production"
appLanguage = "es" // Optional, used for localizing the update message.
)

//Optional
val alertDialogConfig = AlertDialogConfig(
title: "Update Required", //Default: Please Update
updateButtonTitle: "Update Now", //Default: Update Now
laterButtonTitle: "Not Now" //Default: Later
)

appUpgrade = AppUpgrade()
appUpgrade.checkForUpdates(this, xApiKey, appInfo, alertDialogConfig)
class MainActivity : AppCompatActivity() {

private lateinit var appUpgrade: AppUpgrade

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

// App Upgrade
val xApiKey = "ZWY0ZDhjYjgtYThmMC00NTg5LWI0NmUtMjM5OWZkNjkzMzQ5"

val appInfo = AppInfo(
appId = "com.android.com",
appName = "Wallpaper app",
appVersion = "1.0.0",
platform = "android",
environment = "production",
appLanguage = "es"
)

//Optional
val alertDialogConfig = AlertDialogConfig(
title = "Update Required", //Default: Please Update
updateButtonTitle = "Update Now", //Default: Update Now
laterButtonTitle = "Not Now" //Default: Later
)

val appUpgrade = AppUpgrade()
appUpgrade.checkForUpdates(this, xApiKey, appInfom alertDialogConfig)

// appUpgrade.checkForUpdates(this, xApiKey, appInfom)
}
}
```

#### Java
Add the following code in your MainActivity.java -> onCreate method.
```java
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// App Upgrade
String xApiKey = "ZWY0ZDhjYjgtYThmMC00NTg5LWI0NmUtMjM5OWZkNjkzMzQ5";

String appId = "com.android.com";
String appName = "Wallpaper app";
String appVersion = "1.0.0";
String platform = "android";
String environment = "production";
String appLanguage = "es"
String appLanguage = "es";

AppInfo appInfo = new AppInfo(appId, appName, appVersion, platform, environment);

String title = "Update Required";
// Optional
String title = "Update Required.";
String updateButtonTitle = "UPDATE";
String laterButtonTitle = "Not Now";

AlertDialogConfig alertDialogConfig = new AlertDialogConfig(title, updateButtonTitle, laterButtonTitle);

AppUpgrade appUpgrade = new AppUpgrade();
appUpgrade.checkForUpdates(this, xApiKey, appInfo, alertDialogConfig);

// appUpgrade.checkForUpdates(this, xApiKey, appInfo);
}
}
```

### Note:
2. For opening the app store or play store the app should be live.
3. It might not be able to open the app store or play store in simulator. You can try it in physical device.
1. For opening the app store or play store the app should be live.
2. It might not be able to open the app store or play store in simulator. You can try it in physical device.
3. You can find a sample Kotlin app from here [app-upgrade-android-kotlin-demo-app](https://github.com/appupgrade-dev/app_upgrade_android_kotlin_demo_app) and a sample Java app from here [app-upgrade-android-java-demo-app](https://github.com/appupgrade-dev/app_upgrade_android_java_demo_app)
4. Read detailed blog on how to integrate Kotlin app from here [How to upgrade/force upgrade Android Kotlin app](https://appupgrade.dev/blog/how-to-force-upgrade-android-kotlin-app) and Java app from here [How to upgrade/force upgrade Android Java app](https://appupgrade.dev/blog/how-to-force-upgrade-android-java-app)


## Screenshot
Expand Down
4 changes: 2 additions & 2 deletions app-upgrade-android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.google.android.material:material:1.6.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
Expand All @@ -66,4 +66,4 @@ afterEvaluate {
}
}
}
}
}
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(path: ':app-upgrade-android-sdk')
implementation project(path: ':app-upgrade-android-sdk')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
}

0 comments on commit e6460b1

Please sign in to comment.