mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-17 18:41:37 +01:00
Ajout méthode pour avoir le nom de l'application (sans doute à déplacer dans une class utils
Changement du titre de la notification (avec le nom de l'application)
This commit is contained in:
parent
d020ee1bcf
commit
df01e9b8b7
1 changed files with 11 additions and 1 deletions
|
@ -7,6 +7,8 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
|
@ -335,12 +337,20 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
|
||||
private Notification getNotification(String content) {
|
||||
Notification.Builder builder = new Notification.Builder(this);
|
||||
builder.setContentTitle("Scheduled Notification");
|
||||
builder.setContentTitle(getAppName());
|
||||
builder.setContentText(content);
|
||||
builder.setSmallIcon(R.mipmap.ic_launcher);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private String getAppName() {
|
||||
PackageManager packageManager = getApplicationContext().getPackageManager();
|
||||
ApplicationInfo applicationInfo = null;
|
||||
try {
|
||||
applicationInfo = packageManager.getApplicationInfo(this.getPackageName(), 0);
|
||||
} catch (final PackageManager.NameNotFoundException e) {}
|
||||
return (String)((applicationInfo != null) ? packageManager.getApplicationLabel(applicationInfo) : "???");
|
||||
}
|
||||
/**
|
||||
* SimpleItemRecyclerViewAdapter
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue