Extension intent with whatsapp doubt

welcome i am making an extension which send a file In whatsapp
Note:the user will select who to send
I coded this

package edu.hifiapps.Sharex;
import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.;
import com.google.appinventor.components.runtime.
;

import android.app.Activity;

import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;

import android.net.Uri;

import android.text.TextUtils;

import android.util.Log;

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;

import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.common.YaVersion;

import com.google.appinventor.components.runtime.errors.YailRuntimeError;

import com.google.appinventor.components.runtime.util.AnimationUtil;
import com.google.appinventor.components.runtime.util.ErrorMessages;
import com.google.appinventor.components.runtime.util.NougatUtil;
import com.google.appinventor.components.runtime.util.YailList;

import java.io.File;

@DesignerComponent(version = 1, description = "this extension is used to make emails easy made by
" +"hifi apps. contact here-
website
",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "https://i.ibb.co/pnVG9xf/picture.png")

  @SimpleObject(external = true)

public class Sharex extends AndroidNonvisibleComponent {
private ComponentContainer container;
private Context context;
/**
* @param container container, component will be placed in
*/
public Sharex (ComponentContainer container) {
super(container.$form());
this.container = container;
this.context = container.$context();
}

@SimpleFunction(description = "")
public void Send(String file){
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, file);
sendIntent.setType("image/*");
sendIntent.setPackage("com.whatsapp");
context.startActivity(sendIntent);
}
}

The compiler din't show error
i coded this in app inventor
blocks (17)
in mobile


i know the intent,activity i gave must be wrong thus this comes but how to solve it

1 Like

can some help

1 Like

better, you create a more unique extension "do not imitate others", thank you
https://puravidaapps.com/sharing.php

1 Like

it's for learning purpose only i know even u have made whats tools but i wan't to learn

2 Likes

i found answer my self thanks

1 Like

Okay :+1:
:innocent: :kissing_heart:

You can't use file path with Intents.
You must provide an URI.

Thanks I understood and did I will show answer soon in a post