0
我开始从我的服务使用startForeground stickynotification。通知会显示,但是我的设置,如标题或点击时显示的意图不生效。无法设置任何东西stickynotification
@Override
public void onCreate()
{
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
Notification notification = new NotificationCompat.Builder(this)
//.setSmallIcon(R.mipmap.app_icon)
.setContentTitle("My Awesome App")
.setContentText("Doing some work...")
.setContentInfo("Server is running")
.setContentIntent(pendingIntent).build();
startForeground(1337, notification);
super.onCreate();
}
通知显示应用程序的名称和联系获取更多信息或停止....
当点击它带我到应用的信息,我可以forestop或卸载它。