I am building a chat app for my University library, and have run into some hurdles. The technologies I am using are Xamarin Android and Microsoft Azure. The issue I have is that I don't know how to connect my Xamarin Android app to my Azure SQL database. I need the database for a couple of reasons:
1) Authenticating my users to ensure only our University students can log in.
2) For the list of topics that the library may wish to put up for the students.
I will also be needing to use SignalR for the chat capabilities.
Now on Azure I have created a Web+Mobile app, which has given me a URL for the app, and I have created an SQL database, which has given me connection info for the database.
How do I connect my mobile app to the database, so I can perform my CRUD operations? I have gone through the documentation on Xamarin like "Consuming a RESTful web service" but unfortunately am still needing to find the solution.
Thanks and Regards,
Aditya Johar
How do I connect my mobile app to the database, so I can perform my CRUD operations?
You could create a Web API for validating login users and CRUD operations, and you could use ADO.NET objects (SqlConnection, SqlCommand etc) or Entity Framework to work with your Azure SQL database. And then you could use HttpClient to send request to Web API to validate login user and do CRUD operations from Xamarin Android app.
Example: CRUD ASP.NET Web API With Entity Framework
Xamarin Android: Create Login With WEB API Using Azure SQL Server
I will also be needing to use SignalR for the chat capabilities.
You need to create hub class and define hub methods that clients can call, and then you could start the hub connection and invoke methods on the hub server in your Xamarin Client. The following articles would be helpful.
ASP.NET SignalR Xamarin Client
ASP.NET SignalR
Related
i want to build an android application and i need to save and retrieve data from sql server database
so i need to do that with web service
i dont have knowledge in web services and how they are done
so can you help me what is the best way to do the web service and connect my android client with sql database
That's a pretty broad question, but here are the basics. A web service is a program or app that runs on a web server, usually exposed to the internet, or within a company's LAN on their intranet. Web Services can be built using ASP.NET or JAVA or PHP. I've used ASP.NET, specifically Web API 2.0, and Entity Framework. Entity Framework makes it very easy to connect your Web Service to your SQL Server database. With Web API and Entity Framework, you can create your web service and connect it to your database with basic Read/Add/Update/Delete capability in 1-2 hours.
Once you write your web service, you need to publish it on a Web Server as a Web App. I typically publish to an IIS Web Server (also Microsoft). For that you need a Website Hosted account with a Microsoft based server. Microsoft can host your Web Service using the Azure Cloud service. You can check out some tutorials for building your Web Service using the technologies mentioned and deploying to the Web using Azure. You can get a free Azure account to start with. Then, if you need to use it for a long time, you might need to pay for hosting fees.
This is probably the easiest and best way for you to get started, particularly if you are new to web services.
Good Luck!
Here is a tutorial using the technologies I've mentioned, except for Azure. But you should be able to find a tutorial for publishing a web service to Azure separately.
https://www.c-sharpcorner.com/article/asp-net-web-api-crud-logics-using-entity-framework-without-writing-single-code/
I have been using a Realm for mobile development and now I am trying to build a website using the same database. I was wondering if a realm database can be used for standard web development.
This section of their "Sync" documentation explains how to use GraphQL for
retrieving Realm data in a web browser [...]. The API supports retrieving data or applying changes via HTTP requests and realtime subscription events via a Websockets connection.
So yes, a realm database can be used in standard web development (including frontend), via GraphQL.
I want to develop a mobile application (android app) for my company web application. So , it will use the same database with the web database. My company use mysql google cloud. How can i connect my mobile application with the database ?
Actually ran into the same scenario recently. What i did was went ahead and looked into how to specifically connect your android application to phpmyadmin, which is a database that can connect android to your web sites database. Not sure who your web host is but i have a site that is hosted by Hostgator and they implement phpmyadmin in order for the webmaster to go ahead and handle the database. For more info i have posted this link which will guide you on the proper steps to take to connect phpmyadmin to your android application.
https://www.youtube.com/playlist?list=PL0_XE0UFeWvaY5NeFcFaGmEFJmJGhnims
Hope this helps. :)
Create api interface in backend (php, etc...) through web to access database.
Use httpconnection to connect web interface and upload/download data by parameters.
I am looking to create a simple xamarin.android mobile application which can connect to and interact with an SQL database hosted in azure. What would be the best way to create this connection? I have been able to create a simple console application which can do this if that helps, but am unable to do a similar thing with an android app. Thanks
You can try Azure App Service Mobile Apps to work with an SQL database hosted in Azure in your app.
Have a look at these samples from Xamarin. The "MyShoope" App in particular uses data storage.
I have provided my existing .NET Backend for reference on how to create your controllers and data entities to publish to Azure. Read through the Azure Mobile Apps tutorial to learn how to create and setup your own Mobile Apps backend for My Shoppe. https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-forms-get-started/
How can I connect an Android application to a DB2 database stored in BlueMix?
I know that some Java libraries are missing in Android, so I can't use JDBC to connect to the database.
Any Idea?
You can not talk directly to the SQL DB on Bluemix from your android app. You will need to create an intermediary application on bluemix that talks to the db and your android app can talk to that application. You can implement this backend as a RESTful API (Java JAX-RS, Node.js w/ Express etc). The Boilerplates on Bluemix are a good place to start.
There is also the Mobile Data framework on Bluemix that simplifies this by setting up all the mobile backend for you.