Code: Select all
public void showNotification(Beacon beacon) {
Resources r = getResources();
int random = (int)System.currentTimeMillis();
Notification notification = new NotificationCompat.Builder(this)
.setSmallIcon(android.R.drawable.ic_popup_reminder)
.setContentTitle("Beacons Found")
.setContentText(beacon.getID().toString())
.setVisibility(0) // allow notification to appear on locked screen
.setAutoCancel(true)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(random, notification);
}
Code: Select all
import android.support.v4.app.NotificationManagerCompat;
Was soll ich tun? Ich habe das Android Support Repository SDK bereits installiert und habe „android-support-v4.jar“ im libs-Ordner des Projekts
Mobile version