I created a running service that generates a notification with a button. I would like to create a listener in the service to do something when the button is pressed.
The notification is simple with an addaction statement.
I success on sending data to a external broadcaster receiver but no luck with a local one.
I'm just trying to change a boolean value of the service from the notification.
Thank you
public class TrackerService extends Service {
private static final int REQUEST_RESULT = 200;
final static String PANIC_ACTION = "PANIC";
private Point point = new Point();
private static final String TAG = "TrackerService";
private static final String NOTIFICATION_CHANNEL_ID = "tracker_service.channel";
private IntentFilter panicIntentFilter;
protected final IBinder binder = new TrackerServiceBinder();
public BroadcastReceiver trackerServiceBroadcastReceiver;
#Override
public void onCreate() {
super.onCreate();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O)
startMyOwnForeground();
else
startForeground(1, new Notification());
panicIntentFilter = new IntentFilter();
panicIntentFilter.addAction("PANIC");
this.registerReceiver(trackerServiceBroadcastReceiver, panicIntentFilter);
}
public class trackerServiceBroadcastReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG + " TSRECEIVER","Complete intent: " + intent.toString() + " extras intent: " + intent.getExtras().toString());
if (intent.getAction().equals("PANIC") && intent.hasExtra("PANIC")){
if (intent.getExtras().getBoolean("PANIC")) {
//point.setPanicState(true);
Log.d(TAG + " TSRECEIVER", "panic pressed - point.getPanic(): " + "true");
} else {
//point.setPanicState(false);
Log.d(TAG + " TSRECEIVER", "panic pressed - point.getPanic(): " + "false");
}
}
}
}
public class TrackerServiceBinder extends Binder {
public TrackerService getServiceInstance() {
return TrackerService.this;
}
}
public Boolean TogglePanicState() {
point.setPanicState( !point.getPanicState() );
return point.getPanicState();
}
#RequiresApi(Build.VERSION_CODES.O)
private void startMyOwnForeground() {
Intent panicIntent = new Intent(this, trackerServiceBroadcastReceiver.class); // Prueba al broadcaster local
//Intent panicIntent = new Intent(this, TrackerService.class); // Prueba al servicio
//Intent panicIntent = new Intent(this, NotificationReceiver.class); // Prueba a un Broadcaster externo - Funciona
panicIntent.setAction("PANIC");
panicIntent.putExtra("PANIC", true);
PendingIntent panicPendingIntent = PendingIntent.getBroadcast(this, 123456, panicIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Log.d(TAG + " Notification","Complete intent: " + panicIntent.toString() + " extras intent: " + panicIntent.getExtras().toString() + " Complete PendingIntent: " + panicPendingIntent.toString());
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Tracker Service - Channel", NotificationManager.IMPORTANCE_NONE);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
assert manager != null;
manager.createNotificationChannel(chan);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
Notification notification = notificationBuilder.setOngoing(true)
.setSmallIcon(R.drawable.ou)
.setPriority(NotificationManager.IMPORTANCE_MIN)
.setCategory(Notification.CATEGORY_SERVICE)
.addAction(R.drawable.alarm, "PANIC", panicPendingIntent)
.build();
startForeground(1, notification);
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
return START_STICKY;
}
#Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(trackerServiceBroadcastReceiver);
}
#Override
public IBinder onBind(Intent intent) {
return binder;
}
}
Related
In our android webview app, we start a foreground service (RingtonePlayingservice.class) from our firebase.class on notification action. The foreground service in turn starts playing the ringtone vide mediaplayer. The ringtone runs to like 10 seconds and stops, so we implemented setloop parameter, but still the mediaplayer just stops without looping at all. We are at loss as where we are going wrong. The codes are as given below
Firebase.Class (summarized)
public class Firebase extends FirebaseMessagingService {
public static Ringtone ringtone;
Intent i = new Intent(this, RingtonePlayingService.class);
this.startForegroundService(i);
}
Ringtoneplayingservice class
public class RingtonePlayingService extends Service {
private static final String TAG = RingtonePlayingService.class.getSimpleName();
private static final String URI_BASE = RingtonePlayingService.class.getName() + ".";
public static final String ACTION_DISMISS = URI_BASE + "ACTION_DISMISS";
public static final String ACTION_START = URI_BASE + "ACTION_START";
private MediaPlayer mp;
#Override
public IBinder onBind(Intent intent) {
return null;
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand");
if (intent == null) {
Log.d(TAG, "The intent is null.");
return START_REDELIVER_INTENT;
}
String action = intent.getAction();
if (ACTION_DISMISS.equals(action)) {
int notificationId = intent.getIntExtra("notificationId", 0);
dismissRingtone();
NotificationManager notificationManager =
(NotificationManager) getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
notificationManager.cancel(notificationId);
}
else {
mp = MediaPlayer.create(this, Settings.System.DEFAULT_RINGTONE_URI);
mp.setlooping (true);
mp.start();
}
return START_STICKY;
}
public void dismissRingtone() {
// stop the alarm rigntone
Intent i = new Intent(this, RingtonePlayingService.class);
this.stopService(i);
}
#Override
public void onDestroy() {
super.onDestroy();
if(mp.isPlaying())
{
mp.reset();
}
else {
}
}}
Any help would be deeply appreciated
I made an Android app that should play a sound when event is received, it works when app is in focus, but when the app is closed/collapsed sound doesnt play, only standard notification.
How to start a sound/music that is placed inside the app when app with the foreground service?
Main activity:
public class MainActivity extends AppCompatActivity {
private Intent alarmServiceIntent;
private ServiceConnection sConn;
private boolean bound;
private boolean alarm = false;
#RequiresApi(api = Build.VERSION_CODES.O)
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Init();
}
private void Init() {
alarmServiceIntent = new Intent(this, AlarmService.class);
sConn = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder binder) {
bound = true;
}
public void onServiceDisconnected(ComponentName name) {
bound = false;
}
};
ContextCompat.startForegroundService(this, alarmServiceIntent);
}
private void playAlarm() {
bindService(alarmServiceIntent, sConn, BIND_AUTO_CREATE);
}
public void stopAlarm(View v) {
if (sConn != null ) {
unbindService(sConn);
}
if(alarmServiceIntent != null) {
stopService(alarmServiceIntent);
}
}
//here is the method to receive event and call playAlarm
}
Alarm service:
public class AlarmService extends Service{
private final String CHANNEL_ID = "ID";
private final String CHANNEL_NAME = "NAME";
private IBinder mBinder = new MyBinder();
private MediaPlayer player;
#Nullable
#Override
public IBinder onBind(Intent intent) {
play();
return mBinder;
}
#Override
public boolean onUnbind(Intent intent) {
onStop();
return super.onUnbind(intent);
}
#Override
public void onCreate() {
player = MediaPlayer.create(this,R.raw.alarm);
player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
super.onCreate();
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity
(this, 0, notificationIntent, PendingIntent.FLAG_MUTABLE);
}
else
{
pendingIntent = PendingIntent.getActivity
(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT);
}
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("TITLE")
.setSmallIcon(R.mipmap.icon)
.setContentIntent(pendingIntent)
.build();
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel( CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
mNotificationManager.createNotificationChannel(channel);
new NotificationCompat.Builder(this, CHANNEL_ID);
}
startForeground(619, notification);
return START_REDELIVER_INTENT;
}
public void play() {
if(player == null) {
player = MediaPlayer.create(this,R.raw.alarm);
player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
}
Log.v("ALARM", "play: 12345");
player.setAudioAttributes(
new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
.setUsage(AudioAttributes.USAGE_ALARM)
.build()
);
player.setVolume(2,2);
AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
// audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);
player.setLooping(true);
player.start();
}
class MyBinder extends Binder {
AlarmService getService(){
return AlarmService.this;
}
}
}
You should override onDestroy method and call stop there.
#Override
public void onDestroy() {
player.stop();
}
SO, I have a MainActivity that has a button which starts a service, MyService. I want the service to show the notification with a custom title,text,icon,etc. The service is a foreground service. not a bound service. everything works fine but the only thing is about my notification is keep showing "tap for more information" and clicking on it leads me to the settings page of my application. despite having the pendingIntent on my MainActivity.
What I want is to have a Notification with custom Title,Text,icon and an action to stop the service.
this is my MainActivity.java class
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.start_tracking).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startCommand();
}
});
}
void startCommand() {
startService(new Intent(this, MyService.class));
}
}
Myservice.java file
public class MyService extends Service {
boolean mServiceIsStarted = false;
void moveToStartedState() {
Intent myIntentbuilder = new IntentBuilder(this).setmCommandId(Command.START).build();
Log.d(TAG, "moveToStartedState: Running on Android O - startForegroundService(intent)");
ContextCompat.startForegroundService(this, myIntentbuilder);
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand: ");
boolean containsCommand = IntentBuilder.containsCommand(intent);
routeIntentToCommand(intent);
return START_NOT_STICKY;
}
void routeIntentToCommand(Intent intent) {
if (intent != null) {
if (IntentBuilder.containsCommand(intent)) {
processCommand(IntentBuilder.getCommand(intent));
} else
commandStart();
}
}
#Override
public void onCreate() {
super.onCreate();
Log.d(TAG, "onCreate: ");
}
void showNotification() {
Log.d(TAG, "showNotification: ");
HandleNotification.O.createNotification(this);
}
private void processCommand(int command) {
try {
switch (command) {
case Command.START:
commandStart();
break;
case Command.STOP:
commandStop();
break;
}
} catch (Exception e) {
e(TAG, "processCommand: exception", e);
}
}
void commandStop() {
stopSelf();
stopForeground(true);
}
void commandStart() {
if (!mServiceIsStarted) {
mServiceIsStarted = true;
moveToStartedState();
return;
}
//
HandleNotification.O.createNotification(this);
}
#Nullable
#Override
public IBinder onBind(Intent intent) {
return null;
}
}
IntentBuilder.java class
#IntDef({Command.INVALID, Command.STOP, Command.START})
#Retention(RetentionPolicy.SOURCE)
#interface Command {
int INVALID = -1;
int STOP = 0;
int START = 1;
}
public class IntentBuilder {
private static final String KEY_MESSAGE = "msg";
private static final String KEY_COMMAND = "cmd";
private Context mContext;
private String mMessage;
private #Command
int mCommandId = Command.INVALID;
public static IntentBuilder getInstance(Context mContext) {
return new IntentBuilder(mContext);
}
public IntentBuilder(Context mContext) {
this.mContext = mContext;
}
public void setmContext(Context mContext) {
this.mContext = mContext;
}
public IntentBuilder setmMessage(String mMessage) {
this.mMessage = mMessage;
return this;
}
public IntentBuilder setmCommandId(int mCommandId) {
this.mCommandId = mCommandId;
return this;
}
private static final String TAG = "IntentBuilder";
public Intent build() {
Log.e(TAG, "build: context cannot be null" + mContext);
Intent intent = new Intent(mContext, MyService.class);
if (mMessage != null)
intent.putExtra(KEY_MESSAGE, mMessage);
if (mCommandId != Command.INVALID)
intent.putExtra(KEY_COMMAND, mCommandId);
return intent;
}
public static boolean containsCommand(Intent intent) {
return intent.getExtras() != null && intent.getExtras().containsKey(KEY_COMMAND);
}
public static boolean containsMessage(Intent intent) {
return intent.getExtras() != null && intent.getExtras().containsKey(KEY_MESSAGE);
}
public static #Command
int getCommand(Intent intent) {
final #Command int commandId = intent.getExtras().getInt(KEY_COMMAND);
return commandId;
}
public static String getMessage(Intent intent) {
return intent.getExtras().getString(KEY_MESSAGE);
}
}
HandleNotification.java file
public class HandleNotification {
public static class O {
public static int getRandomNumber() {
return new Random().nextInt(100000);
}
static PendingIntent getLaunchActivityPI(Service context) {
Intent intent = new Intent(context, MainActivity.class);
return PendingIntent.getActivity(context, getRandomNumber(), intent, 0);
}
static PendingIntent getStopServicePI(Service context) {
PendingIntent pendingIntent;
{
Intent intent = new IntentBuilder(context).setmCommandId(Command.STOP).build();
pendingIntent = PendingIntent.getService(context, getRandomNumber(), intent, 0);
}
return pendingIntent;
}
public static final Integer ONGOING_NOTIFICATION_ID = getRandomNumber();
public static final String CHANNEL_ID = String.valueOf(getRandomNumber());
private static final String TAG = "O";
public static void createNotification(Service context) {
Log.d(TAG, "createNotification: ");
String channelId = createChannel(context);
Notification notification = buildNotification(channelId, context);
context.startForeground(ONGOING_NOTIFICATION_ID, notification);
}
static Notification buildNotification(String channelId, Service context) {
PendingIntent piMainActivity = getLaunchActivityPI(context);
PendingIntent piStopService = getStopServicePI(context);
Icon poweroff = Icon.createWithResource(context, android.R.drawable.star_big_on);
Notification.Action stopAction = new Notification.Action
.Builder(poweroff, "STOP", piStopService).build();
return new Notification.Builder(context, channelId)
.addAction(stopAction)
.setContentTitle("Tracking...")
.setContentText("I'm tracking your location now... ")
.setContentIntent(piMainActivity)
.build();
}
#NonNull
private static String createChannel(Context service) {
NotificationManager notificationManager = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence channelName = "Start Location Updates";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, channelName, importance);
notificationManager.createNotificationChannel(notificationChannel);
return CHANNEL_ID;
}
}
}
Use NotificationCompat.Builder. You can follow how to create one here
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle(textTitle)
.setContentText(textContent)
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
You can add your custom small or big icon, title, content, and other properties.
An example from a project that I did long ago
private void LockNotification() {
NotificationCompat.Builder builder = new
NotificationCompat.Builder(getApplicationContext());
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra("key","launch_about");
PendingIntent pendingIntent =
PendingIntent.getActivity(getApplicationContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
// Set the title, text, and icon
builder.setContentTitle(getString(R.string.app_name))
.setContentText("App Lock Enabled")
.setSmallIcon(R.drawable.ic_applock)
.setContentIntent(pendingIntent)
.setOngoing(true);
// Get an instance of the Notification Manager
NotificationManager notifyManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
// Build the notification and post it
notifyManager.notify(0, builder.build());
}
I have tried this code, but something happened unexpectedly. I can see a push message on my phone, but I can’t see the log in Android Studio. I think the method onMessageReceived isn’t working. Why did this happen?
My code follows.
MyFirebaseMessagingService.java
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
private boolean isVibrator = true;
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "From: " + remoteMessage.getFrom());
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
//vibrator();
}
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: "+remoteMessage.getNotification().getBody());
vibrator();
}
}
private void vibrator(){
if(isVibrator){
Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long[] pattern = {200,1000,150,1500,100,2000,50,3000};
vibe.vibrate(pattern, -1);
}
}
private void sendNotification(String messageBody) {
vibrator();
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)//.setSmallIcon(R.drawable.ic_stat_ic_notification)
.setContentTitle("FCM Message")
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
/* PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakelock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
PowerManager.ACQUIRE_CAUSES_WAKEUP, "TAG");
wakelock.acquire(5000);*/
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
}
MyFirebaseInstanceIDService.java
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseIIDService";
#Override
public void onTokenRefresh() {
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
sendRegistrationToServer(refreshedToken);
}
private void sendRegistrationToServer(String token) {
Log.d(TAG, "send Server");
}
}
I've been trying to learn how to use notifications in Android by creating an application that creates, displays, and deletes notifications with button clicks (to clarify it will display the notifications in app). Now I can easily get my program to create notifications but when I try to delete the notification or display it I keep getting nulls and when I change the code up nothing. I found a few tutorials that helped me understand what I should be doing but the code they wrote did not work and I've hit a wall at this point. Here is my main activity:
public class MainActivity extends Activity {
private TextView txtView;
private NotificationReceiver nReceiver;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtView = (TextView) findViewById(R.id.textView);
nReceiver = new NotificationReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction("com.testing.notify.NOTIFICATION");
registerReceiver(nReceiver,filter);
}
#Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(nReceiver);
}
public void buttonClicked(View v){
if(v.getId() == R.id.btnCreateNotify){
NotificationManager nManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationCompat.Builder ncomp = new NotificationCompat.Builder(this);
ncomp.setSmallIcon(R.mipmap.ic_launcher);
ncomp.setContentTitle("Notify");
ncomp.setContentText("Notification Listener Service Example");
ncomp.setTicker("Notification Listener Service Example");
ncomp.setAutoCancel(true);
nManager.notify((int)System.currentTimeMillis(),ncomp.build());
}
else if(v.getId() == R.id.btnClearNotify){
Intent i = new Intent("com.testing.notify.NOTIFICATION");
i.putExtra("command","clearall");
sendBroadcast(i);
}
else if(v.getId() == R.id.btnListNotify){
Intent i = new Intent("com.testing.notify.NOTIFICATION");
i.putExtra("command","list");
sendBroadcast(i);
}
}
class NotificationReceiver extends BroadcastReceiver{
#Override
public void onReceive(Context context, Intent intent) {
String temp = intent.getStringExtra("notification_event") + "n" + txtView.getText();
txtView.setText(temp);
}
}
And here is the code to my notification service class
public class NotificationService extends NotificationListenerService {
private String TAG = this.getClass().getSimpleName();
private NLServiceReceiver nlservicereceiver;
#Override
public void onCreate() {
super.onCreate();
nlservicereceiver = new NLServiceReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction("com.testing.notify.NOTIFICATION");
registerReceiver(nlservicereceiver,filter);
}
#Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(nlservicereceiver);
}
#Override
public void onNotificationPosted(StatusBarNotification sbn) {
Log.i(TAG,"********** onNotificationPosted");
Log.i(TAG,"ID :" + sbn.getId() + "t" + sbn.getNotification().tickerText + "t" + sbn.getPackageName());
Intent i = new Intent("com.testing.notify.NOTIFICATION");
i.putExtra("notification_event","onNotificationPosted :" + sbn.getPackageName() + "n");
sendBroadcast(i);
}
#Override
public void onNotificationRemoved(StatusBarNotification sbn) {
Log.i(TAG,"********** onNotificationRemoved");
Log.i(TAG,"ID :" + sbn.getId() + "t" + sbn.getNotification().tickerText +"t" + sbn.getPackageName());
Intent i = new Intent("com.testing.notify.NOTIFICATION");
i.putExtra("notification_event","onNotificationRemoved :" + sbn.getPackageName() + "n");
sendBroadcast(i);
}
class NLServiceReceiver extends BroadcastReceiver{
#Override
public void onReceive(Context context, Intent intent) {
if(intent.getStringExtra("command").equals("clearall")){
NotificationManager notifManager= (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notifManager.cancelAll();
}
else if(intent.getStringExtra("command").equals("list")){
Intent i1 = new Intent("com.testing.notify.NOTIFICATION");
i1.putExtra("notification_event","=====================");
sendBroadcast(i1);
int i=1;
for (StatusBarNotification sbn : NotificationService.this.getActiveNotifications()) {
Intent i2 = new Intent("com.testing.notify.NOTIFICATION");
i2.putExtra("notification_event",i +" " + sbn.getPackageName() + "n");
sendBroadcast(i2);
i++;
}
Intent i3 = new Intent("com.testing.notify.NOTIFICATION");
i3.putExtra("notification_event","===== Notification List ====");
sendBroadcast(i3);
}
}
}
I've been trying to figure this out for a while now so any help would be appreciated.