java - App is shutting down when Maps isn't installed -


when click on link maps, app closing because no maps application installed. how can give alert @ start of app, can't use maps no maps application installed.

thanks,

you need create 1 method this

public boolean ispackageexisted(string targetpackage) {     packagemanager pm = getpackagemanager();     try {         packageinfo info = pm.getpackageinfo(targetpackage,                 packagemanager.get_meta_data);     } catch (namenotfoundexception e) {         return false;     }     return true; } 

then check

if (ispackageexisted("com.google.android.maps")) {     // map application available  } else {     // map application not available  } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -