There is a MainActivity that I want to open by reference. For this, I wrote in the manifest:

<activity android:name=".MainActivity" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="mysite.net"/> </intent-filter> </activity> 

Processing in MainActivity:

 @Override protected void onResume(){ super.onResume(); if(getIntent().getData() != null) { showSomething(getIntent().getData().toString()); } } 

Question: why, if the application is in the background, I get an Intent with a zero date, and if the application is closed, then I get the necessary data perfectly?

    1 answer 1

    You should be helped by the redefinition of the void onNewIntent(Intent intent) method to which the updated intent should come. If in this method it is designated as an activation setIntent(intent) ( setIntent(intent) ), then later getIntent() will have to return the necessary instance of it.

    • one
      that's right, you're right as always) thanks - Ivan Vovk