Skip to content

Commit d0e37db

Browse files
committed
Updated on 23rd of April 2020
1 parent 6476e88 commit d0e37db

File tree

18 files changed

+402
-14
lines changed

18 files changed

+402
-14
lines changed

app/src/main/java/com/cdph/updatechecker/MainActivity.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/build.gradle renamed to cdph_updatechecker_app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ android {
2020
}
2121

2222
dependencies {
23+
compile project(':cdph_updatechecker_lib')
2324
compile fileTree(dir: 'libs', include: ['*.jar'])
2425
}
File renamed without changes.

app/src/main/AndroidManifest.xml renamed to cdph_updatechecker_app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.cdph.updatechecker" >
4+
5+
<uses-permission
6+
android:name="android.permission.INTERNET"/>
7+
<uses-permission
8+
android:name="android.permission.ACCESS_NETWORK_STATE"/>
49

510
<application
611
android:allowBackup="true"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.cdph.updatechecker;
2+
3+
import android.app.*;
4+
import android.os.*;
5+
6+
import com.cdph.app.UpdateChecker;
7+
8+
public class MainActivity extends Activity
9+
{
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState)
12+
{
13+
super.onCreate(savedInstanceState);
14+
setContentView(R.layout.main);
15+
16+
UpdateChecker.getInstance(this)
17+
.setUpdateLogsUrl("https://pastebin.com/raw/SFpLs0De")
18+
.shouldRunWhenConnected(true)
19+
.shouldAutoInstall(true)
20+
.setOnUpdateDetectedListener(new UpdateChecker.OnUpdateDetectedListener() {
21+
@Override
22+
public void onUpdateDetected(UpdateChecker.NewUpdateInfo info, boolean autoInstall)
23+
{
24+
AlertDialog dlg = new AlertDialog.Builder(MainActivity.this).create();
25+
26+
String msg = "";
27+
msg += info.app_version + "\n";
28+
msg += info.app_versionName + "\n";
29+
msg += info.app_updateUrl + "\n";
30+
msg += info.app_description;
31+
32+
dlg.setTitle("New Update Detected");
33+
dlg.setMessage(msg);
34+
dlg.show();
35+
}
36+
});
37+
}
38+
}

0 commit comments

Comments
 (0)