Uncaught TypeError: chrome.hid.getUserSelectedDevices is not a function - google-chrome-app

Is the chrome.hid.getUserSelectedDevices method does not work anymore? I tested it in Chrome OS 96 by creating a chrome app but it says chrome.hid.getUserSelectedDevices is not a function.
chrome.power.requestKeepAwake(chrome.power.Level.DISPLAY);
const getDevicesButton = document.getElementById('getDevicesButton');
getDevicesButton.onclick = () => {
const device = chrome.hid.getUserSelectedDevices({}, ()=> console.log('running...'));
console.log(JSON.stringify(device));
};
used the permissions in manifest.json:
"permissions": [
"system.display",
"power",
"hid",
"usb"
]

Related

Login with Apple Id in Flutter?

Here is my login page, actually it should login, but I got error
I included sign in capabilities in XCODE
Xcode configurations all set
**
Error Message I got : Unhandled Exception: SignInWithAppleAuthorizationError(AuthorizationErrorCode.canceled, The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1001.))**
child: InkWell(
onTap: () async {
final credential =
await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.fullName,
AppleIDAuthorizationScopes.email,
],
);
print(credential);
context.read<SignInBloc>().add(
SignInEvent.signInWithApple(
appleToken: credential.authorizationCode,
),
);
},
Above is my function to sign in with Apple Id
App Identifier create to "Sign in with Apple" checkbox selection
like that

Puppeteer | Launching and running Chrome (not Chromium) on Visual Studio Code

I have tried my .js project with Chromium but it was very slow rather than Chrome's itself. So i decided running my program with Chrome on VS Code but this time VS Code created a file named launch.json and i couldn't achieve to bind index.js to launch.json.
Summary of my question, how can i run my script in Chrome on VS Code? What should i do to run launch.json and index.js together? I will leave my code blocks now.
launch.json:
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "url",
"webRoot": "${workspaceFolder}"
}
]
}
index.js:
const puppeteer = require('puppeteer')
const fs = require('fs/promises')
async function start() {
const browser = await puppeteer.launch({headless: false})
const page = await browser.newPage()
await page.waitForSelector('selector')
await browser.close()
}
start()
I didn't try anything essentially, because i don't know about solution. I researched on Google, Stackoverflow and Youtube too many times (2 days at least, maybe i can't find keyword because of my poor English) I described my problem as much as i can.
I must add, executablePath solution didn't work for me and
" crbug/1173575, non-JS module files deprecated. "
this error message appears on my debbugging console.
thx
Running program with Windows PowerShell is solution. The code that i execute:
const puppeteer = require('puppeteer')
const fs = require('fs/promises')
async function start() {
const browser = await puppeteer.launch( { headless: false,
executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' })
const page = await browser.newPage()
await page.waitForSelector('selector')
await browser.close()
}
start()
So yes, executablePath is a solution, if you don't try that on VS Code.

Redirect IdentityServer Ionic 5 Capacitor Android emulator

I have Identity Server 4 working with an Ionic 5 APP which works fine when I run the app in the browser. When I run it in Android studio with the emulator, I then have to make some changes to the configuration such as 10.0.2.2 to target the local IS.
When I connect to IS4 from the emulator I can see in the logs that the origin received in IS is http://localhost which makes sense since I have the APP configured in Capacitor (https://ionicframework.com/docs/troubleshooting/cors#capacitor). My problem is that when I try to redirect back, the in app browser is trying to open the URL is http://localhost/<something> which does not exist.
My question is, how can I correctly perform the redirect back to the android emulator? I can debug and I correctly sign in, but somehow when IS performs the redirect to /connect/authorize... I then get the app stuck.
capacitor.config.json:
{
"appId": "com.example.app",
"appName": "com.example.app",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "www",
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
}
},
"cordova": {},
"allowMixedContent": true
}
My Auth configuration:
auth_config: {
identity_client: 'mobile_app',
identity_server: 'http://10.0.2.2:13810',
redirect_url: 'com.example.app://auth-callback',
end_session_redirect_url: 'com.example.app://end-session',
scopes: 'openid profile exampleapi',
usePkce: true
},
browserAuthorityUrl: 'http://localhost:13810',
Identity server client configuration:
new Client
{
ClientId = "mobile_app",
ClientName = "Mobile APP Ionic Angular 9 Client",
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RequireClientSecret = false,
AllowedScopes = new List<string> { "openid", "profile", "exampleapi" },
RedirectUris = new List<string> {
$"{mobileBaseUrl}/auth-callback",
$"{mobileAppBaseUrl}auth-callback",
$"{mobileAppOrigin}/auth-callback",
},
PostLogoutRedirectUris = new List<string> {
$"{mobileBaseUrl}/end-session",
$"{mobileAppBaseUrl}end-session",
$"{mobileAppOrigin}/end-session",
},
AllowedCorsOrigins = new List<string> {
mobileBaseUrl,
mobileAppOrigin
},
AllowAccessTokensViaBrowser = true,
RequireConsent = false,
AlwaysSendClientClaims = true,
AlwaysIncludeUserClaimsInIdToken = true,
}
where
"mobileBaseUrl": "http://localhost:8100",
"mobileAppBaseUrl": "com.example.app://",
"mobileAppOrigin": "http://localhost",
Note that works perfectly fine using the app via ionic serve but it fails when I run the Android app within the emulator. I'm following the example and using the ionic-appauth package from here: https://github.com/wi3land/ionic-appauth-capacitor-demo
UPDATE: The URL it is stuck on is when the user is authenticated and Identity server is redirecting to: /connect/authorize/callback?redirect_uri=com.example.app%3A%2F%2Fauth-callback&client_id=mobile_app&response_type=code&state=rLv7spCgZ2&scope=openid%20profile%20exampleapi&code_challenge=9yGKbchJ7YII2tx3jHAmcnV90kYZxsYVWz-60Ge5TQQ&code_challenge_method=S256

Only 2 intents work 'MAIN' and 'TEXT'

I'm trying building my first app with actions-on-google / google-assistant-sdk, I wanted to start using 3 intents, the MAIN, respond to input TEXT, and HELP that the user can call anytime:
The action.json is:
{
"actions": [
{
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "conversation_1"
},
"intent": {
"name": "actions.intent.MAIN"
}
},
{
"description": "Help Intent",
"name": "Help",
"fulfillment": {
"conversationName": "conversation_1"
},
"intent": {
"name": "app.StandardIntents.HELP",
"trigger": {
"queryPatterns": [
"Help",
"HELP",
"help"
]
}
}
}
],
"conversations": {
"conversation_1": {
"name": "conversation_1",
"url": "https://us-central1-sillytest-16570.cloudfunctions.net/sayNumber",
"fulfillmentApiVersion": 2
}
}
}
The index.js:
'use strict';
process.env.DEBUG = 'actions-on-google:*';
const ActionsSdkApp = require('actions-on-google').ActionsSdkApp;
const functions = require('firebase-functions');
const NO_INPUTS = [
'I didn\'t hear that.',
'If you\'re still there, say that again.',
'We can stop here. See you soon.'
];
exports.sayNumber = functions.https.onRequest((request, response) => {
const app = new ActionsSdkApp({request, response});
function mainIntent (app) {
console.log('mainIntent');
let inputPrompt = app.buildInputPrompt(true, '<speak>Hi! <break time="1"/> ' +
'I can read out an ordinal like ' +
'<say-as interpret-as="ordinal">123</say-as>. Say a number.</speak>', NO_INPUTS);
app.ask(inputPrompt);
}
function rawInput (app) {
console.log('rawInput');
if (app.getRawInput() === 'bye') {
app.tell('Goodbye!');
} else {
let inputPrompt = app.buildInputPrompt(true, '<speak>You said, <say-as interpret-as="ordinal">' +
app.getRawInput() + '</say-as></speak>', NO_INPUTS);
app.ask(inputPrompt);
}
}
function helpHandler (app) {
console.log('rawInput');
app.ask('<speak>What kind of help do you need?</speak>');
}
let actionMap = new Map();
actionMap.set(app.StandardIntents.MAIN, mainIntent);
actionMap.set(app.StandardIntents.TEXT, rawInput);
actionMap.set(app.StandardIntents.HELP, helpHandler);
app.handleRequest(actionMap);
});
I pushed the firebase as:
firebase deploy --only functions
And pushed the Google Actions as:
gactions update --action_package action.json --project <YOUR_PROJECT_ID>
While testing the assistant here, it started in a good way, and repeat the number that I enter, wait for another number, and so on, but when I enter help it is terminated and not responding!
UPDATE
I tried the below, but did not work:
actionMap.set("app.StandardIntents.HELP", helpHandler);
I should expect the app to "What kind of help do you need?" when I enter/say "Help", but what happened is just re-writing it, same way it do with any other number.
Non-built-in Intents are only supported for the first message in a conversation. After that, while you can use them for speech biasing, you will only get a built-in one such as the TEXT Intent.
Your actionMap is looking for app.StandardIntents.HELP but it doesn't exist. You can view all of the standard intents in the GitHub repo.
app.StandardIntents.MAIN returns another string which corresponds to "'actions.intent.MAIN'". It does not read your action.json and generate new intents. Thus, app.StandardIntents.HELP actually returns undefined and is never called.
Your map should use a string for your help intent since it is not available as a constant in the app object.
actionMap.set("app.StandardIntents.HELP", helpHandler);
This should resolve your issue. Let me know if it does not.

Push Notifications in Smartface App Studio

I am trying to implement Pust Notifications using Smartface App Studio.
I followed the link: http://www.smartface.io/developer/guides/advanced/push-notifications/
But, i stuck up with following.
1. Where can i find the devices which are registered with their device tokens by Notifications.remote.registerForPushNotifications() method.
2. How to get access_token to push the notifications from smartface api.
Can any one help me to figured out these? Thanks in advance.
For IOS below code works for me. I think android have changed for 4.5
var registerParsePush = new SMF.Net.WebClient({
httpMethod : "POST",
URL : "https://api.parse.com/1/installations",
contentType : "application/json",
requestHeaders : ["X-Parse-Application-Id: f5Y4tmDdKOYm5YdKDdDV8W6LDfviqFaCfhMgmxx", "X-Parse-REST-API-Key: PqbhEDYJcXP3xWmWRB6PBuzfIz4OIq0tK4V3dpxx", "Content-Type: application/json"],
onSyndicationSuccess : function (e) {},
onServerError : function (e) {}
});
Notifications.remote.registerForPushNotifications({
OnSuccess : function () {
var pushToken = Notifications.remote.token;
var req = {
"deviceType" : "ios",
"deviceToken" : pushToken,
"channels" : [
""
]
};
registerParsePush.requestString = JSON.stringify(req);
registerParsePush.run(true);
},
OnFailure : function () {}
});