Ionic cordova camera is not available
I want to use QrScanner in my application. So I installed
ionic cordova plugin add cordova-plugin-qrscanner
npm install --save @ionic-native/qr-scanner@beta
plugins, then I do ionic cordova run browser, then I access the produced url in my mobile. When ever I try to open the qr scanner it always shows camera is not available
. Even though my mobile has camera, I tested in both android and in ios, but the results are same. Here is my code
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
// camera permission was granted
// start scanning
const scanSub = this.qrScanner.scan().subscribe((text: string) => {
console.log('Scanned something', text);
this.sharedAlertService.presentBasicAlert('Authorized', '', JSON.stringify(text));
this.qrScanner.hide(); // hide camera preview
scanSub.unsubscribe(); // stop scanning
});
} else if (status.denied) {
this.sharedAlertService.presentBasicAlert('Denied', '', 'No permission');
// camera permission was permanently denied
// you must use QRScanner.openSettings() method to guide the user to the settings page
// then they can grant the permission from there
} else {
// permission was denied, but not permanently. You can ask for permission again at a later time.
}
})
.catch((e: any) => this.sharedAlertService.presentBasicAlert('Error', '', JSON.stringify(e)));
What is the solution to access qr scanner in the browsers? Thank you.
cordova ionic-framework cordova-plugins ionic4
add a comment |
I want to use QrScanner in my application. So I installed
ionic cordova plugin add cordova-plugin-qrscanner
npm install --save @ionic-native/qr-scanner@beta
plugins, then I do ionic cordova run browser, then I access the produced url in my mobile. When ever I try to open the qr scanner it always shows camera is not available
. Even though my mobile has camera, I tested in both android and in ios, but the results are same. Here is my code
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
// camera permission was granted
// start scanning
const scanSub = this.qrScanner.scan().subscribe((text: string) => {
console.log('Scanned something', text);
this.sharedAlertService.presentBasicAlert('Authorized', '', JSON.stringify(text));
this.qrScanner.hide(); // hide camera preview
scanSub.unsubscribe(); // stop scanning
});
} else if (status.denied) {
this.sharedAlertService.presentBasicAlert('Denied', '', 'No permission');
// camera permission was permanently denied
// you must use QRScanner.openSettings() method to guide the user to the settings page
// then they can grant the permission from there
} else {
// permission was denied, but not permanently. You can ask for permission again at a later time.
}
})
.catch((e: any) => this.sharedAlertService.presentBasicAlert('Error', '', JSON.stringify(e)));
What is the solution to access qr scanner in the browsers? Thank you.
cordova ionic-framework cordova-plugins ionic4
add a comment |
I want to use QrScanner in my application. So I installed
ionic cordova plugin add cordova-plugin-qrscanner
npm install --save @ionic-native/qr-scanner@beta
plugins, then I do ionic cordova run browser, then I access the produced url in my mobile. When ever I try to open the qr scanner it always shows camera is not available
. Even though my mobile has camera, I tested in both android and in ios, but the results are same. Here is my code
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
// camera permission was granted
// start scanning
const scanSub = this.qrScanner.scan().subscribe((text: string) => {
console.log('Scanned something', text);
this.sharedAlertService.presentBasicAlert('Authorized', '', JSON.stringify(text));
this.qrScanner.hide(); // hide camera preview
scanSub.unsubscribe(); // stop scanning
});
} else if (status.denied) {
this.sharedAlertService.presentBasicAlert('Denied', '', 'No permission');
// camera permission was permanently denied
// you must use QRScanner.openSettings() method to guide the user to the settings page
// then they can grant the permission from there
} else {
// permission was denied, but not permanently. You can ask for permission again at a later time.
}
})
.catch((e: any) => this.sharedAlertService.presentBasicAlert('Error', '', JSON.stringify(e)));
What is the solution to access qr scanner in the browsers? Thank you.
cordova ionic-framework cordova-plugins ionic4
I want to use QrScanner in my application. So I installed
ionic cordova plugin add cordova-plugin-qrscanner
npm install --save @ionic-native/qr-scanner@beta
plugins, then I do ionic cordova run browser, then I access the produced url in my mobile. When ever I try to open the qr scanner it always shows camera is not available
. Even though my mobile has camera, I tested in both android and in ios, but the results are same. Here is my code
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
// camera permission was granted
// start scanning
const scanSub = this.qrScanner.scan().subscribe((text: string) => {
console.log('Scanned something', text);
this.sharedAlertService.presentBasicAlert('Authorized', '', JSON.stringify(text));
this.qrScanner.hide(); // hide camera preview
scanSub.unsubscribe(); // stop scanning
});
} else if (status.denied) {
this.sharedAlertService.presentBasicAlert('Denied', '', 'No permission');
// camera permission was permanently denied
// you must use QRScanner.openSettings() method to guide the user to the settings page
// then they can grant the permission from there
} else {
// permission was denied, but not permanently. You can ask for permission again at a later time.
}
})
.catch((e: any) => this.sharedAlertService.presentBasicAlert('Error', '', JSON.stringify(e)));
What is the solution to access qr scanner in the browsers? Thank you.
cordova ionic-framework cordova-plugins ionic4
cordova ionic-framework cordova-plugins ionic4
asked Nov 15 '18 at 11:41
e.ke.k
348116
348116
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The Camera is not natively supported in the browser, so you're kind of out of luck using it natively. Your best bet is to create mock data for the browser, which will simulate using it, and return the dummy data.
Ionic has an article about it that explains it in more depth.
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318713%2fionic-cordova-camera-is-not-available%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Camera is not natively supported in the browser, so you're kind of out of luck using it natively. Your best bet is to create mock data for the browser, which will simulate using it, and return the dummy data.
Ionic has an article about it that explains it in more depth.
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
add a comment |
The Camera is not natively supported in the browser, so you're kind of out of luck using it natively. Your best bet is to create mock data for the browser, which will simulate using it, and return the dummy data.
Ionic has an article about it that explains it in more depth.
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
add a comment |
The Camera is not natively supported in the browser, so you're kind of out of luck using it natively. Your best bet is to create mock data for the browser, which will simulate using it, and return the dummy data.
Ionic has an article about it that explains it in more depth.
The Camera is not natively supported in the browser, so you're kind of out of luck using it natively. Your best bet is to create mock data for the browser, which will simulate using it, and return the dummy data.
Ionic has an article about it that explains it in more depth.
answered Nov 15 '18 at 16:27
Jordan BengeJordan Benge
3431317
3431317
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
add a comment |
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Thank you I will explore more about this.
– e.k
Nov 16 '18 at 5:59
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
Please accept the answer, if it helped solve your problem.
– Jordan Benge
Nov 17 '18 at 18:34
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318713%2fionic-cordova-camera-is-not-available%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown