Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using permissions that android 2.1 doesn't know (on android 2.1)

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.

like image 923
Lars Avatar asked Oct 10 '22 11:10

Lars


1 Answers

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:

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

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).

like image 100
Chris.Jenkins Avatar answered Oct 18 '22 04:10

Chris.Jenkins