Forum Xamarin.Android

Starting an external activity from a Service

Hi, I built a widget and set OnClickPendingIntents for some of its view elements.
I want to make one of my view elements (ImageView) to start another app (external to this solution).
I tried to add an intent-filter to the other app and make it start it with no success. This is my code:

Intent launchIntent = new Intent (context, typeof(updateService));
launchIntent.SetData (Android.Net.Uri.Parse ("infoClicked")); 
PendingIntent pending1 = PendingIntent.GetService(context, 0, launchIntent, PendingIntentFlags.UpdateCurrent); 
updateView.SetOnClickPendingIntent (Resource.Id.infoImageView, pending1); 

in my Service, I have OnStart(Intent intent, int startId)
{
if(intent.DataString=="infoClicked")
{
Intent external = new Intent(Intent.ActionView,Android.Net.Uri.Parse("com.mycompany.myapp"));
startActivity(external);
}
}

There is no problem with identifying the intent.DataString! (this is how the other elements works and its fine).
There is a problem with the external intent and starting the activity.

Thanks a lot guys.

Sign In or Register to comment.