Why does FLAG_ACTIVITY_NO_HISTORY not work on the device, but work on the emulator?

I am trying to integrate with the LinkedIn API in my application. Most work just fine, but for 1 release. Here's how it works:

  1. On the settings screen of my applications, the user clicks the "Connect to LinkedIn" button, which opens a web view in which the user must enter their credentials to work with the mouse. The web view starts as follows:

    Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse(liToken.getAuthorizationUrl())); i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(i); 

The above is actually done using the asynctask class.

  1. After successful authorization from linkedin, the web browser disappears and the user returns to the settings page of my applications. Here the user has 2 options. He can either click on the "Save" button or click on the "Cancel" button. The "Save" button saves the settings, and then transfers them to the main lesson, the "Cancel" does not save anything, and then transfers them to the main lesson.

  2. The problem is that all this works fine on the 4.2.2 emulator, but on the Google LG Nexus4 device running 4.2.2, clicking on the β€œSave” or β€œCancel” button returns the β€œweb” view, which is not the desired behavior.

One thing I wanted to draw attention to was that the emulator uses the default Android browser, and does nexus4 use chrome? is this a problem here? Do I need to set any other flag for the intent?

+4
source share
1 answer

Have you tried to clean your project and rebuild? Uninstall the application from the device and reinstall?

+2
source

Source: https://habr.com/ru/post/1487492/


All Articles