Android see if application is disabled -


in our app have intent start skype. method looks this:

public void startskype(view view) {     if (!isskypeclientinstalled()) {         openmarket();         return;     }     final intent intent = new intent(intent.action_view, uri.parse("skype:" + getstring(r.string.usr_name) + "?chat"));     intent.setcomponent(new componentname("com.skype.raider", "com.skype.raider.main"));     intent.setflags(intent.flag_activity_new_task);     startactivity(intent); } 

it works fine in cases, day received crash

caused android.content.activitynotfoundexception: unable find explicit activity class {com.skype.raider/com.skype.raider.main}; 

after trying reproduce while found happens if application set disabled in phone settings (not phones have setting). there way see if application not available or have wrap method in ugly try-catch block?

you can check field enabled of applicationinfo:

public boolean enabled
when false, indicates components within application considered disabled, regardless of individually set enabled status.

reference http://developer.android.com/reference/android/content/pm/applicationinfo.html#enabled

for example:

applicationinfo applicationinfo = getpackagemanager().getapplicationinfo("package_name", 0); boolean isappenabled = applicationinfo.enabled; 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -