Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8577127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:05:28+00:00 2026-06-11T20:05:28+00:00

I have a application for WP7 and Android, and this application must have supporthas

  • 0

I have a application for WP7 and Android, and this application must have supporthas support for “any” connection type (WiFi, NFC, Bluetooth etc)

I have then created a layered model with MVVMCross https://github.com/slodge/MvvmCross

I have an interface for example Android Bluetooth must implement

interface IConnectionService
{
    List<TargetDevice> FindDevices();
    void Connect(TargetDevice targetDevice);
    void Disconnect();
    byte[] Read();
    void Write(byte[] command);
}

I want to be able to request the user for Bluetooth Access, but I do not want to program my UI specifically to Android Bluetooth, so the view and view-model should not know which intent is used, all this should be handled by the class implementing IConnectionService

The issue is that it should also work for Windows Phone which do not use intents, it uses tasks, so how do I make an interface that allows me to make either a Intent request or a task request without anyone knowing what type of request is needed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:05:29+00:00Added an answer on June 11, 2026 at 8:05 pm

    This is similar to the way MvvmCross allows users to make phone calls.

    When using this pattern:

    The ViewModel code consumes a platform independent service via an interface – e.g.:

    public interface IMvxPhoneCallTask
    {
        void MakePhoneCall(string name, string number);
    }
    

    consumed by

        protected void MakePhoneCall(string name, string number)
        {
            var task = this.GetService<IMvxPhoneCallTask>();
            task.MakePhoneCall(name, number);
        }
    

    in https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.Core/ViewModels/BaseViewModel.cs

    The app setup code injects the platform specific implementation for the interface – e.g:

            RegisterServiceType<IMvxPhoneCallTask, MvxPhoneCallTask>();
    

    In WP7 – this uses the PhoneCallTask – https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross/WindowsPhone/Platform/Tasks/MvxPhoneCallTask.cs

    public class MvxPhoneCallTask : MvxWindowsPhoneTask, IMvxPhoneCallTask
    {
        #region IMvxPhoneCallTask Members    
    
        public void MakePhoneCall(string name, string number)
        {
            var pct = new PhoneCallTask {DisplayName = name, PhoneNumber = number};
            DoWithInvalidOperationProtection(pct.Show);
        }
    
        #endregion
    }
    

    In Droid – it uses the ActionDial Intent – https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross/Android/Platform/Tasks/MvxPhoneCallTask.cs

    public class MvxPhoneCallTask : MvxAndroidTask, IMvxPhoneCallTask
    {
        #region IMvxPhoneCallTask Members
    
        public void MakePhoneCall(string name, string number)
        {
            var phoneNumber = PhoneNumberUtils.FormatNumber(number);
            var newIntent = new Intent(Intent.ActionDial, Uri.Parse("tel:" + phoneNumber));
            StartActivity(newIntent);
        }
    
    
        #endregion
    }
    

    In Touch – it just uses Urls – https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross/Touch/Platform/Tasks/MvxPhoneCallTask.cs

    public class MvxPhoneCallTask : MvxTouchTask, IMvxPhoneCallTask
    {
        #region IMvxPhoneCallTask Members
    
        public void MakePhoneCall(string name, string number)
        {
            var url = new NSUrl("tel:" + number);
            DoUrlOpen(url);
        }
    
        #endregion
    }
    

    In the vnext version of mvvmcross, this approach is further formalized using plugins – see a brief introduction to these in the ‘going portable’ presentation at http://slodge.blogspot.co.uk/2012/06/mvvm-mvvmcross-monodroid-monotouch-wp7.html

    For example, in vNext the phone call code above is contained in the PhoneCall plugin – https://github.com/slodge/MvvmCross/tree/vnext/Cirrious/Plugins/PhoneCall


    One of the challenges of your task may be the word “any” – differences in platform implementation might make it hard to define a cross-platform interface that works across all the platforms for any one of NFC, Bluetooth, etc, let alone all of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this post: Display GIF in a WP7 application with Silverlight But
Hi i have a WP7 application that calls a wcf who runs with membership
I have recently created an application for wp7. Now i am ready submit an
I have writted a little application in WP7 in the panorama mode. I would
I have settings page in my wp7 application. I loads for quite long time
I have a user control in my wp7 application which contains two text boxes
I'm building WP7 application using DropNet. I have successfully managed to log in and
Can I apply transitions for images in my wp7 application? I have a set
I have application with needs to have access to some sensitive data(in this case
I have a page in my wp7 application which need to display an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.