How to start activity when user clicks a notification?

后端 未结 6 1234
梦如初夏
梦如初夏 2020-12-05 11:18

I am attempting to convert some code I found in a tutorial for my own use. Originally, the code launched the system contacts list when the user would click a notification ge

6条回答
  •  盖世英雄少女心
    2020-12-05 11:59

    you should set action and category for Intent.

    Intent startMyActivity = new Intent(context, ourClass);
    startMyActivity .setAction(Intent.ACTION_MAIN);
    startMyActivity .addCategory(Intent.CATEGORY_LAUNCHER);
    

    it works

提交回复
热议问题