Mobile Elements is a VoIP mobile application which runs on Android, iOS and Universal Windows platforms. This application has been built using Xamarin forms cross platform development environment which is a built-in feature in Visual Studio. The Mobile Elements application supports outbound and inbound calling facility using the Voice Elements server platform and a wifi connection.
Setting up your Android Device to Receive Inbound Calls
- Android devices use Google Cloud Messaging (GCM) services to deliver remote push notifications. When an inbound call reaches our Voice Elements server application, then the server sends a push notification through GCM services. The server uses the PushSharp library to send the push notifications. GCM sends these messages to the intended device. For more understanding on remote push notifications and its configuration, please refer to this Microsoft article Remote Notifications With Google Cloud Messaging.
- When the notification arrives at the end device, Mobile Elements pops a screen to answer/reject the call. Missed call alerts can also be delivered to the end device if the Internet service is not available on the device.
- Right click on the MobileElements.Droid and click on the Properties. Then select the Build tab and set the Conditional compilation symbols to ENABLE_REGISTRATION. This flag will enable inbound call feature in the application.
- Verify that your device should contain Google Play Services in order to receive GCM push messages. Install the package Xamarin Google Play Services – GCM into your Mobile Elements client project.
- Create a project in Google Developer Console. You need to give a App name and Android Package Name over there. Note down your package name, API key, Sender ID and Application ID which will be needed later in the configuration.
- Now right click on the MobileElements.Droid and click on the Properties. Then select the Android Manifest tab and set your package name over there.
- Open the UserCredentials.cs file and set the URI and host of your server in order to connect through the web socket for outbound calls. Then open the MainActivity.cs file of MobileElements.Droid project and set the sender id in the beginning.
- Now you are all set to place an inbound call to your device through GCM push notifications.