1
0
Fork 0

Make it buildable in 2022 (#41)

* Bump up to android-28, gradle 7.2

* updated gradle 2.2.1 -> 7.3.3

* readjusted API Level versions to support Mocor5 devices (hopefully)

* no longer using the deprecated notification.setLatestEventInfo()

* updated permissions list for compatibility with Android 9+

Co-authored-by: Ratmir Karabut <rkarabut@gmail.com>
This commit is contained in:
Dimo Karaivanov 2022-06-14 03:39:56 +03:00 committed by GitHub
parent a352deca43
commit 0a81e6845f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 70 deletions

View file

@ -2,6 +2,7 @@ package org.nyanya.android.traditionalt9;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@ -49,17 +50,25 @@ public class DBUpdateService extends IntentService {
return;
}
Log.d("T9DBUpdate.onHandle", "Update pass check.");
// do real things
Notification notification = new Notification(R.drawable.ime_en_lang_lower, getText(R.string.updating_database_title),
System.currentTimeMillis());
Intent notificationIntent = new Intent(this, DBUpdateService.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(this, getText(R.string.updating_database_title),
getText(R.string.updating_database), pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification.Builder nBuilder = new Notification.Builder(this);
Notification notification = nBuilder
.setContentIntent(pendingIntent)
.setContentTitle(getText(R.string.updating_database_title))
.setContentText(getText(R.string.updating_database))
.setSmallIcon(R.drawable.ime_en_lang_lower)
.getNotification();
notificationManager.notify(UPDATING_NOTIFICATION_ID, notification);
startForeground(UPDATING_NOTIFICATION_ID, notification);
//put this in a thread
mHandler.post(new DisplayToast(this, getText(R.string.updating_database)));