Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Development Notification Icon Issues
    text
    copied!<p>I am running into a strange issue with notification icons in my application.</p> <p>My application sends and receives data via bluetooth. When the application is started it creates a notification icon of the application (icon.png). It will then see there is no bluetooth device connected and change the icon to (warn.png). The issue is, when the status bar at the top shows warn.png, under the on-going notification drop down it has the origional icon (icon.png) with the text "No Bluetooth Device connected". When a bluetooth device does connect, the status bar icon changes back to the origional icon (icon.png) but under the on-going notification it has the warn icon with the message "Connection Established". </p> <p>Below is the code I used:</p> <pre><code>private void notification_updates(String DISPLAY_TEXT, String ONGOING_TEXT, int ICON) { Intent intent = new Intent(this,GUI.class); intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK | intent.FLAG_ACTIVITY_SINGLE_TOP); try { notification.setLatestEventInfo(Monitor.this, "App_Name",ONGOING_TEXT, PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT)); notification.icon = ICON; notification.tickerText = DISPLAY_TEXT; notification.flags = notification.FLAG_ONGOING_EVENT; //on going events notification.flags += notification.FLAG_NO_CLEAR; //no clear. mManager.notify(APP_ID, notification); } catch(Exception e) { Log.e(TAG, "Failed to Notifiy the notification manager (create):\n" + e.toString()); } </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload