I am building an app that has multiple useful functionalities. One activity uses google maps. Can I make it so that users can use this functionality if they wish, but exclude it from older phones that cant use it (similar to how a video game can be played online or offline)? The real reason im confused is because i have to declare this in the manifest for the entire app (is there a way for me to just exclude a certain activity if users dont have map functionality?). I also will be requiring gps for the map activity, but i dont want to limit this app to only phones with these advanced functionalities since the other activities are much less complex.
I am building an app that has multiple useful functionalities. One activity uses google
Share
You can put
android:required="false"in your<uses-library>element. Then, at runtime, check to see ifMapActivityexists. If it does, you have the Google Maps SDK add-on, and you can launch yourMapActivitysubclass. IfMapActivitydoes not exist, do something else.Here is a sample project that demonstrates this: https://github.com/commonsguy/cw-omnibus/tree/master/Maps/NooYawkMapless
The manifest has:
and the launcher activity is: