android信息还原程序,Android:如何从通知中恢复应用程序?

我正在尝试将我的通知编程为RESUME我的应用程序,而不是简单地启动我的应用程序的新实例…我基本上是在寻找它做同样的事情,因为长按主页按钮并恢复应用程序从那里.

这是我目前正在做的事情:

void notifyme(String string){

String ns = Context.NOTIFICATION_SERVICE;

NotificationManager mNotificationManager = (NotificationManager)

getSystemService(ns);

int icon = R.drawable.notification_icon; // icon from resources

CharSequence tickerText = string + " Program Running..."; // ticker-text

long when = System.currentTimeMillis(); // notification time

Context context = getApplicationContext(); // application Context

CharSequence contentTitle = *********; // expanded message title

CharSequence contentText = string + " Program Running...";//expanded msg text

Intent notificationIntent = new Intent(this, Main.class);

PendingIntent contentIntent = PendingIntent.getActivity(

this, 0, notificationIntent, 0);

// the next two lines initialize the Notification, using the configurations

// above

Notification notification = new Notification(icon, tickerText, when);

notification.setLatestEventInfo(context, contentTitle, contentText,

contentIntent);

final int HELLO_ID = 1;

mNotificationManager.notify(HELLO_ID, notification);

}

我猜测新的Intent系列是问题所在……任何帮助都将不胜感激!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值