PendingIntent not opening Activity in Android 4.3

前端 未结 2 1860
北海茫月
北海茫月 2020-12-24 06:27

In my Service, I open up a notification on normal run, using this code:

private final static NOTIFICATION_ID = 412434;
private void startNotific         


        
相关标签:
2条回答
  • 2020-12-24 06:43

    That's worked for me:

    Random randomGenerator = new Random();
    int randomInt = randomGenerator.nextInt(100);
    contentIntent = PendingIntent.getActivity(this, randomInt, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    
    0 讨论(0)
  • 2020-12-24 06:51

    There seems to be an issue on some 4.3 devices. It can be resolved by providing a non 0 value to the requestCode parameter.

    Example:

    PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    
    0 讨论(0)
提交回复
热议问题