1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 17:02:21 -05:00

Set vibration pattern (default does not always work)

This commit is contained in:
Sebastian Kaspari 2010-12-17 22:19:36 +01:00
parent 832a462bfd
commit 4b3e47c799

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package org.yaaic.irc;
import java.lang.reflect.InvocationTargetException;
@ -51,8 +51,8 @@ import android.content.Intent;
*/
public class IRCService extends Service
{
private IRCBinder binder;
private HashMap<Integer, IRCConnection> connections;
private final IRCBinder binder;
private final HashMap<Integer, IRCConnection> connections;
private boolean foreground = false;
@SuppressWarnings("rawtypes")
@ -66,8 +66,8 @@ public class IRCService extends Service
private NotificationManager notificationManager;
private Method mStartForeground;
private Method mStopForeground;
private Object[] mStartForegroundArgs = new Object[2];
private Object[] mStopForegroundArgs = new Object[1];
private final Object[] mStartForegroundArgs = new Object[2];
private final Object[] mStopForegroundArgs = new Object[1];
private Notification notification;
private Settings settings;
@ -203,9 +203,12 @@ public class IRCService extends Service
notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent);
if (vibrate) {
notification.defaults |= Notification.DEFAULT_VIBRATE;
long[] pattern = {0,100,200,300};
notification.vibrate = pattern;
}
notificationManager.notify(R.string.app_name, notification);
}
}
@ -266,6 +269,7 @@ public class IRCService extends Service
public void connect(final Server server)
{
new Thread() {
@Override
public void run() {
try {
IRCConnection connection = getConnection(server.getId());