Skip to content

ysxu/app-service-mobile-dotnet-fieldengineer

 
 

Repository files navigation

services platforms author
app-service\mobile, app-service\web
dotnet, xamarin
lindydonna

Azure App Service field engineer sample (web admin portal with AAD auth and push to AAD security group/geo-location; auth and offline-sync enabled Xamarin.Forms client)

Additions to original Field Engineer app at https://github.com/Azure-Samples/app-service-mobile-dotnet-fieldengineer:

  1. AAD Authentication on client and server
  2. Push enabled on client with Azure Notification Hubs
  3. Admin portal is able to push to 1. all app users; 2. targeted members of the admin's AAD Security Group; and 3. geo-location (City State) where the device is in

Try out a simple version of this demo and other Xamarin demos on "Try App Service".

This sample is for a mobile client app for field engineers at a cable company to more easily manage their appointments throughout the day. The app will sync the engineer's jobs for that day onto their device when there is an internet connection. When there isn't an internet connection, the Mobile Apps offline sync feature keeps the records available and edittable; when the engineer connects back to the internet, the local changes are synced and any new Jobs are pulled to their device.

This sample shows off some great features of Azure Mobile Apps and App Service, including:

  • Offline Sync
  • Easy to use client SDK for Xamarin

Overview

The first step of the sample is deploying the environment and code. Checkout the Deploying section below. Or, just click this button!

Deploy to Azure

Alternatively, you can deploy using the Azure Portal. Click here to deploy. Note: you can set the parameter useSQLCE to 1 or 0 to specify if you want to use SQLCE or a SQL Azure database. However, this template always creates a SQL Azure Database even if you set the SQLCE parameter to 1.

Once you've refreshed the client to get all remote changes, you'll see all the jobs you have waiting to be fulfilled. At this point, you can disconnect your internet and make some changes. All your changes will be saved through a restart of the app.

If you visit the admin page that comes with your site ({sitename}.azurewebsites.net/admin), you can see that none of the records have been updated. If you connect to the internet on your device again and refresh, your changes will sync to the server. You can see those changes reflected via the admin portal.

Deploying

Just click this button to deploy!

Deploy to Azure

Manual deployment - full version (with SQL Azure)

The easiest way to deploy is to use the Continuous Integration feature of App Service.

  1. Fork this repo in GitHub.

  2. Create a new Mobile App from the portal.

  3. In the Mobile -> Data section, create a new Data Connection. For more detailed instructions, see Create a .NET backend using the Azure portal.

  4. In the portal, navigate to All Settings for the new app.

  5. In the Publishing section, select Continuous deployment.

  6. Configure source control to point to your fork of this repo.

  7. Click the Sync button to do an initial deployment.

Try App Service version (SQL CE)

There is a project configuration that uses SQL CE as the server database and therefore does not require SQL Azure.

To set up this version, after step #2 above, add an app setting with key TRY_APP_SERVICE and value 1. To set an app setting, go to All Settings -> Application Settings -> App Settings. Then, continue with steps 3-6 above.

Mobile client project

Requirements:

  • Xamarin Studio running on Mac OS X
  • Azure Account (for a free trial, use Try App Service and the instructions there)

Steps:

  1. Open up the Xamarin Project

  2. Update the Mobile App Name, in ./Services/JobService.cs

  3. Select an iPad target and start debugging.

Issues

If you're having problems with the App, create an issue on GitHub.

We welcome and encourage PRs from the community. Just checkout Azure's CLA first.

License

See LICENSE for full details.

See also

About

Azure App Service sample with a web client and Xamarin mobile client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 93.9%
  • Batchfile 4.1%
  • PowerShell 1.6%
  • Other 0.4%