GiorgioRegni / Binaural-Beats

Brainwaves entrainment, auto hypnosis & lucid dreaming with an Android phone
http://binauralbeatstherapy.wordpress.com/
GNU General Public License v3.0
189 stars 58 forks source link

Phone calls crash app #9

Closed TheCoose closed 6 years ago

TheCoose commented 11 years ago

Binaural Beats crashes when making or receiving phone calls. App is not running (must be running in background). What I mean is that I'm not running the app and it's hasn't been opened yet. What ever services are running is what crashes. Not sure why there would even be services running prior to app launch. Using a Note 2 running 4.1.1

mkszuba commented 11 years ago

I too have observed this problem, on a Sony Xperia Mini Pro running Cyanogenmod 9. The first time a phone call is made or received after a reboot or after using Binaural Beats, the application crashes. The log shows the following message:

E/AndroidRuntime: FATAL EXCEPTION: main E/AndroidRuntime: java.lang.RuntimeException: Unable to instantiate receiver com.ihunda.android.binauralbeat.IncomingCallReceiver: java.lang.ClassNotFoundException: com.ihunda.android.binauralbeat.IncomingCallReceiver

GiorgioRegni commented 11 years ago

Working on a fix this week

krugerk commented 11 years ago

It appears the receiver specified in the manifest file is missing. As a temporary fix, one could merely remove that entry from the manifest.

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c42a652..c080b21 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -21,12 +21,6 @@

         </activity>

-        <receiver android:name="com.ihunda.android.binauralbeat.IncomingCallReceiver" >
-            <intent-filter>
-                <action android:name="android.intent.action.PHONE_STATE" />
-            </intent-filter>
-        </receiver>
-
     </application>
        <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
        <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

A more thorough solution could include implementing the broadcast receiver to actually receive the incoming call broadcast (in order to pause playback, for example).

krugerk commented 11 years ago

Here is an example workaround that at least pauses playback on an incoming call.

/src/com/ihunda/android/binauralbeat/BBeat.java

public class BBeat extends Activity {
...

       private final BroadcastReceiver incomingCallReceiver = new BroadcastReceiver() {
       @Override
       public void onReceive(Context context, Intent intent) {
               Log.d(LOGBBEAT, "onReceive");
               if (TelephonyManager.EXTRA_STATE_RINGING.equals(intent.getStringExtra(TelephonyManager.EXTRA_STATE)))
                       pauseOrResume();
       }
    };

...

protected void onPause() {
                super.onPause();

               unregisterReceiver(incomingCallReceiver);
        }

... 

protected void onResume() {
                super.onResume();

               registerReceiver(incomingCallReceiver, new IntentFilter("android.intent.action.PHONE_STATE"));
        }
SecUpwN commented 8 years ago

@GiorgioRegni, as you may have noticed with my pull requests, I really love your app. But you please do all users the favor and actually review all open Issues and make promises like https://github.com/GiorgioRegni/Binaural-Beats/issues/9#issuecomment-22923519 come true? ;-)

illtellyoulater commented 6 years ago

Yeah, I am with @SecUpwN on that..

Also @GiorgioRegni , there have been people asking you if you have time to mantain this, and you said you did, but issues have been left unattended for 2 years... with unmerged branches delivering fixes and features... So why not let someone else mantain this project if you can't/don't have time? This app has very good foundations compared to other ones so that's why people would like to help! Cheers man!

GiorgioRegni commented 6 years ago

I am open to having extra maintainers, so far nobody stepped up. If you're interested @jjgh, we can talk about that!

GiorgioRegni commented 6 years ago

I think this particular issue is fixed and I should close it unless you still have the problem with phone calls.

illtellyoulater commented 6 years ago

@GiorgioRegni I apologize but after quickly skimming through the issues I was under the impression that @kevencarneiro actually wanted to step up as a new maintainer but yeah I see that you guys are still discussing that. With regards to me I'm sorry but I'm not the right person for this kind of task, yet :)