使用android 2.1不知道的权限(在android 2.1上)
我目前正在开发一个应用程序,它以一定的时间间隔从服务器提取数据。我意识到这不是最有效的方法,因为它经常轮询服务器而不检索任何新数据。
解决方案是使用 C2DM,我目前正在研究如何设置它。然而,大约 7% 的用户仍在运行 Android 2.1,我不想将他们排除在我的应用程序之外。
我想我可以检查用户正在运行哪个版本的android,然后决定是否使用C2DM或轮询(在同一个apk中拥有两者的代码)。但是,为了运行 C2DM 代码,我需要在清单中指定使用某些权限,并且我担心使用这些权限,android 2.1 用户将无法下载我的 apk 文件。
所以我的问题是,我的假设是否正确,即 2.1 用户将无法下载具有 C2DM 权限的应用程序,以及如何解决这个问题。我是否必须创建两个不同的 apk 文件,并在我对不受旧 Android 版本限制的应用程序进行的每个(其他)更新中分别更新它们?
先谢谢了。
I am currently developing an app which pulls data from a server at a certain interval. I realize that this isn't the most efficient way since it will often poll the server without retrieving any new data.
The solution for this would be to use C2DM, and I am currently researching how to set this up. However about 7% of my users are still running Android 2.1, and I don't want to exclude them from my app.
I figured I can check which version of android the users are running, and then decide whether to use C2DM or polling (having code for both in the same apk). However, in order to run the C2DM code I will need to specify using certain permissions in my manifest, and I'm worried that with these permissions android 2.1 users won't be able to download my apk file.
So my question is if I am correct in my assumption that 2.1 users won't be able to download an app with C2DM permissions, and how to work around it if so. Will I have to create two different apk files and update them separately with every (other) update I make to the app that isn't restricted on older android versions?
Thanks ahead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Google C2DM 在 2.2 之前无法工作,但您可以维护所有版本的权限。因为您所做的只是在清单中设置接收器。
因此,当您注册 2.2 之前版本时,您将永远不会收到注册请求的结果。
只是为了让答案更明确:
当您定义自定义权限时:
2.2 之前的设备将忽略此权限。这意味着任何设备都可以安装此套件。它只是在 2.2 之前不起作用。
PS
这也值得注意。 Google C2DM 无法在没有 Android 市场(并且没有 Android 市场设置)的设备上运行。
The Google C2DM wont work pre 2.2 BUT you can maintain the permissions accross all versions. As all you are doing is setting receivers in the manifest.
So when you register pre 2.2 you will just never receive results to your registration requests.
Just to make the answer more explicit:
as you are defining a custom permission:
Pre 2.2 devices will just Ignore this permission. Meaning that any device can install with this set. It just wont work pre 2.2.
P.S.
It's also worth noting. Google C2DM will not work on devices without android market (and without android market setup).