我正在开发一个应用程序,在清单中我有:
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>当我单击该按钮以执行此代码时:
Intent intentcall = new Intent();
intentcall.setAction(Intent.ACTION_CALL);
intentcall.setData(Uri.parse("tel:" + phonenumber)); // set the Uri
startActivity(intentcall);它在手机上运行良好,在平板电脑上,它会弹出一个显示屏,在那里你可以查看号码或将号码添加到通讯录中。然而,如果我将许可保留在清单中,它就不适用于市场上的平板电脑。我如何在保留代码行为的同时,仍然让它在平板电脑和手机市场上显示出来?
发布于 2011-12-05 00:58:04
关于"uses-feature“,它崩溃了--在实际打电话之前,你有没有检查电话是否可用?当应用程序在平板电脑上时,你可能需要执行额外的步骤。您在清单中所说的就是该功能不是必需的。它可能依赖于你来实际实现围绕它的逻辑。
发布于 2011-10-25 09:33:50
在AndroidManifest中,您需要:
<uses-feature android:name="android.hardware.telephony" android:required="false" />CALL_PHONE权限表示电话是必需的,但如果您指定不是,您将不会被过滤。
发布于 2014-12-10 16:07:07
尝试使用Intent.ACTION_DIAL而不是Intent.ACTION_CALL。
例如:
try {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone_number));
startActivity(intent);
} catch (Exception e) {
//TODO smth
}在这种情况下,您可以从AndroidManifest.xml中完全删除这些标记:
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-feature android:name="android.hardware.telephony" android:required="false" />https://stackoverflow.com/questions/7882955
复制相似问题