-1

How can I register my xamarin android app as an SMS Assistant handler?
Whats exactly the difference between assistant handler and default handler?

I found this code fragment to change the default SMS handler:

Intent setSmsAppIntent = new Intent(Telephony.Sms.Intents.ActionChangeDefault);
setSmsAppIntent.PutExtra(Telephony.Sms.Intents.ExtraPackageName, Android.App.Application.Context.PackageName);
Forms.Context.StartActivity(setSmsAppIntent);

But with the shown dialog I can only select the preinstalled Message-App of Android.
Shown below:
Default SMS App request dialog

I red the Google policies for SMS handling and think that I have the to add my app as an assistant handler to fullfill the policy requirements. Because app should receive "commands" with SMS (in case no network connection is available) but not offers the user the possibility to manage the received messages. So the default SMS handler should be the default message app.

(The app itself is working fine. Just the requirements arn't fullfilled.)

I also found this link: How to make an application default phone or assistant handler on the device

There is mentioned to use RoleManager to requests. Is this comparable with Xamarin.Essentials or exists an other package for that?

it-person
  • 98
  • 1
  • 11
  • I'm voting to close this question as off-topic because it concerns Google Play Store policies and procedures, rather than programming. Please refer to: [Are developer-centric questions about application stores on topic?‍](http://meta.stackoverflow.com/q/272165), [Why can't I ask customer service-related questions?](http://meta.stackoverflow.com/a/255746), and [the Help Center page regarding appropriate topics for this site](https://stackoverflow.com/help/on-topic). – Mike M. Aug 04 '20 at 15:36

1 Answers1

0

Check if your app have meet all the requirements for default handlers as listed here, for example:

Your app must ask to become a default handler before it requests the permissions associated with being that handler. For example, an app must request to become the default SMS handler before it requests the READ_SMS permission.

Your app must declare permissions that are appropriate for its use case. For more details about which permissions you can declare as a given handler, see the guidance on using SMS or call log permission groups in the Play Console Help Center.

nevermore
  • 15,432
  • 1
  • 12
  • 30
  • @jack-hua-msft Thanks I will check if the workflow is like you discribed. My intention isn't to use my app as default for SMS. I added some more information to my question. – it-person Aug 03 '20 at 10:04
  • OK, hope you can find something useful in the link I listed in the answer. – nevermore Aug 04 '20 at 07:40
  • @jack-hua-msft I found this line of code to register for handling sms in Xamarin Android "[Android.Runtime.Register("android/provider/Telephony", ApiSince = 19, DoNotGenerateAcw = true)]" How can I do this in xamarin forms? – it-person Aug 13 '20 at 09:27
  • Add this line above the class declaration, something like [this](https://learn.microsoft.com/en-us/dotnet/api/java.lang.runtime?view=xamarin-android-sdk-9]). – nevermore Aug 14 '20 at 05:35
  • @jack-hua-msft I added it in my Xamarin Android part and then it throws an "System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'" (I'm using this class with DependencyService) – it-person Aug 14 '20 at 06:56