logo
down
shadow

I2C onReceive-handler called only once


I2C onReceive-handler called only once

By : revamp
Date : November 19 2020, 03:59 PM
I hope this helps . You have to make sure you read all the bytes from the stream. Other wise it seems to block. Make your event handler look like this. So you can call it multiple times.
code :
void takeAction(int nBytes)
{
  Serial.println("Action!");
  while(Wire.available())
  {
    Wire.read();
  }
  return;
}


Share : facebook icon twitter icon
onReceive never called

onReceive never called


By : Emmanuel Hamon
Date : March 29 2020, 07:55 AM
should help you out Your code works for me. I modified the code so it's easier to read and added some sysouts, but it works the way you wrote it:
code :
public class Test extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
    registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            System.out.println("Screen off...................");
        }

    }, filter);
}

@Override
protected void onResume() {
    super.onResume();
    System.out.println("onResume()");
}

@Override
protected void onDestroy() {
    super.onDestroy();
    System.out.println("onDestroy()");
}

@Override
protected void onPause() {
    super.onPause();
    System.out.println("onPause()");
}
onResume()
onPause()
Screen off...................
onResume()
onPause()
onDestroy()
onReceive() of Alarm BroadcastReceiver called during setAlarm method is called

onReceive() of Alarm BroadcastReceiver called during setAlarm method is called


By : Sagar Shinde
Date : March 29 2020, 07:55 AM
will help you Newbie here, I have this function setAlarm: , The second parameter in
code :
ala.set(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(), pi);
onReceive - never called in sms app

onReceive - never called in sms app


By : jlmccall
Date : March 29 2020, 07:55 AM
hope this fix your issue You've registered the Receiver in the manifest for this action: "android.provider.Telephony.SMS_SENT". However, the Intent you're creating for the broadcast is using this action: "SMS_SENT". These need to match.
Why onReceive() keeps getting called?

Why onReceive() keeps getting called?


By : cc.jingling
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Solved my problem! Turns out it was my silly mistake, I was testing the app on my phone(real device) and i didn't have a second phone to send the "request" SMS. So I used my own phone to send the initial SMS and the app, working fine, send one back, but that meant it send a SMS to itself and once it received the second SMS it proceeded to send another one... and it got itself in a nice loop.
OnReceive not being called as it should

OnReceive not being called as it should


By : Junli Zhang
Date : March 29 2020, 07:55 AM
around this issue The issue was a mistake on my part, I was using the android emulator to test my app when I should have been using an actual phone.
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org