Capacitor text-to-speech API not working on android - android

I am getting this error whenever I try to execute the TextToSpeech.speak() function from #capacitor-community/text-to-speech#0.2.3:
Uncaught (in promise) Error: Not supported on this device.
at n.value (29.a169ec33.chunk.js:formatted:3022)
at n.<anonymous> (29.a169ec33.chunk.js:formatted:2842)
at c (26.902cd79a.chunk.js:2)
at Generator._invoke (26.902cd79a.chunk.js:2)
at Generator.next (26.902cd79a.chunk.js:2)
at 29.a169ec33.chunk.js:formatted:2816
at new Promise (<anonymous>)
at l (29.a169ec33.chunk.js:formatted:2793)
at n.value (29.a169ec33.chunk.js:formatted:2836)
at 29.a169ec33.chunk.js:formatted:4997
Here is my code below:
import { TextToSpeech } from '#capacitor-community/text-to-speech';
const androidSpeak = async () => {
await TextToSpeech.speak({
text: 'This is a sample text.',
locale: 'en_US',
pitchRate: 1.0,
speechRate: 1.0,
volume: 1.0,
category: 'ambient',
});
};
Whenever I trigger the function it gives me the error above. Anyone experienced it before?
Modules:
#capacitor/android: ^2.4.2
#capacitor-community/text-to-speech: ^0.2.3
https://github.com/capacitor-community/text-to-speech

Change the language from 'en_US' to 'en' and it will work.

Related

How can I get the application version with Frida? (Android)

How can I get the application version? (Android)
frida -U -f it.subito -l '/path/to/get-app-version.js'
output: 6.39.4
I bumped into a Frida issue that solved my problem.
get-app-version.js
Java.perform(() => {
const ActivityThread = Java.use('android.app.ActivityThread')
const currentApplication = ActivityThread.currentApplication()
const context = currentApplication.getApplicationContext()
const pkgManager = context.getPackageManager()
const pkgInfo = pkgManager.getPackageInfo(context.getPackageName(), 128)
/* Don't work */
// console.log('version: ', pkgInfo.versionName)
// console.log('version: ', pkgInfo._versionName.value)
console.log('version: ', pkgInfo.getClass().getField('versionName').get(pkgInfo))
})
First console.log prints:
version: [object Object]
Second one throws an error:
TypeError: cannot read property 'value' of undefined
at <anonymous> (/frida/repl-2.js:23)
at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:12)
at _performPendingVmOps (frida/node_modules/frida-java-bridge/index.js:250)
at <anonymous> (frida/node_modules/frida-java-bridge/index.js:225)
at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:12)
at _performPendingVmOpsWhenReady (frida/node_modules/frida-java-bridge/index.js:244)
at perform (frida/node_modules/frida-java-bridge/index.js:204)
at <anonymous> (/frida/repl-2.js:26)
Third one works like a charm.
Unluckily I don't know why the short version pkgInfo.versionName doesn't work.

react-native-track-player: How can i fix TypeError: null is not an object (evaluating 'TrackPlayer.STATE_NONE') in android?

I am trying to implement react - native - track - player, but i am stuck with above error
please guide me how can i resolve this error.and i have already reinstalled the app
two times but in my
case error is not short out.i am sharing piece of code below
for reference.
I have made a service.js file like this
import TrackPlayer from 'react-native-track-player';
module.exports = async function () {
TrackPlayer.addEventListener("remote-play", () => TrackPlayer.play())
TrackPlayer.addEventListener("remote-pause", () => TrackPlayer.pause())}
import it in index.js like this
import {AppRegistry}from 'react-native';
import TrackPlayer from "react-native-track-player"
import {App}from './App
AppRegistry.registerComponent(appName, () => App);
TrackPlayer.registerPlaybackService(() => require("./service"))
finally this is my setup file code please go through it.
componentDidMount() {
TrackPlayer.updateOptions({
stopWithApp: true
, capabilities: [TrackPlayer.CAPABILITY_PLAY, TrackPlayer
.CAPABILITY_PAUSE
]
, compactCapabilities: [
TrackPlayer.CAPABILITY_PLAY
, TrackPlayer.CAPABILITY_PAUSE,
// TrackPlayer.CAPABILITY_SEEK_TO
]
, });
this.setUpTrackPlayer()
}
componentWillUnmount() {
TrackPlayer.destroy();
}
setUpTrackPlayer = async () => {
try {
await TrackPlayer.setupPlayer();
await TrackPlayer.add({
id: '1'
, url: 'n/w url'
, title: 'Example'
, artist: 'ajay'
, });
console.log('Tracks added');
}
and for play and pause i am using
TrackPlayer.play() & TrackPlayer.pause()

Expo in-app-purchases: ReferenceError: Can't find variable: connectAsync

I'm trying to follow along with expo's in app purchases documentation.. I have the android developer account and set up my in-app-purchase on that account for the same app. I'm just trying to get started with the documentation and receive an error immediately.
If you look at the documentation, I'm just trying to enter in what's in the first example. I call this function at the beginning of the render method of my app.
import * as InAppPurchases from 'expo-in-app-purchases';
...
const getHistory = async function(){
const history = await connectAsync();
if (history.responseCode === IAPResponseCode.OK) {
history.results.forEach(result => {
console.log(result)
});
}
}
And I receive these errors
[Unhandled promise rejection: ReferenceError: Can't find variable: connectAsync]
* App.js:57:19 in getHistory
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:271:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:135:28 in invoke
- node_modules/regenerator-runtime/runtime.js:170:17 in Promise$argument_0
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
...
You need to import in-app purchases module first. Like this:
import * as InAppPurchases from 'expo-in-app-purchases';
const getHistory = async function(){
const history = await InAppPurchases.connectAsync();
if (history.responseCode === IAPResponseCode.OK) {
history.results.forEach(result => {
console.log(result)
});
}
}
Also, note this from the documentation you linked:
You must ensure that you have installed and configured the react-native-unimodules package before continuing.
and this:
Note that in-app purchases require physical devices to work on both platforms and therefore cannot be tested on simulators.
Since you used:
import * as InAppPurchases from 'expo-in-app-purchases';
That means your code should look like:
...
const getHistory = async function(){
const history = await InAppPurchases.connectAsync();
if (history.responseCode === InAppPurchases.IAPResponseCode.OK) {
history.results.forEach(result => {
console.log(result)
});
}
}

TypeError: Cannot read property 'openDatabase' of undefined in ionic 4 for android

Getting error when running application in mobile TypeError: Cannot read property 'openDatabase' of undefined
When I am running the application on the browser, it is working fine. Plz help me, I am newer in IONIC 4
if(this.platform.is('cordova')) {
alert("this.platform.is('cordova') := "+this.platform.is('cordova'));
// Running on device or emulator
await createConnection({
type: 'cordova',
database: 'crm.db',
location: 'default',
logging: ['error', 'query', 'schema'],
synchronize: true,
entities: [
User
]
}).then(connection => {
alert(connection);
let user = new User();
}).catch(error => alert(error));
} else {
// Running app in browser
await createConnection({
type: 'sqljs',
autoSave: true,
location: 'browser',
logging: ['error', 'query', 'schema'],
synchronize: true,
entities: [
User
]
});
}

Ionic2/3 angular google maps TypeError: Object(...) is not a function at new FitBoundsService

I'm trying to instantiate an angular-google-maps example from the main website: https://angular-maps.com/guides/getting-started/ to make some tests for an aplication.
I used their example code as it follows:
import { Component } from '#angular/core';
#Component({
selector: 'page-location',
templateUrl: 'location.html',
})
export class LocationPage {
title: string = 'My first AGM project';
lat: number = 51.678418;
lng: number = 7.809007;
}
page-location
{
agm-map {
height: 150px;
}
}
<h1>{{ title }}</h1>
<!-- this creates a google map on the page with the given lat/lng from -->
<!-- the component as the initial center of the map: -->
<agm-map style="height: 300px;" [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
And in the end throws the following error:
core.js:1449 ERROR Error: Uncaught (in promise): TypeError:
Object(...) is not a function TypeError: Object(...) is not a function
at new FitBoundsService (fit-bounds.js:31)
at createClass (core.js:12481)
at _createProviderInstance (core.js:12458)
at createProviderInstance (core.js:12299)
at createViewNodes (core.js:13771)
at callViewAction (core.js:14218)
at execComponentViewsAction (core.js:14127)
at createViewNodes (core.js:13812)
at createRootView (core.js:13673)
at callWithDebugContext (core.js:15098)
at new FitBoundsService (fit-bounds.js:31)
at createClass (core.js:12481)
at _createProviderInstance (core.js:12458)
at createProviderInstance (core.js:12299)
at createViewNodes (core.js:13771)
at callViewAction (core.js:14218)
at execComponentViewsAction (core.js:14127)
at createViewNodes (core.js:13812)
at createRootView (core.js:13673)
at callWithDebugContext (core.js:15098)
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at OverlayPortal.NavControllerBase._fireError (nav-controller-base.js:223)
at OverlayPortal.NavControllerBase._failed (nav-controller-base.js:216)
at nav-controller-base.js:263
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4760)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
I would appreciate your help to look for the source of this problem.
I added the following command npm install rxjs#6 rxjs-compat#6 --save and it work fine for me.
This could be a packaging version dependency issue with #agm/core & angular.
Try lower your "#agm/core" version in your package.json for your project (I've used 1.0.0-beta.2, instead of the installed 1.0.0-beta.5).
They've introduced a breaking change: feat(*): support angular 6
for me resolved when used version: 1.0.0-beta.3
package.json:
"#agm/core": "~1.0.0-beta.3"

Categories

Resources