set flash not working in zxing scanner library - zxing

can u show the full code for button on click method for toggle turn on/off flash when scan? I have try this, but not working, Im using
val mScannerView = object : ZXingScannerView(this) {
override fun createViewFinderView(context: Context?): IViewFinder {
return CustomViewFinderView(context!!)
}
}
btn.setOnclickListener{
if(flashStatus){
mScannerView.setFlash(true)
}else{
mScannerView.setFlash(false)
}
thanks

Related

Ionic v3 One Signal notificacions - How to switch on/off notifications

I'm using one signal notifications with ionic v3 and they're working perfectly. What would be the correct way to activate/deactivate notifications from the app? Im lost here.
I search about this and i have this code:
page.html
<ion-toggle [(ngModel)]="OSnotificaciones" (ionChange)="cambiarNotificacion()" checked="true" ></ion-toggle>
page.ts
OSnotificaciones: boolean = false;
cambiarNotificacion() {
if(this.OSnotificaciones == true){
window.plugins.OneSignal.setSubscription(false);
} else {
window.plugins.OneSignal.setSubscription(true);
}
Any ideas?
You may try something like this :
cambiarNotificacion() {
window["plugins"].OneSignal.setSubscription(this.OSnotificaciones);
Let me know if it works !
EDIT : I did not see before that it was a reverse boolean in your condition, try the new code :
cambiarNotificacion() {
window["plugins"].OneSignal.setSubscription(!this.OSnotificaciones);

How to add popup in google vr view on the click of hotspot.

What I'm trying to do is, When I click on hotspot it should open a popup with little text. It is okay if the text is static, Is there any way we can make it possible? FYI I'm creating it for the web.
Thanks in advance:)
I just started with google VR. I know it's a late reply but it is very possible.
function onVrViewLoad() {
// init scene here and then:
vrView.on('click', onHotspotClick)
}
function onHotspotClick(e) {
console.log('onHotspotClick', e.id)
triggerSidebar(e.id)
}
function triggerSidebar(id) {
// add the class
switch (id) {
case 'item':
document.querySelector('aside.item').classList.add('...')
break
}
}

SmartFace show sliderdrawer

I trying to learn SmartFace App Development Platform. I added a SliderDrawer in Page then after I added codes as follows. But this codes not working in OnShow() event. How can I do this? Maybe I can do with write a lot of code. But I want to do without writing a lot of code.
function Page1_Self_OnShow() {
Pages.Page1.SliderDrawer1.show();
}
This is a known issue for Android, it will be fixed.But you can solve the problem until the bug is fixed as follows:
function Page1_Self_OnShow() {
var timeoutID = setTimeout(function () {
setHello();
}, 200);
function setHello() {
Pages.Page1.SliderDrawer1.show();
}
function cancelHello() {
clearTimeout(timeoutID);
}
}

Titanium_iphone contacts

I am trying to list contacts with Titanium. WOrks on android device, but on iphone simulator doesn't return anything.
var contacts= Ti.Contacts.getAllPeople();
alert("contacts.length");
returns 0. I am not sure what am i missing here.
Make sure that you have contacts created on your iOS simulator:
Use Home button (CMD+Shift+H) to go to dashboard.
Open up Contacts app
Create few contacts which you want to retrieve in your app.
Also before you call Ti.Contacts.getAllPeople() you have to request authorisation to contact list. Try code below:
function processContacts() {
Ti.API.info('authorized');
var contacts = Ti.Contacts.getAllPeople();
Ti.API.info(contacts.length);
}
if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_AUTHORIZED){
processContacts();
} else if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_UNKNOWN){
Ti.Contacts.requestAuthorization(function(e){
if (e.success) {
processContacts();
} else {
Ti.API.info('disallowed');
}
});
} else {
Ti.API.info('disallowed');
}
One last thing, in your code you wrote: alert("contacts.length") which will always display dialog view with "contacts.length" as a string, not value. To call it properly you should write: alert(contacts.length) without double quotes.

alert handling in ui automation iphone app unable to cancel the option

system.logElementTree();
var target = UIATarget.localTarget();
target.onAlert = function onAlert(alert) {
UIALogger.logDebug("There was an alert!");
target.onAlert.buttons()["No"].tap({x:164,y:278});
return false;
even though no option is clicked systen not performing any action
Can anyone please help me ...
Instead of BamboOS suggestion which loops through various positions, you can try this inside your onAlert function:
alert.tapWithOptions({tapOffset:{x:0.5, y:0.6}});
This tap targets the middle of the UIAAlert (x:0.5) and 60% from top to bottom (y:0.6). This works when there is only one button. You have multiple buttons, then you have to changed the value of x. This works for me.
I just published a blog post regarding UI Automation and dealing with alerts:
http://www.conduce.net/Blog.aspx?f=Automated-Test-of-iPad-Apps
Basically following alert handler worked for me:
UIATarget.onAlert = function onAlert(alert){
var name = alert.name();
UIALogger.logMessage("alert "+name+" encountered");
if(name == "errorAlert"){
var positionX = 500;
for(var positionY=300; positionY<600;positionY+=10){
target.tap({x:positionX,y:positionY});
}
return true;
}
return false;
}
I would either use the "cancelButton" or "defaultButton" methods when handling alerts.