How can i accept shared images

Kodular has an option to receive photos and videos shared from other apps. How to receive files in niotron?

Hello @Mr_Tutor
Welcome to Niotron,

I guess for now it’s not possible for now in Niotron, maybe you can try with some extension

I searched a lot and didn’t find any extension, can you please help

I don’t know any of it, once i too tried for it, but never got

is there any option to use this https://developer.android.com/training/sharing/receive#java

See now i have stopped building extensions, i do it sometimes for time pass, maybe someone other can tell you about this more better than me, so let’s see!

Can you please guide me to do it ?

There is no option in niotron to receive shared images from other app, I have approached many people to make an extension for it, but no one helped me, I am trying to do it myself, can someone help me, I don’t know java programming, so I have been trying for several days. This is reference from android documentation https://developer.android.com/training/sharing/receive
This is my code :point_down:

package com.imagereceivefromapp.shaf.rchdd;

import android.app.Activity;
import android.content.Context;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.net.Uri;
import android.os.Bundle;
import android.content.Intent;
import android.content.pm.PackageManager;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.Component;
import com.google.appinventor.components.annotations.androidmanifest.*;
import com.google.appinventor.components.annotations.UsesActivities;

@DesignerComponent(
        version = 1,
        description = "asdf",
        category = ComponentCategory.EXTENSION,
        nonVisible = true,
        iconName = "")
  @UsesActivities(
  activities = {@ActivityElement(intentFilters = {@IntentFilterElement(actionElements = {@ActionElement(name = "android.intent.action.SEND")} , 
  categoryElements = {@CategoryElement(name = "android.intent.category.DEFAULT")},
  dataElements = {@DataElement(mimeType="image/*")})} , 
  name="com.imagereceivefromapp.shaf.rchdd")}                              
  
)        

@SimpleObject(external = true)

public class imageShareReceive extends AndroidNonvisibleComponent {

    public imageShareReceive(ComponentContainer container){
        super(container.$form());
    }
    public static class DeepActivity extends Activity{
      @Override
     protected void onCreate (Bundle savedInstanceState) {

      Intent intent = getIntent();
      String action = intent.getAction();
      String type = intent.getType();
       if (Intent.ACTION_SEND.equals(action) && type != null) {
       if (type.startsWith("image/")) {
        handleSendImage(intent);
       
       }
       
       }

      
      }// create close
      void handleSendImage(Intent intent) {
    Uri uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
    if (uri != null) {
        if (uri != null){
		PackageManager packageManager = getPackageManager();
        	Intent intentValue = packageManager.getLaunchIntentForPackage(getPackageName());
		intentValue.putExtra("APP_INVENTOR_START",'"'+ uri.toString() +'"');
        	startActivity(intentValue);
		finish();
            }
    }
}
    }
}

The way of decleration of class is wrong, it should be in UpperCamelCase

Okay , now i can share image from other app but the app automatically close

Try this :point_up_2::point_up_2:

Share some video

First, I don’t really support private support questions, because my time is limited. Also, posting in the community publicly helps people to learn. Next time please don’t message me if you have a question…post it to the community and I will have a look, unless if it is urgent.

Second, such extension is already available in the App Inventor community. Courtesy @Sunny_Gupta.

@Taifun Tagged you. Can you add this to the extensions directory? Thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.