Connecting Firebase results in NoSuchMethodError in .NET MAUI - android

I'm a beginner at mobile dev and this is my first project to connect to Firebase
I tried to create a project and set up Firebase from Firebase Push Notifications in .NET MAUI
but I can't finish the tutorial, because the exception appeared (NoSuchMethodError). Then I tried to find a solution for this, until now I haven't seen the solution and I have no idea what happened and why.
Please, tell me what to do and why is it.
I try to get a Token from my app but for now, I just need to make my app run without the exception and expect to know what happened.

I see the blog, they used Plugin.Firebase Nuget Package. Do you use this third-party tool as well?
Tips:
Push notification works on a .net MAUI app with the existing Xamarin.GooglePlayServices.Basenet6.0-android31.0and Xamarin.Firebase.Messagingnet6.0-android31.0 libraries. Since they use only platform-specific events and code and do not have a reference to Xamarin.Forms or .NET MAUI, you can even leverage those.

Related

Ionic Capacitor Firebase Phone Number Authentication Problems

For anyone who is trying to authenticate via firebase phone number using ionic, this post is for you.
I spent weeks trying to solve this problem for my own app, and have moved on to using email because solving the phone number problem was taking too much time, but I am making this post to save you from wasting your time on red herrings.
The Issue:
Phone number can only be used when attached to a url, so if you are making an ionic application through a website, phone number auth via firebase will work, however, if you are trying to do it on mobile it won't work because firebase requires a url attached and there are no urls in mobile apps of course (firebase).
Option 1: Plugins
So, the easiest option would be to look around for third-party plugins to implement phone number auth on. I believe there is a Cordova plugin for this, (cordova-plugin-firebase-authentication), however that library is not compatible with Capacitor (compatable plugins).
There are a few other plugins that I tried to implement without much success. Notably, the (capacitor-firebase-auth plugin). It claims that phone auth works for ios and android, however, the actual method for doing that seems very complicated and follows a different path using .p8 codes that I was unable to follow-through with (confusion). And this plugin has some major limitations.
Option 2: In-App-Browsers
Since option one doesn't seem very feasible right now, the second option is to put code up on a website for phone number authentication and then open a browser within your app to authenticate. I spent a ton of time trying to get this method to work to no avail. It seems possible theoretically, but in practice, it is a mess. The biggest problem with this method is that what you want is to be able to run the signInWithPhoneNumber(phoneNumber, appVerifier) on your mobile app, because then your app treats users that have signed in through phone number like any other user and it makes general authentication much easier downstream in your application. However, in order to do that you need a verified appVerifier, which is of the class firebase.auth.RecaptchaVerifier. The firebase.auth.RecaptchaVerifier is supposed run .render() to initiate the recaptcha provlem and then run .verify() to verify a token that is given after the user does the recaptcha (documentation). I have tried to run .render() on a website and then .verify() on a mobile app, passing the token between the two. I am not sure why this doesn't work, it could just be a problem with my setup, but after trying for over a week on this method, I gave up on trying to get it to work. The token I pass just doesn't confirm. I don't know how these two functions work under the hood, there may be some identification system for each unique instance of firebase.auth.RecaptchaVerifier that is invalidating this method, I really don't know.
If you want to take a stab at this method, I recommend using the cordova plugin (it is compatible on capacitor projects) instead of an iframe or the capacitor browser plugin for in-app-browser to the website because it is easier to use and there is better functionality for passing data between the app and the website.
Option 3: Implementing Manually on IOS and Android
I haven't tried out this method, however, theoretically, you could go into your android studio and Xcode projects to actually write swift and java code following the firebase instructions for firebase phone auth (android tutorial) (ios tutorial). This would probably work, but I am not sure how you would notify your ionic project to defer to the swift and java files when authenticating.
Please let me know if there are any methods that have worked for you or any solutions to the roadblocks I have encountered, this is what I've tried so far!
I am the OP. After doing more work I finally got the phone auth system to work using capacitor-firebase-auth (https://github.com/baumblatt/capacitor-firebase-auth). I also created a git repo showing my code example and how to use it: https://github.com/Darrow8/capacitor-phone-test
In my previous attempt, I was running into issues with getting cfaSignInPhone to work but after more tweaking, it worked. Another major issue was getting firebase.auth().signInWithCredential to work. It turns out I had to combine the aformentioned capacitor-firebase-auth library with #angular/fire https://www.npmjs.com/package/#angular/fire
You can simply use cordova-plugin-firebase-authentication its compatible with capacitor, it works for me.
https://ionicframework.com/docs/native/firebase-authentication

How to create single backend website, iOS app and android app using flutter?

I'm new to dart and flutter.
And I want to know how to create a website, iOS app and Android app with same backend/business logic using flutter.
Little guidance will be appreciable.
Thanks!
You can Create a Powerful Backend Using Firebase as a Backend service https://firebase.google.com/
As I'm Doing this for my Client it's very easy with Firebase.
In Firebase Settings Tab
Click on Add App
you Can connect all the Service and access Database from any platform you just need link Them in Firebase.
Firebase Provide Option to Add All Three Platforms
Connect Android App
Connect IOS App
Connect Web Version
When i Starting it was mystery for Me... :D
Hope This would help you.
Helpful resource for learning
https://www.youtube.com/channel/UC2d0BYlqQCdF9lJfydl_02Q
https://www.youtube.com/channel/UCsBjURrPoezykLs9EqgamOA
As a learning path to building cross-platform apps, I would start with the Flutter codelabs, in this order:
Write your first Flutter app, part 1
Write Your First Flutter App, part 2
Write your first Flutter app on the web
Then I would look at Firebase for the backend: Add Firebase to your Flutter app and Firebase for Flutter.
For a nice introductory code example of a multi-platform app (Android, iOS, web, but without backend added) see the
Provider Shopper sample.
Lastly, I find the Flutter Widget of the Week series very useful for learning about the purpose and capabilities of each widget.
You have to take care of few things:
Your UI must be responsive in nature, for that use MediaQuery
Render your UI based on the Platform.
Always check the packages you are using must support flutter web too, because there are a lot of plugins that don't supports flutter web yet.

React native notifications

I am working on a react-native project (using CRNA) and am to the point where I want to develop push notifications for various features. Does anyone have any suggestions on what library I should use. I've been told that it is typically something rather difficult to get up and running so some light-weight out of the box solution would be great. BTW, I am using Expo for dev environment. Thanks!
If you are using Expo I think push-notifications are already configured. Otherwise I suggest using react-native-fcm. It's easy to implement, it works fine in my project both for Android and iOS. I tried other libraries but only this one worked for me.

SalesForce with Android?

I want connect sales Force from my Android Program please suggest which one is correct way to achieve this I am new to sales Force I have some knowledge in Android Application Developement.
Thanks in Advance.
You definitely want to use the REST API for mobile apps. The SOAP API is really heavy, and is better for Server-to-Server integrations. The best way to get started building an Android app for Salesforce.com is to take a look at the Salesforce Mobile SDK for Android:
http://wiki.developerforce.com/page/Mobile_SDK
There's a very helpful getting started PDF linked on that page.
However, the SDK is meant mostly for starting new apps, so you'll have some work ahead of you integrating it into an existing application. The main things you want are the oAuth 2.0 User-Agent login and REST wrappers.
You may also find this app useful -- I put it together for a presentation at Dreamforce '11, which was shortly before the Mobile SDK for Android came out, so I wrote the oAuth and REST stuff myself. Might be a simpler starting point for you.
https://github.com/tomgersic/DreamforcengerHunt
Hope that helps!
You can either use the RESTful interface or the SOAP webservices. The latter is a bit easier to deal with IMHO.
Under setup in salesforce, download the partner or enterprise WSDL (partner = generic, enterprise = specific for your SF-instance). Now with wsdl2java you can create Stubs for those wsdl entries. Import those into your android app and use them. See here for a Java Exampe by Salesforce.com.
Be sure your user has the permission to "do API". You might want to look into SSO if you want to make a "production"/commercial app. Also, to login, remember to use the correct password, you might need to add the API key (generate using the Setup tab in SF). Hope this helps.
Try checking out some of the open-source SDK projects the developer evangelists have added to the forcedotcom github
Lots of good examples on different platforms, including android with phonegap/html5 and a native SDK for android (iOS and Android) to get you past authentication and onto building your app.
Salesforce Provides mobile SDK for development on mobile device, here is the link for android SDK:
http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_Android
You need to:
Download SDK.
Add a sample project included in SDK's native/SampleApps folder(make sure you check include to the workspace while importing the project).
Get your remote access form salesforce and update in your app.
--This should get you started with a sample app form salsforce.
After this you need to modify existing code to your own code.
You can go to trailhead and start browsing on it, while working with your own application you will have to learn a lot about smartStore and smartSync,
I did implemented A smartStore App with using salesforce as database provider, if you want i can upload it to drive and share a link to you and
if you have any doubts about using or understanding the flow be free to ask..

The simplest way to use C2DM?

It has been a couple of weeks and I am having so much trouble making C2DM work. I've read a million guides and watched video tutorials but have had no luck. I just need a way to communicate with my server and my phone in the simplest way. Any help?
If you're still interested in trying C2DM, try installing the Google Plugin for Eclipse and use it to generate the Android / App Engine sample project. It should be able to generate a skeleton project that is able to communicate between AppEngine and a basic Android application. You could verify that the sample works and use it as a basis to debug your custom application.
There was also a related AppEngine + Android session at Google I/O this year.
The easiest way to get push into your app is to use a third party push provider like Urban Airship or Xtify. Instead of writing the code to interface with google directly you integrate the third party SDK into your app and they handle the messy stuff.
Additionally, you don't have to worry about scaling if your app gets (or already is) big. And going cross-platform (iOS, Blackberry) is that much easier.

Categories

Resources