Android 隐藏图标 自启动 服务
来源:互联网 发布:网络语洗白白啥意思 编辑:程序博客网 时间:2024/06/03 17:01
上面说要做一个功能,说应用要做成服务型的,没有界面,没有图标,而且开机自启动。对于我这种菜鸟一听就蒙圈了,捯饬了一周也没什么进展,估计当时的方向不对,哈哈。。。不管怎么样,隔了半个月,又做出来了。今天天气真好啊!废话不多说,看代码,biubiubiu……….
1.一个activity、一个BroadcastReceiver、一个service.
- 2.在Manifest上添加几行代码。
一盆不显示应用图标、自启动服务的小应用就做好了。
代码块
MainActivity
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.startService(new Intent(this, TestService.class)); }
Service
public void onCreate() { super.onCreate(); Toast.makeText(getApplicationContext(), "xhm", Toast.LENGTH_LONG).show(); } @Override public IBinder onBind(Intent intent) { Toast.makeText(getApplicationContext(), "不xhm", Toast.LENGTH_LONG).show(); return null; }
Service
@Override public void onReceive(Context arg0, Intent arg1) { // TODO Auto-generated method stub Intent mBootIntent = new Intent(arg0, TestService.class); arg0.startService(mBootIntent); }
最后不要忘了配置Manifest.xml
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <service android:name=".TestService" android:label="@string/app_name"> </service> <receiver android:name=".BootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <data android:host=".MainActivity" android:scheme="com.xhm.hideiconxhm"/> </intent-filter> </activity>
源码下载
0 0
- Android 隐藏图标 自启动 服务
- 如何隐藏android应用程序的启动图标
- android开发,隐藏启动图标方法记录
- android 完美无(隐藏)图标启动软件
- 在Android隐藏launcher应用图标由其他应用启动
- 在Android隐藏launcher应用图标由其他应用启动
- Android Launcher隐藏指定应用的启动图标
- Android 隐藏程序的图标并使用其他APP启动
- Android 监听开机关机,隐藏启动图标功能
- android实现开机自启动服务
- android实现开机自启动服务
- android实现开机自启动服务
- android 开机自启动服务或应用
- android实现开机自启动服务
- android服务开机自启动研究
- android 开机自启动服务功能
- android实现开机自启动服务
- Android之开机自启动服务
- Android中图片优化之WebP使用
- IOS 界面跳转总结 记录
- EditTExt 输入完成之后自动加东西
- 解决QT4中文乱码的问题
- IcoMoon
- Android 隐藏图标 自启动 服务
- MongoDB可视化工具Robomongo 和 Mongochef
- JavaScript数字精度转载
- Java Excel SXSSFWorkbook大量数据导出
- Socket的使用
- 解决安卓版微信扫描二维码白屏的问题
- undefined处理
- mac下安装和配置memcache
- Linux运维笔记-文档总结-文件传输和文件归档