In action_call application crashes....but action_dial sets the number on the dialer...I also try this
<permission android:name="android.permission.CALL_PRIVILEGED"
android:protectionLevel="signature|privileged" />
Here is the code.....that says app has stopped working...
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
callIntent.setData(Uri.parse("tel:"+Uri.encode(phoneNum.trim())));
try {
startActivity(callIntent);
}
catch (android.content.ActivityNotFoundException ex)
{
ex.printStackTrace();
}
Here is the manifest file...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sajid.contactdemo">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DisplayActivity"></activity>
</application>
***<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>***
</manifest>