androidandroid-layoutandroid-intentandroid-emulatorandroid-4.2-jelly-bean

Why doesn't FLAG_ACTIVITY_NO_HISTORY work on device, but works on emulator?


I am trying to integrate with the LinkedIn api within my app. Most of it is working just fine but for 1 issue. This is how it works:

  1. From my apps settings screen, the user clicks on connect to LinkedIn button which brings up the web view where the user has to enter their linkedin credentials. The web view is launched the following way:

    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 via an asynctask class.

  1. After successful auth from linkedin, the web view goes away and the user comes back to my apps settings page. Here the user has 2 options. He can either click on save or can hit the cancel button. Save button saves the settings and then takes them to the main activity, cancel doesn't save anything and then takes them to the main activity.

  2. The problem is, this all works just fine on 4.2.2 emulator, but on a Google LG Nexus4 device running 4.2.2, hitting on either the save or the cancel button brings back the linkedin webview, which is not the desired behavior.

One thing that I wanted to point out was that the emulator uses the default android browser while nexus4 uses chrome? is that the problem here? Do I need to set some other flag on the intent?


Solution

  • Have you tried cleaning your project and rebuilding? Delete the app from the device and reinstall?