https://kotlinlang.org logo
d

Dvt1405

09/01/2020, 3:27 PM
i need to start my app from broadcast receiver/ service. i use this intent for it:
Copy code
val intent = Intent(context, SplashScreen.class).apply{
 addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
 setAction(Intent.ACTION_MAIN)
 intent.addCategory(Intent.CATEGORY_LAUNCHER)
}
startActivity(intent);
but seem it not working. some one can tell me reason why and give me solution for it!?
stackoverflow 2
1
l

louiscad

09/01/2020, 3:36 PM
@Dvt1405 This is not Kotlin related. Also, you cannot launch an Activity from the background on Android, you need to use a notification instead, and use a full screen intent if it's extremely urgent like an alarm clock or a phone call.
16 Views