Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLuo0 committed Apr 12, 2019
1 parent 765b949 commit 1b2abfd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.RichardLuo.notificationpush"
minSdkVersion 22
targetSdkVersion 28
versionCode 4
versionName "1.0.5"
versionCode 5
versionName "1.0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":4,"versionName":"1.0.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":5,"versionName":"1.0.6","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.pm.PackageInfo;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.service.notification.StatusBarNotification;
import android.support.v4.app.NotificationCompat;
Expand Down Expand Up @@ -85,11 +85,11 @@ private boolean isAppInstalled(String packageName) {
if (packageName == null || packageName.isEmpty()) {
return false;
}
List<PackageInfo> info = getPackageManager().getInstalledPackages(0);
if (info == null || info.isEmpty())
List<ApplicationInfo> applicationInfo = getPackageManager().getInstalledApplications(0);
if (applicationInfo == null || applicationInfo.isEmpty())
return false;
for (int i = 0; i < info.size(); i++) {
if (packageName.equals(info.get(i).packageName)) {
for (ApplicationInfo info : applicationInfo) {
if (packageName.equals(info.packageName) && info.enabled) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.ApplicationInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
Expand Down Expand Up @@ -147,15 +147,12 @@ public void onComplete(@NonNull Task<InstanceIdResult> task) {
startService(new Intent(this, FCMReceiver.class));
input.setText(preferences.getString("ID", ""));

if (preferences.getString("installedQQ", null) == null) {
List<PackageInfo> info = this.getPackageManager().getInstalledPackages(0);
for (int i = 0; i < info.size(); i++) {
String ipackage = info.get(i).packageName;
for (String QQName : QQNames) {
if (QQName.equals(ipackage)) {
preferences.edit().putString("installedQQ", QQName).apply();
break;
}
List<ApplicationInfo> packageInfo = this.getPackageManager().getInstalledApplications(0);
for (ApplicationInfo info : packageInfo) {
for (String QQName : QQNames) {
if (QQName.equals(info.packageName) && info.enabled) {
preferences.edit().putString("installedQQ", QQName).apply();
break;
}
}
}
Expand Down

0 comments on commit 1b2abfd

Please sign in to comment.