OK, just found another difference between iOS and Android (strange one, I think)
According to Android Share Intent for a Bitmap - is it possible not to save it prior sharing?
I can't share an image without saving it
In my case, I want to share a screenshot (byte array) to other apps (Facebook, Instagram, Mail, etc), but I have to save it first, no matter in internal or external storage
It's totally doable on iOS using UIActivityViewController with NSArray as input, but I can't do it with Intent and ACTION_SEND to share a byte array
Did I miss something or it's just undoable currently?
Any ideas would be appreciated
Related
I would like to make image sharing easier by implementing what Telegram does to send a picture:
That is, a gallery strip with the latest pictures.
But until now I've only worked with external intents to launch the native gallery.
How can I implement this? Do I have to manually search the phone for pictures? I assume I require strong permissions for this?
I am still new to cloud and mit app inventor.But I would to ask some question regarding cloud and mit app inventor.
But firsty i would like to explain how project should work.
My project is about home security system. When a press button is pressed, it will capture the image of visitor and the home owner will receive picture of the visitor on android app. The android should be able to receive picture and unlock door by pressing button unlock. The camera used is VC0706 Camera connected to Arduino Mega.
My question is that can mit app inventor receive picture from cloud since all of the picture taken will be stored in cloud.
Accessing images and sounds in App Inventor 2
Applications built with App Inventor can access sound, image, and video sources from three different kinds of locations:
Application assets
The sources labeled Media shown in the designer — part of the application's assets — are packaged with the application. Anyone who installs your application will have them, as part of the application. You also specify them in the designer, which is convenient. You can also specify these in programs by their file name: just use the file name without any special prefix. For example, if you have an image asset named kitty.png, you can use it as an image: just set the Picture property of an image component to the text kitty.png. You can similarly use files names for sound (Sound or Player) or video (VideoPlayer).
Assets are the most convenient to use, but the space for them is limited to a few megabytes, because they must be packaged with the application. They are good for small images and short audio selections. Bit you would probably not use them for complete songs or videos.
The phone SD card
You can access files on your phone's SD (secure digital) card using file names that begin with /sdcard . You could play a song on your SDCard by setting the source of a Player component to
/sdcard/Music/Blondie/The Best of Blondie/Heart of Glass.mp3
and starting the Player (assuming of course, that the song file is on the SDCard). Make sure to specify the complete file name, including the "mp3".
The Android system also includes an alternative way to designe SDCard files as URLs. Here you prefix the file name with file:///sdcard and use "URL encoding" for special characters. For example, a space is "%20". So you could designate the same file by setting the player source to
file:///sdcard/Music/Blondie/The%20Best%20of%20Blondie/Heart%20of%20Glass.mp3
Note that you'll want to use a Player component for this, not Sound. A complete song like this is too large for Sound to handle.
Images and videos can be designated similarly.
App Inventor doesn't (yet) include any way to store files on the SD card. It also doesn't (yet) include a way to list the files on the SDCard. You'll have to use other applications or the Android phone file manager for that.
Using the SD Card provides a lot more space for media than trying to package things as assets. The drawback is that users won't automatically get them by installing your application.
URLs and the Web
You can access files on Web using URLs, starting with http:// , for example, setting the picture property of an image to
http://www.google.com/images/srpr/nav_logo14.png
and similarly for music and videos. Make sure you use the link that points to the actual file, not to players for the files, which is much more common on the Web, especially for music and videos.
Other content URLs
The Android system also uses URLs to access various places that media is stored on the phone. For example, the images in the photo gallery can be accessed with file names beginning content://media/external/images/media , as you can see by using the ImagePicker and examining the resulting image path.
App inventor 2 has built-in web storage TinywebDB which stores text strings only.
In your scenario, post the images to somewhere on the web, and then store the image URIs in TinyWebDB insdie App inventor.
Yes, using MIT App Inventor you can send and receive the picture not directly but indirectly. First, you have to convert that image to imagebase64 it means in text formate then decode this text to get the original image. It means you can store any images in clouddb or firebase. Here is the video about that
https://youtu.be/ySruxnxeJgM
In the Inshorts app, when you click on the share button. It shares the news card with a modified image of the card. How it does that.
I can think of doing it by changing the view to a bitmap and then storing on file system temporarily, and then trigger an intent of sharing the image among various apps like WhatsApp / facebook etc.
Is there any other method available to do that, instead of bitmap conversation.
I know there are many similar questions, but I need specifics. I originally wanted my app to open PDFS within the app itself, but I have settled to send an intent activity to adobe reader. I am currently opening PDFS by looking for the file on the device itself. Is there a way I can have the PDFS in my app, and create a folder on the users device, and then look for them? or something similar? Obvisouly the user isn't going to have the PDF already installed on their device. Here is my current code.
Intent intent7 = new Intent();
intent7.setPackage("com.adobe.reader");
intent7.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Download/Auto-example.pdf")), "application/pdf");
startActivity(intent7);
Is there a way I can have the PDFS in my app, and create a folder on the users device, and then look for them?
You can put the PDF in internal storage (e.g., getFilesDir()), then use FileProvider to serve them via a ContentProvider. This sample project demonstrates serving a PDF from internal storage (copied there from assets/) and viewing it in the user's chosen PDF viewer. There is also an Android training module covering this.
With respect to the code that you have, please use ACTION_VIEW as your Intent action (e.g., pass that to the constructor) and delete the setPackage() line.
Ref: How to render PDF in Android
I have a bytestream with PDF contents and want to display the same in my android app. Is there a way I can do that without saving it as a physical file? For security reasons: I want the user to be able to just view the PDF and not store it in the phone memory or SDCard.
Does google doc viewer has the ability to take bytestream and render it? Or any other app that is installed in the android phone?
You cannot push "a bytestream" (presumably a byte[]) to another application. While there may be ways you can have another application pull the bytes to render it, any application will be able to do that, not just your PDF viewer, which will defeat your security goals.