adustdu2015
adustdu2015
# Android10以后,启动前台服务,必须显示通知的处理方案 我们都知道,目前启动服务在Android O 之后,必须使用startForeground 。并且会显示一个通知栏的东西。 ```java //调用 Intent intent = new Intent(MainActivity.this, MyService.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(intent); } else { startService(intent); } ``` 我们完全可以用bindService(intent,conn,flags)替代。 bindService用于绑定一个服务。这样当bindService(intent,conn,flags)后,就会绑定一个服务。这样做可以获得这个服务对象本身; 废话不多说,直接上代码: ```java...
搞笑。。。~~~~~别闹。开源大家一起学习一下。
这个project实现了什么功能呢?我想问一下。