Ionic native push registration format changed? - ionic-framework

I am not sure why but it seems that the interface for push registration changed?
My app follows the logic from
https://ionicframework.com/docs/v3/native/push/
with
pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
where registration used to be of below type
export interface PushDevice{
registrationId: string;
registrationType: string;
}
but now I am getting
{"registrationId":"{length=32,bytes=0x459ca46ab66f4fe790220809215176d6...21b3436d13e78c64}","registrationType":"APNS"}
registrationID used to be a string, but now is a dictionary. How shall I handle this ID now? I have to convert it to a push token somehow... What changed? I looked into the phone gap plugin code but I can not find it...
https://github.com/phonegap/phonegap-plugin-push/blob/master/src/ios/PushPlugin.m

I faced the same issue in my ionic 1 app. Had to upgrade version of push plugin to 2.3.0 from 2.2.3. Moreover i also upgraded cordova-support-google-services to 1.3.2 to make it work. Although it was related to android but still had to do it. This plugin (phonegap-plugin-multidex) should have a version greater than or equal to 1.0.0
The plugins through which push notifications work fine for me are as follows:
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.3.0 "PushPlugin"
cordova-support-google-services 1.3.2 "cordova-support-google-services"
Hoepfully this helps

Finally found a lead. Seems this changed with the release of iOS 13.
https://forums.developer.apple.com/thread/117545
The Cordova push plugin has to be updated to v2.3.0 (I have not tested this yet), but my current version is failing because v2.2.3 is accessing the registrationId through a wrong method.
https://github.com/phonegap/phonegap-plugin-push/issues/2832
https://github.com/proreact/phonegap-plugin-push/commit/486c8f206536995c80101487b0fed1502edd5754

Related

Flutter issue with Google Ads & Firebase Versions

I am using latest version of flutter 3.7.2
My app has google ads and firebase dependency for which is use following pubs latest versions
admob_flutter:
firebase_messaging:
firebase_core:
Everthing is working perfect but when I have uploaded app on playstore it gives me following error
For solution of above warning i done the change in app level gradle file and following line
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-ads:21.5.0' // this line added for solution
implementation platform('com.google.firebase:firebase-bom:29.3.0')
implementation 'com.google.firebase:firebase-analytics'
}
but after adding above line my firebase stopped working it crash when run app with following error.
NOTE: I have tried flutter clean, reinstall app, flutter pub upgrade
everything is up-to date. Also when i change line implementation
'com.google.android.gms:play-services-ads:21.5.0' to implementation
'com.google.android.gms:play-services-ads:19.2.0' everything is
working perfect
you help me with the part that you say works with only 'com.google.android.gms:play-services-ads:19.2.0' and I had the same problem but trying to solve it by changing this line:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'com.google.firebase:firebase-ads:21.5.0'
}
you try to change firebase-ads:19.1.0 to 21.5.0 and it will let you use
implementation 'com.google.android.gms:play-services-ads:21.5.0'
It works for me, hope helps you.
If you are using 'admob_flutter' and update to 'com.google.android.gms:play-services-ads:2.50.0' you couldn't use Admob, this is because 'admob_flutter' does not support 'play-services-ads:2.50.0'.
In this case, I used 'google_mobile_ads 2.3.0' it's verified and published by 'google.dev
https://pub.dev/packages/google_mobile_ads

How to use cloud_firestore in flutter for web and android?

I have a Flutter app which works on Android as expected but if I want to compile it for Web I get an error.
It has to do something with the dependency cloud_firestore. If I use the dependency firebase it works fine on the web but on android now not..
This is the error message I get using cloud_firestore (compiling for web):
Skipping compiling pay_balance|lib/main_web_entrypoint.dart with ddc because some of its
transitive libraries have sdk dependencies that not supported on this platform:
firebase_core|lib/firebase_core.dart
https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings
Can anybody help me? Maybe with another dependency for firestore (I did not find others which are working on web and android)..
Edit: I have used the firebase-dart plugin for web!! -> Only works on the web but not in android for me -> I need something for both at the same time!!
Or is there a Way I can use both packages without getting a compling error for the web when I import cloud_firestore?
If you want to use Firebase on Web and Mobile you have to get creative. I created the fb_auth plugin that uses the Mobile SDK firebase_auth on iOS and Android and the firebase package on web. This will give you a single plugin for auth.
https://pub.dev/packages/fb_auth
Im working on firstore and storage but they are not ready yet.
I have also created an article on how to do this with flutter:
https://medium.com/#rody.davis.jr/how-to-build-a-native-cross-platform-project-with-flutter-372b9e4b504f
You have to use dynamic imports so that at compile time it tree shakes what it doesn't need and will not throw an error.
Currently this is the only way to officially use both plugins in the same project.
EDIT: cloud_firestore now added
Two of the FutterFire plugins are now supported for web. FlutterFire plugins supporting web firebase_auth and firebase_core
cloud_firestore is now also supported

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

NativeControls plugin doesn't work with Cordova 2.7.0

Cordova 2.7.0 no longer allows deprecated forms of calls to cordova.exec. For example:
44. 2013-05-09 01:18:29.850 myiOSApp[9764:17903] The old format of this exec call has been removed 1
deprecated since 2.1). Change to:cordova.exec(null, null, "NativeControls", createTabBar",[]);
The latest version of the iOS NativeControls plugin I know of is at Here and it has not been updated to fix this.
Is there a more recent version of NativeControls anywhere else?
Please help me to fix this issues
by
John
This is because of a changes in 2.1 deprecated previous iOS plugin signature to: (void)myMethod:(CDVInvokedUrlCommand*)command;
I've fork the project and made fixes here: https://github.com/noogen/phonegap-plugins/tree/master/iOS/NativeControls

Error using barcode scanner in iOS PhoneGap

I am working on barcode scanning App. I have download the sample code from GitHub. When I run that project I get an error. Please help me to solve it.
ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist.
2012-11-28 14:12:36.198 BarCodeScannerCDV[942:40b] FAILED pluginJSON = {"className":"NetworkStatus","methodName":"getConnectionInfo","arguments":["NetworkStatus0"]}
Thanks.
I suggest you to used updated phonegap framework (Cordova 2.2.0), because this was a bug in Cordova 1.6.0.
Please see following comment by Shazron Abdullah in Google Phonegap group:
There is a new Cordova.plist because of the unified JS changes. Check
out the "Cordova Upgrade Guide" in your .dmg (Guides subfolder), or:
"Upgrading Cordova 1.5.0 projects to 1.6.0" step 8 of
https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md#upgrading-older-cordova-plugins-to-16x
The BarcodeScanner plugin for iOS-Phonegap is stable one, please update your phonegap framework to 2.2.0.
In Phonegap 1.6.0 and below, network connection class name is Network Status but for Phonegap 1.6.1 and above, network connection class name is CDVConnection.