Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Open an app from kiosk mode #77

Open
JoseGeorges8 opened this issue Aug 13, 2019 · 1 comment
Open

Open an app from kiosk mode #77

JoseGeorges8 opened this issue Aug 13, 2019 · 1 comment

Comments

@JoseGeorges8
Copy link

Is there a way of launching an app while on kiosk mode?

I'm using the FileOpener2 plugin to open files in different apps (e.g pdf files on a pdf viewer) however while on kiosk mode the app will close instantaneously.

I've been looking at their plugin source code and there's two ways the intent gets called to launch the app

...
			} else {
					intent = new Intent(Intent.ACTION_VIEW);
					Context context = cordova.getActivity().getApplicationContext();
					Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file);
					intent.setDataAndType(path, contentType);
					intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_ACTIVITY_NO_HISTORY);

				}

				/*
				 * @see
				 * http://stackoverflow.com/questions/14321376/open-an-activity-from-a-cordovaplugin
				 */
				 if(openWithDefault){
					 cordova.getActivity().startActivity(intent);
				 }
				 else{
					 cordova.getActivity().startActivity(Intent.createChooser(intent, "Open File in..."));
				 }
...

The openWithDefault does not work. However if it goes through the else statement and it calls the chooser, the chooser does show and I can select an app and it will properly launch.

That is not the behavior me and my team want. We need openWithDefault to work with the kiosk mode and I'm trying to fork a solution to either plugin but I'm not sure how the kiosk will handle this. I'm still not sure why an intent with ACTION_CHOOSER works but not an intent with ACTION_VIEW

@acedigibits
Copy link

i wanted to launch app but doesnt work as kiosk mode makes cordova app as front app. is there any workaround that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants