2

I am developing a default Phone App for android like :

Having permissions listed in manifest and requested runtime too :

<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" />

Before requesting these permissions i have requested for the granting it as default via ACTION_CHANGE_DEFAULT_DIALER intent first then permissions and then ACTION_MANAGE_OVERLAY_PERMISSION settings opened up for the user to switch it ON.

In My manifest.xml i have declared the service InCallService implementation:

<service
        android:name=".InCallServiceImplementation"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.BIND_INCALL_SERVICE">
        <meta-data
            android:name="android.telecom.IN_CALL_SERVICE_UI"
            android:value="true" />
        <meta-data
            android:name="android.telecom.IN_CALL_SERVICE_RINGING"
            android:value="true" />

        <intent-filter>
            <action android:name="android.telecom.InCallService" />
        </intent-filter>
    </service>

and

Activity which opens my apps dial pad when user initiates 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>

and my DialerActivity.java :

@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");
    }
}
  1. My InCallServiceImplementation getting invoked when user initiates android.intent.action.CALL from calling button
  2. But when user touches the phone number in recent calls within company provided phone app, which i think is a android.intent.action.DIAL and it should open my DialerActivity, but its not happening neither on emulator, nor on real device..

for your reference you can see i am printing getSchemeSpecificPart in my DialerActivity onCreate which never gets called.. Why it is not opening the dialer activity? I would like to thank you in advance.

Rushikant Pawar
  • 428
  • 1
  • 5
  • 14
  • 1
    If its not opening your activity during this particular inference it might be because either the link between activities from the call log is NOT using the generic intent OR the intent inside of the call log does not match your activity. You should see if you can identify what is going on from the base intent and work it out from there. Because if your activity matches 1 for 1 the intent from the call log, then the system will raise the chooser. Otherwise it won't. – JoxTraex Jan 02 '20 at 17:18
  • @JoxTraex, I even just tried to print getIntent() only and also tried many times in different different ways, I tired a lot since a week and as then having no options left i have posted it here, if some one expert like you can find what is exact error or at least please tell me how can do it what you suggested – Rushikant Pawar Jan 02 '20 at 17:28
  • @RushikantPawar, You need to add runtime permissions for all given manifest permission. May be you are running application above 22 SDK. – PRATEEK BHARDWAJ Jan 03 '20 at 04:41
  • Or you can test it by changing targetsdk 21 in your app level gradle file. – PRATEEK BHARDWAJ Jan 03 '20 at 04:46
  • @PRATEEKBHARDWAJ, In order to get live on google play i have to have target API 29 or 28, Compile by 29 / 28. I have minsdk API 23. I have requested runtime permissions too after requesting for default phone at the first. I want someone to direct and i do not see the place where i can get this direction. I can not target API 21 as i want to be present on play store and yes i am testing over 23 – Rushikant Pawar Jan 03 '20 at 06:57

0 Answers0