Monday, 15 February 2010

android - How to get list of apps installed from external storage using OSGI Bundle? -



android - How to get list of apps installed from external storage using OSGI Bundle? -

im using osgi bundle (that in storage) , want list of applications installed in smartphone. im using next method im getting null list, if smartphone wasnt have app. think should because bundle in storage (different of launcher application).

this code works in normal application, when using in bundle dont.

my bundle folder: 0 -> android -> info -> com.myapp -> felix -> availablebundles -> mybundle.jar

thats code utilize apps installed:

private string findtargetapppackage(intent intent) { packagemanager pm = activity.getpackagemanager(); list<resolveinfo> availableapps = new arraylist<resolveinfo>(); try{ availableapps = pm.queryintentactivities(intent, 0); }catch (exception e){ log.d("exception", e.getmessage()); } try{ if (availableapps != null) { (resolveinfo availableapp : availableapps) { string packagename = availableapp.activityinfo.packagename; if (targetapplications.contains(packagename)) { homecoming packagename; } } } }catch(exception e){ } homecoming null; }

edit: thats intent receive category.

intent intentscan = new intent(bs_package + ".scan"); intentscan.addcategory(intent.category_default);

android android-intent osgi-bundle

No comments:

Post a Comment