我最近开始使用本文提供的示例开发一个小型应用程序。 http://developer.sonymobile.com/2012/09/26/let-your-app-stay-on-top-with-small-apps-for-xperia-tablet-s/
有人知道我是否可以制作一个小应用程序作为我现有应用程序的一部分,扩展为包含在我的常规 apk 代码中的小应用程序,或者我需要专门将另一个 apk 作为小应用程序上传到 Google PLAY?
最佳答案
基于 Small-App API 的应用程序可以是现有应用程序的一部分。
如果您想在当前应用程序中支持 Small Apps API,您需要执行以下操作。
在 Android list 中添加以下行:
<uses-library android:name="com.sony.smallapp.framework” android:required="false" />
以上代码确保库不会用于过滤掉不支持它的设备的应用程序。然后,您可以在启动器 Activity 或单独的类中使用下面的代码来动态检查该类。
1. String checkLibrary = "com.sony.smallapp.framework";
2. try {
3. Class libraryToInvestigate = Class.forName(checkLibrary);
4. // Dynamically initiate the library
5. // Initiate constructor or methods
6. } catch (ClassNotFoundException e) {
7. // If class is not found(Small Apps API not supported), handle exception and use a home widget or normal activity as fallback
8. } catch (Exception e) {
9. // Unknown exception
10. }
有关在 Java 中使用反射的更多引用,请查看以下链接:http://mobile.tutsplus.com/tutorials/android/java-reflection/
有关 android list 中 uses-library 的信息,请查看此链接: http://developer.android.com/guide/topics/manifest/uses-library-element.html
关于android - Xperia Tablet S 上的小型应用程序 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12648294/