How to Connect GATT Server in Xamarin iOS - xamarin.forms

In Xamarin Forms,
I want to know how the GATT server works with BLE for iOS.
Anyone can help how to connect GATT server with iOS.

I do think that it's a big question. You could refer to Bluetooth GATT Xamarin.Forms client and its related xamarin project. Generally, several steps should be taken
check the bluetooth-le status
scan the GATT server
connect the server
Get Service
Get Characteristic
According to the implementation and complete understanding of BLE(Bluetooth low energy) in Xamarin forms you should also add some keys and values in your info.plist
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
</array>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>
Also, you could refer to Bluetooth LE plugin for Xamarin & MAUI which might be useful for understanding.

Related

Push notification in xamarin.forms

I asking this question for clarification about push notification in xamarin. I have a xamarin.forms app which will display certain items in list view.The back-end of my app is in .Net. The items which shows in list view inside app is added from back-end.What I am trying to achieve is whenever items add in back-end, I want to receive notification in my app.
For the notification part I found two options.
FirebasePlugin Link
Azure push notification
I need some clarifications about
Which way should I follow? Is there any other cost effective way to implement push notifications in ios and android in cross platform way(Xamarin.forms)?
For implementing push notifications in ios ,is APN certificate is mandatory? Currently I don't have apple developer account.So for testing notification in ios seems difficult.
Any help or guidance is appreciated
Which way should I follow? Is there any other cost effective way to implement push notifications in ios and android in cross platform way(Xamarin.forms)?
From my experience the easiest way for me was to use firebase console to manage notifications both for Android and iOS. I have similar platform that uses push notifications to users whenever webapp database is updated, by certain users. To my disappointment Azure Push were more complicated to manage.
For implementing push notifications in ios ,is APN certificate is mandatory? Currently I don't have apple developer account.So for testing notification in ios seems difficult. Any help or guidance is appreciated
Yes. Apple developer account is mandatory. Moreover you cannot test your push notifications on iOS emulator. You must use physical device.
App Center Push is what I've started using now. Push services are free (which is great) and they have Xamarin SDKs which handle most of the platform specific config so it's really quick to get push working.
As the other answer has stated, you will still need an apple developer account and physical device to test on iOS.
It's part of the the Microsoft App Center offering which provides many other useful services for mobile development.
#groveale App Center Push feature is being retired(https://learn.microsoft.com/en-us/appcenter/push/) so I would suggest using firebase or the implementation provided by xamarin docs.

Does googleservices.json file in firebase contain any sensitive data? [duplicate]

This question already has answers here:
What does google-services.json really do?
(3 answers)
Closed 4 years ago.
I have an existing xamarin android application which uses GCM client for pushing notification using Azure Notification Hub. GCM server and client API's are deprecating on April 11,2019. Can i continue using GCM.client library with FCM server? If yes, do i need to modify the existing code
In the documentation, it is mentioned to add googleservices.json file in android application. I want to know whether file contains any sensitive data. Can i register my device with FCM using the sender ID of android project added in FCM?
You should think of google-services.json containing only public information. All of those strings get baked into your app by the gradle plugin that processes it. The protection for your app currently happens via the Google Play services app that's installed on almost all devices. That's why you're asked for your SHA-1 signing key during signup.
You can also use the existing GCM client broadcast receiver for receiving GCM push notification using the Firebase configuration. In the cloud message setting in the Firebase configuration, you could see a legacy server api key with which you can try sending push notification from GCM.
However I will recommend you to do the FCM configuration using the googleservices.json file in android application. This will not add any sensitive data and you can register your device Id using the broadcast receivers where you can get the push token.

Read Notification via web

I want to implement a push notification service. The idea is to use the GCM Service. Is it possible to read the notifications both via web app (the app is written in php using laravel) and via mobile app for the authenticated users using the same technology?
I think it is possible, I also see this tutorial that can help you to achieve that. It also use PHP as a sample, so it seems like your work will be easier:)
It explains here the basic steps that you need to achieve push notification. It has a sample code and a screenshot to make you understand more the content of this tutorial.
In developing this application, it involves two parts, a GCM Server Application that create Web application using Php to send message to User via GCM Cloud server and GCM Client Application that create Android application which receive messages sent from GCM Server Web App.
For more information you can also check this links:
Implementing Push Messaging for Chrome
How to send push notification to web browser?

Does IBM BlueMix's Push Notifications service provide a console for authoring messages?

Not finding anything here:
https://console.ng.bluemix.net/docs/services/mobilepush/index.html
I'm looking for a web console for sending messages to apps - similar to what is offered by UrbanAirship and Parse (rest its soul).
Yes the IBM Push Notification service has a Push Dashboard where you can author messages, customize the notification payload, specify the target audience and send notifications to both iOS and Android in both Production and Sandbox modes.
Here's a screenshot of the Push Dashboard:
The docs go into it a bit here: https://console.ng.bluemix.net/docs/services/mobilepush/enablepush_ios.html#t_push_send
To access it you'll just need to create a Bluemix application using the MobileFirst Services Starter Boilerplate, and then navigate to the IBM Push Notifications instance from your application dashboard at which point you will be prompted to provide your .p12 certificate and/or GCM credentials.

WP7 - Add Authentication to Push Notifications

I am looking to add authentication to my WP7 application. I currently have simple, unauthorized push notifications working thanks to this MSDN sample.
I am having difficulty figuring out exactly what I need to change in my code in order to get authentication. I have read this MSDN article and know I need to get a TLS certificate uploaded to the App Dev website (in progress) and get some info from it once it's verified.
Thanks for reading/helping!
If you mean code to change in your WP application, you shouldn't have to change anything. Authentication simply changes the way your web service communicates with the Microsoft Push Notification Service, rather than how the Microsoft Push Notification Service communicates with your app on the phone.

Resources