是否可以制作没有活动的apk? [英] Is it possible to make an apk with no activity?

查看:44
本文介绍了是否可以制作没有活动的apk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以制作一个只有服务的apk吗?

Can I make an apk that only has a service?

我正在尝试制作一个长期运行的服务,该服务位于后面并更新数据库.没有用户界面.

I'm trying to make a long running service that sits in the back and updates a database. No UI.

我一直认为必须将 Service 引导到 Activity 才能制作 APK,但这是真的吗?

I always thought that a Service had to be bootstrapped to an Activity in order to make an APK but is that true?

推荐答案

你可以,但你可能会遇到问题.Google 禁止应用通过操作"(来自用户的操作)启动 Activity.

You can, but you might have problems. Google prohibits an app from starting an Activity with an "action" - something from the user.

请参阅此帖子:如何在安装时启动 android 服务

可能会捕获与您的"活动无关的用户操作,如该帖子中所建议的那样:

It may be possible to capture a user action not related to "your" activity, as suggested in that post and like this:

我可以在没有活动或接收器的情况下启动服务吗?

但是,我很确定上次检查时,Android 的启动服务"部分需要显示用户可见的活动.否则,用户可能会在没有意识到应用已安装或确认的情况下发生恶意活动.

However, I'm pretty sure that the last time I checked, the "start service" portion of Android required a user-visible activity to be displayed. Otherwise, malicious activities may occur without the user recognizing that an app was even installed or acknowledged.

这篇关于是否可以制作没有活动的apk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆