Im new in mobile development. Now I write a little app.
User login in app
see list view of data from server. when I add something in server i send push to mobile and update data
Right now - i have Droid app that use this component(https://components.xamarin.com/view/gcmclient/) and receive messages
(c# console app for test ) -- all its work
Now question is - when i handle push from server - how to call method for update list view (this logic located in PCL and handle push located in droid app
P.S I still looking for good tutorial for iOS Push notification. Can somebody give me link?
P.S2 - if its possible use GCM for iOS?
You will need to call back into your PCL, either by Dependency Injection or some other method.
PS: GCM for iOS is here: https://components.xamarin.com/view/googleiosgcm
Related
I have a Blazor Maui application where I'd like to have the option to receive push notifications on.
I'd like to send the push notifications from a server project inside the same solution where I have my Blazor Maui project. For example : the server should contain a Gui with a textbox for the title and messagebody. This should then sent to all the users who downloaded the app.
Any tutorials,links, examples, tips or recommendations on how to start this?
I followed this guide before but this is all configured inside the app itself.
Thank you in advance.
A .NET MAUI Blazor app is still a .NET MAUI app.
If you want to use push notifications, you're going to have to be on the platform level. The guide you linked might still be very useful for that.
The comment from #H.A.H. is a good option too, using SignalR, but that will only work if you're inside of the app. SignalR is not integrated into the OS like push notifications are. You are not able to get a banner in the top of the screen for instance. But definitely thanks for watching and recommending my videos ;)
If you want the "regular" push notifications, you can follow any guide that adds push notifications in a .NET MAUI app and that will work for .NET MAUI Blazor.
you can use signalr for this purpose you can go throug following link
click here
I am developing a Xamarin.Forms application with Xamarin.Android and Xamarin.iOS clients. For push notifications, I am using FirebasePushNotificationPlugin library. It works perfectly on Android, but not on iOS.
On iOS the app simply closes down after the request to use push notifications. So: the "Allow/Don't allow" popup is shown, and when the user clicks on Allow, the app closes down. No exception is thrown or anything.
I have done every step in the setup instructions, but just to double-check, I will show you screenshots of everything:
Firebase console: I have registered my iOS app on the Firebase console and inputted all required fields (App ID, Bundle ID, App Store ID, App ID Prefix). I have also uploaded the APNs Authentication Key (but no certificates).
NuGet: I have added Plugin.FirebasePushNotification package to both Xamarin.Forms and Xamarin.iOS projects.
GoogleService-Info.plist: I have added GoogleService-Info.plist (that I got from the Firebase console) to the Xamarin.iOS project and set its Build Action to BundleResource.
Info.plist: I have enabled remote notification background mode and added FirebaseAppDelegateProxyEnabled (and set it to No) in Info.plist.
Entitlements.plist: I have added production aps-environment entitlement.
It is production (and not development) because I cannot run and debug the app, so the app is actually being uploaded every time to the App Store Connect and tested with TestFlight as an internal tester.
Xamarin.iOS AppDelegate: I initialize the package in AppDelegate.FinishedLaunching method, right after LoadApplication(new App());. The false parameter means that it will not auto register for notifications (it will be registered later manually).
I also override methods RegisteredForRemoteNotifications, FailedToRegisterForRemoteNotifications, DidReceiveRemoteNotification and call respected methods (as stated in the Getting Started instructions).
Xamarin.Forms: Now this is when all goes to hell on iOS. When it calls CrossFirebasePushNotification.Current.RegisterForPushNotifications();, it shows the "Allow/Don't allow" popup, and after the user clicks "Allow", the app simply closes. No exception is thrown or anything (well, at least nothing gets caught in the try/catch statement). The app simply shuts down.
The interesting thing maybe is, that the FCM token is already (successfuly) created before all this and if I send a push message to that token (of that iOS app), the Firebase server returns success. So I'm guessing that the Firebase part is correct, but there is something wrong with the iOS and/or the library?
Any advice whatsoever will be greatly appreciated!
For anyone reading this: I have solved this problem by removing the FirebasePushNotificationPlugin library, which apparently doesn't work on iOS. I have then implemented the notifications using the Xamarin.Firebase.iOS.CloudMessaging package instead, following this GettingStarted guideline.
Ive made a Windows Form Application and all is working fine on that.
but what im trying to do is make it so people have a mobile App(that ill end up making) that will allow them to be away from the PC and push a button on the mobile app that will send someform or command to the Winform Application and get it to trigger a button click event.
E.G
Winform is open on PC has a button on it that will play or pause music.
I go get a drink downstairs and i want to pause the music from the mobile app.
Push the button on the mobile app and it connects to the Winform application and triggers the event for the pause button.
If anyone can help me out with this or put me in the right direction to do somthing like this that would be great. thank you.
Ben
Basically what you just described is that you need to build a mobile application.
There are several tools that allow you to move your application to web. I used to work with these guys, they were called Artinsoft at the time but they are now called Mobilize.net, and they have a tool for making this conversion: www.mobilize.net/press/topic/convert-windows-to-web
However in your cases it seems like what you are trying to build is a remote control, in this case you need to either expose an endpoint for a mobile app to connect to or create a centralized server that both the remote and Winforms connect to.
I suggest using a TCP/IP connection. I don't know anything about mobile development, so I'll just focus on .NET and the concepts should carry-over.
System.Net.Sockets contains TCP classes for opening connections to hosts/clients. I'd recommend that the desktop-app acts as the host while the mobile-app is the client.
There are plenty of online articles on the subject, so take one and explore it's code until you understand it. Then, prototype your task on a single desktop machine using two-different .NET programs, one for the host (mimics the desktop program in the final project) and the other as the client (mimics the mobile-app in the final project). Then, learn the mobile API for networking and mimic what you did in the client-test program on-to the mobile platform project.
I am developing an app for selling of products, but I am stuck up in a place where I am not understanding how to give notifications to android phone from database change(insert or update on that table) for new products availble and offers like discounts, schemes etc.
I followed androidhive.com and javapapers.com for the GCM push notifications concept and it is sort of clear:
PHP or C# or Java web service
MySQL or SQLServer Database
GCM
Android phone
The statement for my problem would be "App should receive push notifications for new products, and offers and discounts given by the person-in-charge for it"
My assumption for this problem is:The "offers and discounts" would be "inserted" to a table(tbl_products) in the database and same goes for new products, "inserted" into a table(tbl_offers) in the database.
As soon as that "insertion" is done, the web service (php and c#), which I don't know how it should know, but gets to know about the change and informs GCM, and GCM sends the notification to the respective users.
The logic behind this is not familiar to me. I would greatly appreciate it if someone would help me with the logic and point me in the right direction of the coding for Android and web service. Thank you in advance.
I have been there ,done that! The way you should to proceed is:-
Create your website backend, a web service connected to a database(You need to use and know SQL for this part). Define your database accordingly. PHP is the easiest way to get started. Look at the GCM backend tutorials on Google.
Create your mobile application which has google play services enabled to use GCM. Implement GCM in your android app following the tutorial at the Official Android Developer website. You need to create an XMPP or RESTful service to communicate with your server. Your server needs to support XMPP to communicate better with Google. HTTP(GET/POST/PUT) is a dirty alternative to get working when you do not have a VPS setup for languages like Java(Most hosting companies allow only PHP,HTML,JavaScript etc on shared hosting).Depending on your scale of operation you may have to rent a Virtual Private Server(VPS) for your web service.
Create a private backend application(can be web or a desktop application) to upload your offers and so on. Examples on www.androhive.info
Make sure you got steps 1,2,3 correct.
Test your mobile application.
The idea can be pictorially represented as :-
I am writing a RESTful Webservice with PHP. When I change data it is very simple to update a GUI in iOS oder Android with Push Notifications on mobile devices but I haven´t found a good solution for C# desktop application on computer. The user should get these changes very quickly. (1-2 second is ok).
My question is: Is there a similar way to update the GUI in C# like push notifications?
PS: I don´t want to use a windows web service!