Hi,
I am trying to register a callback when a get a call on my phone.
Here is what I am doing:

public class BroadcastActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public class Receiver1 extends BroadcastReceiver
    {
        public void onReceive(Context context,Intent intent)
        {
                System.out.println(this + ":GOT-THE-INTENT");
                //-emulator-doesn't-support-vibration-
                Vibrator v =
(Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
                v.vibrate(500);
        }
    }
}


This is my Manifest file:
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".BroadcastActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver
android:name="com.broadcast.BroadcastActivity.Receiver1"
android:enabled="true" android:exported="true">
                        <intent-filter>
                                <action 
android:name="android.intent.action.PHONE_STATE"></action>
                                </intent-filter>
                </receiver>

    </application>

I am getting
Unable to instantiate receiver
com.broadcast.BroadcastActivity.Receiver1:
java.lang.ClassNotFoundException:
com.broadcast.BroadcastActivity.Receiver1 in loader
dalvik.system.PathClassLoader[/data/app/com.broadcast-2.apk] error.

I would like to receive a callback even when the application is not
open.

Thanks,
Priyank

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

Reply via email to