I have a welcome screen that can be started as the first activity in my app, or it can be started by the main activity that the user spends their time in. I want it to act s
getCallingActivity can return null depending on the activity launch mode as others have pointed out. I was launching the activity by calling startActivityForResult passing in the intent returned by getLaunchIntentForPackage(). By default, it has the FLAG_ACTIVITY_NEW_TASK flag set and this caused the getCallingActivity to return null. Calling intent.setFlags(0) solved the problem for me.