就是添加个notification就可以。
详情参考apidemos

解决方案 »

  1.   

    恩 , 就是对Notification的处理 ,网上应该源码不少的啊。
      

  2.   

    android已经有QQ了,所以类似的代码应该很多。楼主找找吧,有时候搜索能力也是一种很重要的能力。
      

  3.   


    PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
    new Intent(this, SayHello.class), Intent.FLAG_ACTIVITY_NEW_TASK); // The ticker text, this uses a formatted string so our message could be
    // localized
    String tickerText = getString(R.string.imcoming_message_ticker_text,
    message); // construct the Notification object.
    Notification notif = new Notification(R.drawable.icon, tickerText,
    System.currentTimeMillis()); // Set the info for the views that show in the notification panel.
    notif.setLatestEventInfo(this, from, message, contentIntent);但是每次new Intent(this, SayHello.class)会新建一个activity,同一个页面有两个。
    怎么才能在点击通知图标,切换到前台后,只显示原来的主界面呢?
    而不是重新创建一个主界面。
      

  4.   

    还有个问题想问一下程序如何实现开机自动登录/取消自动登录
    通过在androidManifest写入一个
    <receiver android:name=".BootBroadcastReceiver">
    <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
    </receiver>
    可以实现开机自动登录。
    但通过程序的方式取消开机自动登录呢,在程序中可以在androidManifest中添加/删除属性吗?
    今天没分了,还望过路英雄指点一下
      

  5.   

    这还不简单,不新建就不用 Intent.FLAG_ACTIVITY_NEW_TASK这个 flag啊,new task关键字代表新建啊
      

  6.   

    Notification可以注册一个点击intent的 
    然后设置那个activity是single task的
      

  7.   

    类似的贴子我曾经在eoe上面遇到过
    我已经给出解决方案了,可能不是太好!难道不是同一个人?
    设置Intent.FLAG_ACTIVITY_NEW_TASK,打开notification确实还会新建一个activity
    可以这样,把notification的跳转指向一个activity,这个activity什么也不做,在oncreate里面写一个finish();这样就OK了
      

  8.   

    我想是这样的,不在androidManifest里面注册广播
    而在程序中手工注册广播。可以否??
      

  9.   

    多谢ls大哥相助,这个可以在广播的里读取一个配置文件中的Boolean值,作为是否执行启动代码的判断条件@Override
    public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    if (intent.getAction().equals(ACTION))
        {
      
        if(ConfigManager.Instance(context).loadBoolean("runAuto")) {
             Intent sayHelloIntent = new Intent(context, ChannelMainActivity.class);
             sayHelloIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             context.startActivity(sayHelloIntent);
        }       
        }
    }