Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android phone application intent

I want to launch the phone application on the phone as an intent

I am using this code

startActivity(getPackageManager().getLaunchIntentForPackage("com.android.phone"));

but the function throws an nullpointer excaption so there is no launchable itent but how can i launch it to make the user watch the telephonylogs

like image 212
user1426956 Avatar asked Dec 05 '25 10:12

user1426956


2 Answers

I managed to answer my question thanks for your answers the didn't exactly met the thing I wanted but on base of tham I figured it out

I just had to call

Intent intent = new Intent(Intent.ACTION_DIAL);

startActivity(intent);

to open only the phone application

like image 175
user1426956 Avatar answered Dec 08 '25 00:12

user1426956


You need permissions for certain ones ...better off doing

  Intent intent = new Intent(Intent.ACTION_MAIN, null);
 intent.addCategory(Intent.CATEGORY_LAUNCHER);
     List<ResolveInfo> packs = mContext.getPackageManager().queryIntentActivities(intent,     PackageManager.PERMISSION_GRANTED);

and then you got the list of things you have permission for and then sort through this to launch.

like image 32
j2emanue Avatar answered Dec 07 '25 23:12

j2emanue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!