I have an android service, I am using startForeground, and do not get what I to expect to get.
I use the following code:
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendIntent = PendingIntent.getActivity(this, 0, intent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setContentTitle("TITLE").setContentText("CONTENT").setContentInfo("INFO")
.setWhen(System.currentTimeMillis()).setAutoCancel(false)
.setContentIntent(pendIntent);
Notification notice = builder.build();
startForeground(startForegroundId, notice);
What I get next to the icon is: MyApp is running - so far so good, but them I get the standard text: "Touch for more information or to stop..."
And - when the user clicks on the icon the App info standard dialog.
How do I change the text?
How do I run my MainActivity when the user clicks on the icon?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…