Im really new to android development (and java in general), and I seem
to have run into a design issue.

Background:
  Im working on an application that automatically turns the speaker
phone on when you are on a call and lay the phone down on a flat
surface.
  Since this is my first real android app, I am building it as I
learn.  Right now it isn't even running as a service.
  I have broken the app down so far, into an activity, a phone state
listener, and a sensor listener.  From the phone state listener, I am
trying to send the sensor listener a notification that the phone is
active (thus if the sensor listener detects it is lying flat then it
should turn on the speaker phone).

But I get an error when I try to compile my code

Code Snippet:
package org.pythonistas.AutoConference;

import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.content.Intent;
import android.content.Context;

public class PhoneListener extends PhoneStateListener {
    protected static final String CALL_STATE_CHANGE =
"org.pythonistas.AutoConference.intent.action.CALL_STATE_CHANGE";
    protected static final String CALL_STATE_EXTRA = "callState";
    private Intent intent = new Intent(CALL_STATE_CHANGE);
    private Leveler myLevel = null;
    private CallReceiver myReceiver = null;
    public PhoneListener(){
        myLevel = new Leveler();
        myReceiver = new CallReceiver(myLevel);
    }

    public void onCallStateChanged(int state, String incomingNumber)
    {
        super.onCallStateChanged(state, incomingNumber);

        switch(state)
            {
            case TelephonyManager.CALL_STATE_IDLE:
                intent.putExtra(CALL_STATE_EXTRA,false);
                sendBroadcast(intent);
                break;
            case TelephonyManager.CALL_STATE_OFFHOOK:
                intent.putExtra(CALL_STATE_EXTRA,true);
                sendBroadcast(intent);
                break;
            }
    }

}



Compile Error:
    [javac] Compiling 3 source files to /Users/SourceCode/android/
projects/AutoConference/bin/classes
    [javac] /Users/SourceCode/android/projects/AutoConference/src/org/
pythonistas/AutoConference/PhoneListener.java:27: cannot find symbol
    [javac] symbol  : method sendBroadcast(android.content.Intent)
    [javac] location: class
org.pythonistas.AutoConference.PhoneListener
    [javac]             sendBroadcast(intent);
    [javac]                 ^
    [javac] /Users/SourceCode/android/projects/AutoConference/src/org/
pythonistas/AutoConference/PhoneListener.java:31: cannot find symbol
    [javac] symbol  : method sendBroadcast(android.content.Intent)
    [javac] location: class
org.pythonistas.AutoConference.PhoneListener
    [javac]             sendBroadcast(intent);
    [javac]                 ^
    [javac] 2 errors



Any help and/or guidance would be greatly appreciated.  I have also
posted my code on git  ( http://github.com/tedwards/AutoConference  )

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to