13

I have a lockscreen app, my activity is the first when the user hits unlock power button. I have a website link on the lockscreen-app. When the pattern-unlock is disabled , chrome gets fired with the the website link. But when I enable the security pattern, after the user enters his pattern, chrome app opens but the website is not fired.

pattern-lock enabled

MYLOCK-SCREENAPP > CLICK THE LINK > goes to default lockscreen, user enters pattern > Chrome launches but not the website.

pattern-lock disable

MYLOCK-SCREENAPP > CLICK THE LINK > Chrome launches but not the website.

I am using below, to launch the website.

url="http://(any url)"
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

Would be glad to get this solved. any experts? :)

Mithun
  • 2,075
  • 3
  • 19
  • 26
Ankish Jain
  • 11,305
  • 5
  • 36
  • 34
  • Can you post some more code? I may be able to help if you show how the code is implemented. I am assuming there is something happening between the unlock. Is the website opening when the pattern-lock is disabled? – Eugene H Sep 23 '14 at 15:52
  • 1. If security lock is NOT enabled, it works fine with both Chrome and Opera 2. If security lock IS enabled, clicking on the link of lockscreen app first shows the security keypad and once I unlock there a. And if only Chrome is installed, it does not work. In the logcat, Chrome app does log that it received the VIEW intent, with the right url in the intent data, but nothing after. Chrome just opens an empty tab b. And if both Chrome and Opera are installed, it works fine on either – codaddict Sep 24 '14 at 14:00
  • Exactly.. i have seen apps which fires correct URL in chrome too. Just puzzeled with that. – Ankish Jain Sep 24 '14 at 15:59
  • did you try using a webview with WebChromeClient ? – Pavlos Sep 26 '14 at 17:23
  • Webview is not the solution.Chrome should be fired after the lockscreen. – Ankish Jain Sep 26 '14 at 17:26
  • I did try with, Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(browserIntent); And I have AppLock application, applied on Chrome, Opera and UCBrowser and seems work fine on all of three. – Chitrang Sep 28 '14 at 10:25
  • @Ramyle I have have the same issue just as described. Android Chrome does not load the url behind the lock screen. Were you able to get around this? Any luck AnkishJain? – user3144836 Feb 28 '15 at 01:37

2 Answers2

4

I would open the web page as follows:

public void OpenUrl() {         

    private WebView View;
    View = (WebView) WebDialog.findViewById(R.id.ticketline);  
    View.setWebViewClient(new WebConn());
    View.setScrollbarFadingEnabled(true);  
    View.setHorizontalScrollBarEnabled(false);  
    View.getSettings().setJavaScriptEnabled(true);
    View.loadUrl("url to be loaded goes here");

    getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    WebDialog.show();
}

Alternatively you could try the following:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); 
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("url goes here")); 
startActivity(browserIntent);
finish();

Hope this helps :)

Michele La Ferla
  • 6,775
  • 11
  • 53
  • 79
  • I had tried this earlier. Webview does not render all things of a website correctly. Not a solution to the above problem but a good try. – Ankish Jain Sep 26 '14 at 10:59
  • Yes. Problem is , the chrome to fire after the lockscreen. – Ankish Jain Sep 26 '14 at 11:14
  • Hi @AnkishJain I amended the answer to give you an alternative solution which could work. – Michele La Ferla Sep 28 '14 at 11:40
  • Hi @AnkishJain could you please accept the answer if it has helped you? – Michele La Ferla Oct 17 '14 at 14:29
  • I need to test out. I am working on a solution too. hold on :). I dont think FLAG_DISMISS_KEYGUARD is a good idea.Andoroid security Lockscreen would pop up at later stage , i had tried that . – Ankish Jain Oct 18 '14 at 06:28
  • getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("url goes here")); startActivity(browserIntent); finish(); In this lockscreen will appear again in between when you have a security lock. If there is security , first that should be prompted after that Chrome must load once unlocked. App are doing this , its possible. – Ankish Jain Mar 02 '15 at 03:49
0

I have got the same problem, I believe this is a bug in Chrome as other browsers, like Firefox and Opera, they work properly. But I found a workaround

Android lock screen notification is not able to open Browser on double tapping

Let me know whether this works for you or not.

Community
  • 1
  • 1
Luxi Liu
  • 7,878
  • 2
  • 14
  • 13