Android开放手机呼叫应用 [英] Android open phone call application
问题描述
我只是想开了Android设备的电话应用程序。我不想提供该应用程序的电话号码。只是想打开它。
我使用的手机应用程序的包名来打开它。因为我可以通过与下面的code表示包名称,打开我想要的任何应用程序。
意图launchIntent = getPackageManager()。getLaunchIntentForPackage(com.android。联系人);
startActivity(launchIntent);
I just want to open phone call application of android device. I dont want to provide that application a phone number. Just want to open it.
I am using phone application's package name to open it. Because I am able to open any application I want through that package name with the code below.Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.contacts");
startActivity(launchIntent);
我不能够打开的电话和联系人应用程序与上述code。可能是什么问题?
I am not able to open Phone and Contacts application with the above code. What can be the problem?
推荐答案
意图
的目的(不PWN此意(该死!))给你一个更通用的方法的访问,例如打开一个文件的操作。如果你必须指定你想要什么做的,这将是非常有限的包。但是,这里有一些主意,那可能是你追求的是什么。
Intents
are intended (no pwn intended here (damn!)) to give you a more generic way of accessing actions such as opening a file. If you had to specify the package of whatever you wanted to do this would be very limited. However, here are some of the intents that may be what you're after.
//For the contacts (picking one)
Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
//For the contacts (viewing them)
Intent i = new Intent(Intent.ACTION_VIEW, ContactsContract.Contacts.CONTENT_URI);
//For the dial pad
Intent i = new Intent(Intent.ACTION_DIAL, null);
//For viewing the call log
Intent i = new Intent(Intent.ACTION_VIEW, CallLog.Calls.CONTENT_URI);
请自己一个有用的意图
文件的地方,以节省你在未来的时间,你会感谢我以后的一天。
Make yourself a useful intents
file somewhere to save you time in the future, you'll thank me later someday.
当然,开始的意图,你会做 startActivity(我);
所有的除外第一个,因为你想要的联系人回来,你会需要 startActivityForResult(我);
但这是另外一个故事了。
Of course to start those intents you'd do startActivity(i);
for all excepting the first one, since you'd want the contact back and you'd need startActivityForResult(i);
but that's another story.
这篇关于Android开放手机呼叫应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!