मेरी अग्रभूमि सेवा अधिसूचना पर एंड्रॉयड 4.4.2 क्लिक में मेरी प्रक्रिया मार रहा है पर मार डाला जा रहा है।अग्रभूमि सेवा अधिसूचना क्लिक
पुराने उपकरणों (सैमसंग टैब 2 4.2.2 चल रहा है) पर, मैं हालिया कार्यों से गतिविधि को स्वाइप कर सकता हूं और अभी भी पृष्ठभूमि में ठीक चल रहा है Service
। फिर जब मैं फिर से काफी खुशी से Notification
मेरे ऐप Activity
शुरू होता है पर क्लिक करें।
हालांकि, एक बार मैं अधिसूचना मेरी नेक्सस 7 चल रहा है 4.4.2 मेरी प्रक्रिया मार दिया जाता है (जो जब तक क्लिक पृष्ठभूमि में खुशी से चल रहा है) पर क्लिक करें। PendingIntent
बिल्कुल आग नहीं लगती, या कम से कम, यह BroadcastReceiver
की पहली पंक्ति हिट नहीं करता:
05-21 16:17:38.939: I/ActivityManager(522): Killing 2268:com.test.student/u0a242 (adj 0): remove task
मैं आदेश dumpsys activity proccesses
मैंने का उपयोग कर this जवाब के माध्यम से चलाने की है, और पुष्टि की है कि मेरी सेवा है अग्रभूमि में सही ढंग से चल रहा है।
तो, क्या यह इस अधिसूचना जो मेरे प्रक्रिया मार रहा है पर क्लिक बारे में है?
कोड अग्रभूमि करने के लिए सेवा चलती में शामिल इस प्रकार है:
सेवा:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i("NativeWrappingService", "Starting Service...");
startForeground(NotificationIcon.NOTIFICATION_STUDENT, NotificationManager.getStudentIcon(this).getNotification());
return super.onStartCommand(intent, flags, startId);
}
NotificationIcon: (getStudentIcon(this).getNotification()
)
public Notification getNotification() {
Builder mBuilder = new Builder(mContext);
if(mSmallIcon != -1) mBuilder.setSmallIcon(mSmallIcon);
if(mLargeIcon != null) mBuilder.setLargeIcon(mLargeIcon);
if(mTitle != null) mBuilder.setContentTitle(mTitle);
if(mSubTitle != null) mBuilder.setContentText(mSubTitle);
if(mSubTitleExtra != null) mBuilder.setContentInfo(mSubTitleExtra);
mBuilder.setOngoing(mOngoing);
mBuilder.setAutoCancel(mAutoCancel);
mBuilder.setContentIntent(getPendingIntent(mContext, mAction, mBundle, mActivity));
return mBuilder.build();
}
private PendingIntent getPendingIntent(Context context, String action, Bundle extras, String activity) {
Intent newIntent = new Intent(context, BroadcastToOrderedBroadcast.class);
Bundle bundle;
if(extras != null) bundle = extras;
else bundle = new Bundle();
if(activity != null && !activity.equalsIgnoreCase("")) {
BundleUtils.addActivityToBundle(bundle, activity);
}
BundleUtils.addActionToBundle(bundle, action);
newIntent.putExtras(bundle);
return PendingIntent.getBroadcast(NativeService.getInstance(), mNotificationID, newIntent, PendingIntent.FLAG_UPDATE_CURRENT);
}
यह एक ज्ञात बग है जिसे ट्रैक किया जा रहा है [यहां] (https://code.google.com/p/android/issues/detail?id=53313)। आप समाधान में [टिप्पणी 7 #] सूचीबद्ध (https://code.google.com/p/android/issues/detail?id=53313#c7) की कोशिश कर सकते हैं। –