java - Launching an Android application from within app -
to launch android application use below code works fine every application installed on phone except "phone" application itself. when attempt launch "phone" app not launced , no error message or displayed or exception thrown.
this code i'm using launch application :
launchapp(context, packagemanager, "com.android.phone"); /* * launch application * * @param c context of application * * @param pm related package manager of context * * @param pkgname name of package run */ public static boolean launchapp(context c, packagemanager pm, string pkgname) { // query intent lauching intent intent = pm.getlaunchintentforpackage(pkgname); // if intent available if (intent != null) { try { // launch application c.startactivity(intent); // if succeed return true; // if fail } catch (activitynotfoundexception ex) { // quick message notification toast toast = toast.maketext(c, "application not found", toast.length_long); // display message toast.show(); } } // default, fail launch return false; }
is correct method use launching android application and/or "phone" app special case not allow other applications launch/use ?
try code:
intent intent = new intent(intent.action_dial); startactivity(intent);
Comments
Post a Comment