开发者

Android library manifest

开发者 https://www.devze.com 2023-04-11 10:57 出处:网络
I\'m developing an application for Android 2.2. I want to move two packages to an Android library to reuse it. These two packages only contains classes, and the library will only contain classes.

I'm developing an application for Android 2.2.

I want to move two packages to an Android library to reuse it. These two packages only contains classes, and the library will only contain classes.

These classes will use GPS, Acelerometer, compass and Orientation sensor.

My problem is with AndroidManifest.xml. I don't know to set it up.

Reading Android documentation, I found this: A library project's manifest file must declare all of the shared components that it includes, just as would a standard Android application.

What are these shared components? Have I to d开发者_如何学编程eclare all classes?


The shared components in this case would be the permissions that are required to use the classes. You need to request permission in the Manifest to use the GPS, Accelerometer, compass, and orientation sensor. Other than that, you shouldn't have to declare anything and you can use the classes just like any other Java class. If they contained Activities, Services, Broadcast Receivers, or sent Broadcasts, you would have to mention those in the Manifest as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号