ShrimpCrackers
ShrimpCrackers

Reputation: 4542

How to send URL to OneNote Android App?

I have a URL that I want the user to open in OneNote or a web browser using an Android intent. With web browser it's easy. I just use ACTION_SEND and set the intent data with the url.

How do I add OneNote app (if available) to the list of apps to choose from as well as send this URL data?

Upvotes: 1

Views: 1249

Answers (3)

ShrimpCrackers
ShrimpCrackers

Reputation: 4542

I solved it using the following code:

String url = link.Uri;
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));

if (intent.resolveActivity(context.getPackageManager()) != null) {
    context.startActivity(intent);
}

Upvotes: 0

Rajesh N
Rajesh N

Reputation: 6693

Edit

String onPackageName = "com.microsoft.office.onenote";
    Intent launchIntent = getPackageManager().
                        getLaunchIntentForPackage(onPackageName);
                launchIntent.setAction(Intent.ACTION_SEND);
                launchIntent.putExtra(Intent.EXTRA_TITLE,"Hello world");
                launchIntent.putExtra(Intent.EXTRA_TEXT,"Hello world");
                launchIntent.putExtra(Intent.EXTRA_SUBJECT,"htttp://www.google.com");
                startActivity(launchIntent);

Upvotes: 0

Arrigo Pierotti
Arrigo Pierotti

Reputation: 203

Look at this other question, it should have all your answers

Launch OneNote using Share Intent in Android

Upvotes: 1

Related Questions