Reputation: 35
I recently started developing a small app using the sample provided in this article. http://developer.sonymobile.com/2012/09/26/let-your-app-stay-on-top-with-small-apps-for-xperia-tablet-s/
Does anybody know if I can make a small app as part of my existing app, extended as a small app included in the code of my regular apk or I need to upload another apk to Google PLAY specifically as a small app?
Upvotes: 2
Views: 485
Reputation: 497
A Small-App API based application can be a part of an existing application.
If you want to support Small Apps API in your current application, here is what you need to do.
In Android Manifest add the following line:
<uses-library android:name="com.sony.smallapp.framework” android:required="false" />
The above code ensures that library is not used to filter out your application for devices which do not support it. Then you can dynamically check for the class by using the code below in your launcher activity or a separate class.
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. }
For more reference into using reflection in Java, please check the following link: http://mobile.tutsplus.com/tutorials/android/java-reflection/
For information on uses-library in android manifest check this link: http://developer.android.com/guide/topics/manifest/uses-library-element.html
Upvotes: 1