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
[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 - Unable to stop notification.sound from looping!?

Unable to stop notification.sound from looping!?

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

Unable to stop notification.sound from looping!?

Postby _dirty » Thu Jun 25, 2009 2:02 pm

Hi,

while my "notification.sound = someuri.out.of.my.sharedprefs"

isn't stopping from looping the sound, the vibration does only vibrate
once. This is because it isn't a notification.vibrate(), but a "private Vibrator vibrator;"

Is the Flag "FLAG_ONLY_ALERT_ONCE" not working?

I am able to pick different Ringtones, so this is working.

The ringtone for the app is chosen via a ringtone preference dialog:


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <RingtonePreference
  2.  
  3.                        android:id="@+id/ringtone"
  4.  
  5.                        android:key="ringtone"
  6.  
  7.                        android:title="@string/ringtone_title"
  8.  
  9.                        android:ringtoneType="notification"
  10.  
  11.                        android:showDefault="true"
  12.  
  13.                        android:showSilent="true"
  14.  
  15.                        android:summary="@string/ringtone_summ"
  16.  
  17.                />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4



...and the code for the service looks like that:


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. protected void notifyClient(String from, String message) {
  3.  
  4.  
  5.  
  6.                 notifyCounter++;
  7.  
  8.                 String title = "Message from " + from;
  9.  
  10.                 notification = new Notification(R.drawable.icon, APP_NAME + ": "
  11.  
  12.                                 + title, System.currentTimeMillis());
  13.  
  14.                 Uri userNameUri = Uri.parse(from);
  15.  
  16.                 notificationIntent.setData(userNameUri);
  17.  
  18.                 PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
  19.  
  20. notificationIntent,
  21.  
  22.                                 0);
  23.  
  24.  
  25.  
  26.                 notification.setLatestEventInfo(this, title, message,
  27.  
  28. pendingIntent);
  29.  
  30.                 notification.number = notifyCounter;
  31.  
  32.                 notification.flags = Notification.FLAG_AUTO_CANCEL
  33.  
  34.                                 | Notification.FLAG_ONLY_ALERT_ONCE;
  35.  
  36.  
  37.  
  38.                 vibraNotififaction();
  39.  
  40.                 soundNotification()
  41.  
  42.  
  43.  
  44.                 if (isLEDNotify) {
  45.  
  46.                         notification.flags |= Notification.DEFAULT_LIGHTS;
  47.  
  48.                         notification.ledARGB = Color.MAGENTA;
  49.  
  50.                         notification.ledOnMS = 300;
  51.  
  52.                         notification.ledOffMS = 1000;
  53.  
  54.                         notification.flags |= Notification.FLAG_SHOW_LIGHTS;
  55.  
  56.                 }
  57.  
  58.  
  59.  
  60.                 notificationMGR.notify(NOTIFY_ID, notification);
  61.  
  62.         }
  63.  
  64.  
  65.  
  66.         private void vibraNotififaction() {
  67.  
  68.                 if (isVibraNotify) {
  69.  
  70.                         vibrator.vibrate(500);
  71.  
  72.                 }
  73.  
  74.         }
  75.  
  76.         private void soundNotification(){
  77.  
  78.                 notification.sound = null;
  79.  
  80.                 Uri soundUri = TextUtils.isEmpty(ringNotify) ? null : Uri.parse
  81.  
  82. (ringNotify);
  83.  
  84.                 notification.audioStreamType = AudioManager.STREAM_RING; //tried all the options here and tried without!!!
  85.  
  86.                 notification.sound =  soundUri;
  87.  
  88.         }
  89.  
  90.  
  91.  
  92.         protected void getPreferences(SharedPreferences prefs) {
  93.  
  94.                 this.isLEDNotify = prefs.getBoolean(PreferenceConstants.LEDNOTIFY,
  95.  
  96. false);
  97.  
  98.                 this.isVibraNotify = prefs.getBoolean
  99.  
  100. (PreferenceConstants.VIBRATIONNOTIFY, false);
  101.  
  102.                 this.ringNotify = prefs.getString
  103.  
  104. (PreferenceConstants.RINGTONENOTIFY, null);
  105.  
  106.         }
Parsed in 0.014 seconds, using GeSHi 1.0.8.4
_dirty
Freshman
Freshman
 
Posts: 2
Joined: Sun Apr 05, 2009 8:13 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 14 guests