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
Related
I'm using this code:
this.watchID = navigator.geolocation.watchPosition((localizacion) => {
console.log("En el enviarPos", localizacion);
}, (err) => {
console.log(err);
}, { enableHighAccuracy: true });
It works in background, but only doesn't work when the phone is locked.
Error:
GeolocationPositionError {code: 3, message: "Timeout expired"}
I was facing same issue but I switched to Geocoder, and it's working fine for me, also it gives lot of info,
=> For Ionic 3
ionic cordova plugin add cordova-plugin-nativegeocoder
npm install --save #ionic-native/native-geocoder#4
=> For Ionic 4
ionic cordova plugin add cordova-plugin-nativegeocoder
npm install --save #ionic-native/native-geocoder
I am working on creating a taxi app , I have two separated apps one for Client and for driver .
I want to send current locations of drivers to clients .I don't know how I can do that .
Firebase is a good option to use as your backend in this situation. It uses web sockets to automatically push data. You can use AngularFire to link Ionic with Firebase. (Video tutorial: https://www.youtube.com/watch?v=I_73tsvj6OI)
Hey #bambo so for your understanding it is not possible to transfer data from one app to another without connection, and in your case both of the app can be in distance where only internet will work. So you can use one of these methods:
APIs for sending the data from one app and receiving it from other app.
Send a notification direct to other app, which contain the data you want to send for ionic you can use PUSH cordova available on
ionic docs.
You can send or receive data through webIntent plugin provided by ionic.
Ionic:
Ionic CLI : 5.0.2 (C:\Windows\System32\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.5
#ionic/app-scripts : 3.2.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 5 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.5
System:
Android SDK Tools : 26.1.1 (D:\Android\Sdk)
NodeJS : v12.4.0 (D:\node.exe)
npm : 6.9.0
OS : Windows 8.1
Command to install plugin:
ionic cordova plugin add com-darryncampbell-cordova-plugin-intent
npm install --save #ionic-native/web-intent#4
(Add 'Web-Intent' in provider)
Code To receive data:
import { WebIntent } from '#ionic-native/web-intent';
clickMe() {
console.log('clicked')
this.webIntent.getIntent().then((data) => {
console.log('Success', data);
},
err => {
console.log('Error', err);
});
}
Code To send data:
import { WebIntent } from '#ionic-native/web-intent';
sendIntent() {
console.log('sendIntent');
const options = {
action: 'com.example.myapplication',
extras: {
'data': 'Hello Android App'
}
}
this.webIntent.sendBroadcast(options).then((succ) => {
console.log('Success', succ);
},
err => {
console.log('Error', err);
});
}
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
Hello I am new to Ionic.
I want to use ionic push notification for android phone.
I followed all the instruction from ionic website
For the debugging, I typed ionic serve
And I saw
"Uncaught ReferenceError: PushNotification is not defined"
in Chrome console.
Of course, notification is not working.
What am I missing ?
Any comment would be very helpful.Thank you.
Below is What I have done
I have put below code in terminal
ionic add ionic-platform-web-client
ionic plugin add phonegap-plugin-push
ionic io init
My ionic config info
dev_push is false,
There is 'app_id'
There is 'api_key'
There is 'gcm_key'
NodeJS
v5.2.0 (I tried also v4.2.2)
Ionic cli
v1.7.12
Below code is in $ionicPlatform.ready
var io = Ionic.io();
var user = Ionic.User.current();
if (!user.id) {
user.id = Ionic.User.anonymousId();
};
// Just add some dummy data..
user.set('name', 'moka');
user.set('bio', 'This is my little bio');
user.save();
var push = new Ionic.Push({
"onNotification": function(notification) {
alert('Received push notification!');
},
"pluginConfig": {
"android": {
"iconColor": "#0000FF"
}
}
});
var callback = function(data) {
push.addTokenToUser(user);
user.save();
};
push.register(callback);
// Edit
I changed form
ionic config set dev_push false
to
ionic config set dev_push true
It does not show no longer
"Uncaught ReferenceError: PushNotification is not defined"
However I am not sure if it's correct way.
Because it was written on this tutorial
to turn off your development mode
ionic push --google-api-key your-google-api-key
ionic config set gcm_key your-gcm-project-number
ionic config set dev_push false
So it does not matter "Uncaught ReferenceError: PushNotification is not defined", if I want to test on real android device ?
No it does not matter.
In fact as you have mentioned dev_push must be false while testing it out in real devices.
You can either set it false manually ionic config set dev_push false or not mention it anywhere(by default it is false) :)
Cordova & Phonegap plugins only work on emulators and devices. They will not work on any broswers.
Although with Ionic you can mute those errors a good practice could be to wrap your code like this:
if (typeof PushNotification === "defined") {
// your code here
}
This way it wont throw any errors when you write BDD or E2E tests.
You can also add your code inside the:
document.addEventListener("deviceready", function () {
}
I was able to fix this error following:
ionic remove ionic-platform-web-client
cordova plugin remove phonegap-plugin-push
ionic add ionic-platform-web-client
ionic plugin add phonegap-plugin-push
ionic io init
I'm developing social application using cordova 3.1.0 using 4.6 xcode.and my os x version is 10.8.5.
Now,I'm trying to implementing twitter plugin for my application.i got the source from this :LINK
I've gone thru step by step.I also integrated child-browser framework.
Now.i got this Error:
2013-10-17 12:15:17.141 FinalTwitter[12484:c07] ERROR: Method 'showWebPage:' not defined in Plugin 'ChildBrowser'
2013-10-17 12:15:17.141 FinalTwitter[12484:c07] -[CDVCommandQueue executePending] [Line 117] FAILED pluginJSON = [
"ChildBrowser383058088",
"ChildBrowser",
"showWebPage",
[
"https:\/\/api.twitter.com\/oauth\/authorize?oauth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&oauth_token_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&oauth_callback_confirmed=true",
{
"showLocationBar" : true,
"locationBarAlign" : "top"
}
]
]
can any one help me?
The plugin is not called ChildBrowser anymore but inAppBrowser ;) You should update the code I believe.