How I can check android version of device? (ionic 2,3) - ionic-framework

for android 4.2.2, ionic app shows white screen.
I want to know if the device had this version of android, app would show a message and would notify that this version of android is not supported.
is it possible?

I founded this solution:
let platformVersion = platform.versions();
if (platformVersion.android) {
let androidV = platformVersion.android.num;
console.log(androidV);
if (androidV < 4.4) {
let alert = this.alertCtrl.create({
message: 'Please update android ...'
});
alert.present();
// or push a single page for this error:
//this.nav.setRoot(ErrorPage);
}
}
for show this message in android device with version older than 4.4 we must be install this:
cordova plugin add cordova-plugin-crosswalk-webview
for more information visit this link:
https://crosswalk-project.org/documentation/cordova.html

Related

MissingPluginException(No implementation found in flutter using geolocator

i am using geolocator in flutter project to get current location but this error come on it.
i added all dependencies in both ios and android files still get this error i dont know why
flutter channel stable, 2.12,
here is my code:
Position position = await Geolocato.getCurrentPosition( desiredAccuracy: LocationAccuracy.high);
here is my error coming which i tested android 10, 8 also, but answer same
Unhandled Exception: MissingPluginException(No implementation found for method getCurrentPosition on channel flutter.baseflow.com/geolocator)
i am using geolocator plugin here is plugin link :https://pub.dev/packages/geolocator
Maybe someone will need my solution. This happens because GeolocatorPlatform.instance is not initialized. Call _registerPlatformInstance() where you need.
import 'package:geolocator_android/geolocator_android.dart';
import 'package:geolocator_apple/geolocator_apple.dart';
void _registerPlatformInstance() {
if (Platform.isAndroid) {
GeolocatorAndroid.registerWith();
} else if (Platform.isIOS) {
GeolocatorApple.registerWith();
}
}
Running flutter clean and flutter pub get fixed the issue for me. I uninstalled the application, cleared the cache of my device and rebuilt the app. This time there was a popup asking to give location permission to the app.
I gave the access and got the current position of the device (latitude and longitude).
Also make sure you upgrade flutter to 3.0.0 by running flutter upgrade
If you just installed the package (geolocator), just restart the app or even better the phone.
Stop running the app completely and restart the app.
make sure that the app is killed before restart
click stop button, refer below,
Upgrade your flutter
Run on terminal flutter upgrade
or flutter upgrade —-force
Then =>flutter pub outdated
Then =>flutter pub upgrade
After that =>flutter pub upgrade —-major-versions
Finally go to
yourProjectName/android/app/build.gradle
Change:
android {
compileSdkVersion ##
…
…
}
To:
android {
compileSdkVersion 33
…
…
}

Does getUserMedia works in ionic-webview in IOS app?

I'm using ionic 5 with capacitor and angular9.
All works on android and on the web.
But when i build the app on ios, I reveice an "notallowederror" at the line navigation.getUsermedia
getMedia() {
navigator.getUserMedia({ audio: true, video: true }, (stream) => {
this.handleSuccess(stream);
}, (error) => {
this.handleError(error);
});
}
Any idea ?
Apparently ios 14.3 and 14.4 still does not allow getusermedia.
On the other hand there is an iosrtc cordova plugin which would allow to obtain the stream.
So do you know if I can use this cordova plugin in an ionic capacitor application?
And if yes how ?
Finally i can get the stream with the cordova-plugin-iosrtc.
I share a poc if that can help someone, it 's a integration with peerjs ans ionic capacitor.
https://github.com/iometrine/ionic-iosrtc-peerjs

Media plugin not installed? Ionic 3

I have an Ionic 3 app that requires to use Media Plugin.
When I press the "record" button on my app, this code block is executed:
this.platform.ready().then(() => {
this.fileName = this.commentsProvider.getFileName(this.platform);
this.filePath = this.commentsProvider.getFilePath(this.platform, this.fileName);
this.audio = this.media.create(this.filePath);
this.audio.startRecord();
this.recording = true;
});
And it doesn't works. The console throws:
console.warn: Native: tried accessing the Media plugin but it's not installed.
NOTE: I'm runing the app in a connected Android device, via USB.
You can see I'm using platform.ready() and anyway I still have this problem.
Any idea?
Thank's in advance!
EDIT: I've already deleted node_modules and plugins folders, and ran npm install, and the problem persists.

Android: Unable to launch the contact application in Android Lollipop version

Recently updated my Device to latest Android Lollipop version. When I try to launch the contact app from my other application, it fails to do so and crashes.
Here is the code that worked for me pre Android L version:
Intent intent = getIntent().setComponent( null ).setPackage("com.android.contacts" );
startActivity( intent );
All the required permissions are assigned to app in the manifest and I am able to launch the contact app in KitKat and below.
Later I checked with the below code and it launched the contact app:
Intent intent = getIntent().setComponent( null ).setPackage("com.google.android.contacts" );
startActivity( intent );
Any idea if the package name is changed to something else in Android L?

cordova 3.4 file 1.0.1 resolveLocalFileSystemURI android issue

I am trying to get a full path to an image retrieved from Android image library. via the camera plugin.
window.resolveLocalFileSystemURI("content://media/external/images/media/83", function(fileEntry) {
or
window.resolveLocalFileSystemURL(imageURI, function(fileEntry) {
fileEntry.file(function(fileObj) {
newimageURI = fileObj.fullPath;
alert(newimageURI);
});
});
returns undefined.
There was updates the other day and it is no longer working. I have tried toURL() as well with no success.
Try removing the file plugin and adding it again. Works for me. I think it's related to this bug: Cordova iOS Plugins fail after building, unless I remove platform and plugin JSON first