I have a strange problem here. I have an app which records the call. For this I am using Broadcast Receiver and a service running in the background all the time. But the problem is that these things don't provide an app icon, so the interaction with the user is not possible. So I created another activity and declared it in my Manifest as the Launcher activity. Now the app has the icon and clicking on that icon opens a GUI for the user. This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.callrecorderbr.activity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name=".EavesDropperReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"></action>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
<!-- <action android:name="android.intent.action.NEW_OUTGOING_CALL"></action> -->
</intent-filter>
</receiver>
<activity android:name=".MainMenuActivity"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EavesDropperActivity"
android:label="@string/app_name" >
</activity>
<activity android:name=".RecordingsListActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<activity android:name=".PlayRecordingActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
</application>
<!-- <uses-permission android:name="android.permission.INTERNET" /> -->
<!-- <uses-permission android:name="android.permission.WAKE_LOCK" /> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
But this approach gives me a strange exception when the app is running and I try to record a call. The app just freezes and forces quit as soon as a user starts a call. It gives some ANR in my Logcat. here is the logcat:
07-17 10:21:42.147: E/ActivityManager(59): ANR in com.callrecorderbr.activity (com.callrecorderbr.activity/.EavesDropperActivity)
07-17 10:21:42.147: E/ActivityManager(59): Reason: keyDispatchingTimedOut
07-17 10:21:42.147: E/ActivityManager(59): CPU usage from 28362ms to 28ms ago:
07-17 10:21:42.147: E/ActivityManager(59): system_server: 8% = 6% user + 1% kernel / faults: 1684 minor 7 major
And then a lot of lines about the kernel just same as above line. Can anyone please tell me what is the problem. Please help me.