Android Open Source - Stack-Chat Jelly Kit Notification Controller






From Project

Back to project page Stack-Chat.

License

The source code is released under:

MIT License

If you think the Android project Stack-Chat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.noahhuppert.stackchat.controllers;
/*from   w w w.j av a2 s  .c o  m*/
/**
 * Created by Noah Huppert on 11/8/2014.
 */

import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;

import com.noahhuppert.stackchat.R;
import com.noahhuppert.stackchat.models.Message;

/**
 * Created by Noah Huppert on 11/8/2014.
 */
public class JellyKitNotificationController extends NotificationController {
    public int showMessage(Message message, Context context){
        int notificationId = 0;

        Notification.Builder builder = new Notification.Builder(context);

        builder.setContentTitle("New message");
        builder.setContentText(message.getContent());
        builder.setSmallIcon(R.drawable.ic_launcher);
        builder.setPriority(Notification.PRIORITY_HIGH);
        builder.setVibrate(new long[]{Notification.DEFAULT_VIBRATE});
        NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

        manager.notify(0, builder.build());

        return notificationId;
    }
}




Java Source Code List

com.noahhuppert.stackchat.ApplicationTest.java
com.noahhuppert.stackchat.MainActivity.java
com.noahhuppert.stackchat.MessagesRecyclerViewAdapter.java
com.noahhuppert.stackchat.controllers.HeaderBuilder.java
com.noahhuppert.stackchat.controllers.JellyKitNotificationController.java
com.noahhuppert.stackchat.controllers.NotificationController.java
com.noahhuppert.stackchat.controllers.PopNotificationController.java
com.noahhuppert.stackchat.fragments.RoomFragment.java
com.noahhuppert.stackchat.models.KVPair.java
com.noahhuppert.stackchat.models.Message.java
com.noahhuppert.stackchat.models.Room.java
com.noahhuppert.stackchat.models.User.java
com.noahhuppert.stackchat.modules.BaseStackChatModule.java
com.noahhuppert.stackchat.modules.StackChatModule.java
com.noahhuppert.stackchat.modules.StackChatModule.java
com.noahhuppert.stackchat.tasks.GetMessagesTask.java
com.noahhuppert.stackchat.tasks.UpdateRoomMessagesTask.java