Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Adding default notification SOUND to Missed Call

Adding default notification SOUND to Missed Call

Put your problem here if it does not fit any of the other categories.

Adding default notification SOUND to Missed Call

Postby tbehr » Sun Mar 01, 2009 6:51 pm

Following are two independent examples, the first detecting missed call, the second display a button to show a sample notification and sound. I've been trying to simply play the default notification on missed call but not having any luck.

import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;

public class MissedCallPhoneStateListener extends PhoneStateListener {

final static String TAGTEXT = "DEBUG LISTENER!!!";
boolean ringing = false;
boolean offhook = false;

@Override
public void onCallStateChanged(int state,String incomingNumber){
switch(state)
{
case TelephonyManager.CALL_STATE_IDLE:
Log.d(TAGTEXT,"IDLE");
Log.d(TAGTEXT,"ringing "+ringing+" offhook "+offhook);
if(ringing&&(!offhook))
{
Log.d(TAGTEXT, "You have missed a call");
ringing = false;
offhook = false;


break; }

case TelephonyManager.CALL_STATE_RINGING:
Log.d(TAGTEXT, "RINGING");
ringing = true;
offhook = false;

break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d(TAGTEXT, "OFFHOOK");
offhook = true;
ringing = false;
break;

default:

break;
}

}}




import java.util.Timer;
import java.util.TimerTask;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;


public class notifydemo extends Activity
{

//private PendingIntent mAlarmSender;

private static final int NOTIFY_ME_ID=1337;
private Timer timer=new Timer();
// private MediaPlayer mMediaPlayer;

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


Button btn=(Button)findViewById(R.id.notify);


btn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{

TimerTask task=new TimerTask()
{
public void run()
{
notifyMe();



}
};
timer.schedule(task, 5000);
}
});


btn=(Button)findViewById(R.id.cancel);


btn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
NotificationManager
mgr=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);


mgr.cancel(NOTIFY_ME_ID);
}
});
}





private void notifyMe()
{
final NotificationManager
mgr=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);


Notification note=new Notification(R.drawable.icon, "Status message!", System.currentTimeMillis());


note.vibrate = new long[] { 100,200,150, 500 };


note.defaults = Notification.DEFAULT_ALL;


PendingIntent i=PendingIntent.getActivity(this, 0,
new Intent(this, notifydemo.class), 0);


note.setLatestEventInfo(this, "Notification Title", "This is the notification message", i);

mgr.notify(NOTIFY_ME_ID, note);




}
}
tbehr
Freshman
Freshman
 
Posts: 9
Joined: Wed Feb 18, 2009 5:03 pm
Location: Chicago

Top

Postby bilge.tutak » Mon Nov 02, 2009 8:43 pm

Is the first example supposed to be working as a stand alone application, or a class for another application?
bilge.tutak
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 30, 2009 7:04 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 7 guests