Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented In-App Update feature #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ dependencies {
implementation files('libs/VirusTotalAPI.jar')
implementation 'com.google.firebase:firebase-analytics:19.0.0'

implementation 'com.github.javiersantos:AppUpdater:2.7'

// https://mvnrepository.com/artifact/com.hierynomus/smbj
testImplementation group: 'com.hierynomus', name: 'smbj', version: '0.11.1'

Expand Down
21 changes: 21 additions & 0 deletions src/main/java/dk/aau/netsec/hostage/ui/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.github.javiersantos.appupdater.AppUpdater;
import com.github.javiersantos.appupdater.enums.Display;
import com.github.javiersantos.appupdater.enums.UpdateFrom;

import dk.aau.netsec.hostage.Hostage;
import dk.aau.netsec.hostage.R;
import dk.aau.netsec.hostage.location.MyLocationManager;
Expand Down Expand Up @@ -274,6 +278,8 @@ protected void onCreate(Bundle savedInstanceState) {
context = new WeakReference<>(getApplicationContext());
setContentView(R.layout.activity_drawer_main);

setUpUpdatePrompt();

addAnimation();
// configures the action bar
configureActionBar();
Expand Down Expand Up @@ -303,6 +309,21 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

public void setUpUpdatePrompt() {
AppUpdater appUpdater = new AppUpdater(this);

new AppUpdater(this)
.setUpdateFrom(UpdateFrom.GOOGLE_PLAY)
.setDisplay(Display.DIALOG)
.setTitleOnUpdateAvailable("Update available")//Title of the Dialog Prompt
.setContentOnUpdateAvailable("Check out the latest version available of Amahi Android App!")//Description of the Dialog Prompt
.setButtonUpdate("Update")//Updates the App
.setButtonDoNotShowAgain("Don't show again");//Never shows the prompt again until next release

appUpdater.start();
}


private void executeRoot() {
CheckRoot checkRoot = new CheckRoot();
checkRoot.execute();
Expand Down