Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 默认手机应用程序意图操作拨号未打开活动_Java_Android_Android Dialer - Fatal编程技术网

Java 默认手机应用程序意图操作拨号未打开活动

Java 默认手机应用程序意图操作拨号未打开活动,java,android,android-dialer,Java,Android,Android Dialer,我正在为android开发一款默认手机应用程序,如: 具有清单中列出的权限和请求的运行时权限: <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.DI

我正在为android开发一款默认手机应用程序,如:

具有清单中列出的权限和请求的运行时权限:

<uses-permission android:name="android.permission.CALL_PHONE" /> 
<uses-permission android:name="android.permission.READ_CONTACTS" /> 
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> 
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> 
<uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

当用户启动android.intent.action.dial时打开我的应用程序拨号板的活动:

<activity
        android:name=".DialerActivity"
        android:label="@string/title_activity_dialer"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>

            <!-- Handle links from other applications -->
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.DIAL" />
            <action android:name="android.intent.action.CALL" />

            <!-- Populate the system chooser -->
            <category android:name="android.intent.category.DEFAULT" />

            <!-- Handle links in browsers -->
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="tel" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.DIAL" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
  • My
    InCallServiceImplementation
    在用户从调用按钮启动android.intent.action.CALL时被调用
  • 但当用户在公司提供的手机应用程序中最近的通话中触摸到电话号码时,我认为这是一个
    android.intent.action.DIAL
    ,它应该会打开我的DialerActivity,但无论是在模拟器上还是在真实设备上都不会发生
  • 您可以看到我正在打印
    getSchemeSpecificPart
    在我的拨号活动中,onCreate从未被调用。。为什么不是呢 打开拨号程序活动?我想提前谢谢你


    如果在该特定推断期间未打开您的活动,则可能是因为调用日志中的活动之间的链接未使用通用意图,或者调用日志中的意图与您的活动不匹配。你应该看看你是否能从基本意图中识别出发生了什么,并从中解决问题。因为如果您的活动与调用日志中的意图一一对应,那么系统将引发选择器。否则就不会了。@JoxTraex,我甚至只想打印getIntent(),也尝试了很多次不同的方式,一周以来我累了很多,因为当时没有选择余地,所以我把它发布在这里,如果像你这样的专家能找到确切的错误,或者至少请告诉我你能做什么suggested@RushikantPawar,您需要为所有给定清单权限添加运行时权限。可能您正在运行22 SDK以上的应用程序。或者您可以通过更改应用程序级gradle文件中的targetsdk 21对其进行测试。@PRATEEKBHARDWAJ,为了在google play上上线,我必须在29/28之前编译目标API 29或28。我有minsdk API 23。在第一次请求默认电话后,我也请求了运行时权限。我希望有人来指挥,但我看不到我能找到这个方向的地方。我不能瞄准API 21,因为我想在play store上出现,是的,我正在测试超过23个
    <activity
            android:name=".DialerActivity"
            android:label="@string/title_activity_dialer"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
    
                <!-- Handle links from other applications -->
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.DIAL" />
                <action android:name="android.intent.action.CALL" />
    
                <!-- Populate the system chooser -->
                <category android:name="android.intent.category.DEFAULT" />
    
                <!-- Handle links in browsers -->
                <category android:name="android.intent.category.BROWSABLE" />
    
                <data android:scheme="tel" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.DIAL" />
    
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
         if (getIntent() != null && getIntent().getData() != null)
        {
            Log.d("MainActivity URI :", getIntent().getData().getSchemeSpecificPart());
        }
        else
        {
            Log.d("MainActivity URI :", "NULL INTENT FOUND");
        }
    }