0
according to the title, I am that problem. I am novice at this and am not managing to migrate to API 23 (Notificationcompat). Could you help me?
Follows my code:
@SuppressWarnings("deprecation")
@Override
public void onStart(Intent intent, int startId) {
Log.d(TAG, "onStart");
mp.start();
// Set the isPlaying preference to true
editor.putBoolean("isPlaying", true);
editor.commit();
Context context = getApplicationContext();
String notifTitle = context.getResources().getString(R.string.app_name);
String notifMessage = context.getResources().getString(R.string.now_playing);
n.icon = R.mipmap.ic_launcher;
n.tickerText = notifMessage;
n.flags = Notification.FLAG_NO_CLEAR;
n.when = System.currentTimeMillis();
Intent nIntent = new Intent(context, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(context, 0, nIntent, 0);
n.NotificationManager(context, notifTitle, notifMessage, pIntent);
// Change 5315 to some nother number
notificationManager.notify(notifId, n);
}
@Override
public void onDestroy() {
Log.d(TAG, "onDestroy");
mp.stop();
mp.release();
mp = null;
editor.putBoolean("isPlaying", false);
editor.commit();
notificationManager.cancel(notifId);
}
}
what error are you having? have a Log, something to facilitate understanding?
– Thiago Luiz Domacoski
Is returning error on line: n.Notificationmanager(context, notifTitle, notifMessage, pIntent);
– msaulohenrique