Displaying preview of any URL link entered by the user like Skype? - android

I would like to display the URL preview entered by the user like skype app in . For example if i am entering a youtube url in the skype app to other person , it is automatically displaying the thumbnail preview of that URL entered by the user.
https://www.youtube.com/watch?v=QUgRDYehv0M
When i have entered above url means.. Skype automatically showing the thumbnail preview of that link like below:
Like skype i would like to do in android. Whenever if user enters any url means.. i need to show the preview of an url..
https://play.google.com/store/apps/details?id=com.leocardz.link.preview&feature=search_result
Refered above app.. anyother help or guidance will be helpful.

You can import the library using Gradle :
Simply add the repository to your build.gradle file:
repositories {
jcenter()
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}
And you can use the artifacts like this:
dependencies {
compile 'org.jsoup:jsoup:1.8.3' // required
compile 'com.leocardz:link-preview:1.2.1#aar'
}
You can refer this link for more details.

Related

Firebase photoURL is not displaying properly in react-native

I'm using the Firebase authentication module in react-native with native-cli. On sign up, I'm uploading an image using react-native-document-picker. After selecting an image from the gallery it will look like this:
{
"fileCopyUri":"content://com.android.providers.media.documents/document/image%3A33077",
"name":"IMG-20211005-WA0007.jpg",
"size":67094,
"type":"image/jpeg",
"uri":"content://com.android.providers.media.documents/document/image%3A33077"
}
and using this function to upload it on firebase:
auth().currentUser.updateProfile({
displayName:fullname,
photoURL:JSON.stringify(pic),
})
now when I get it like this:
const fireUser = auth().currentUser;
console.log(JSON.parse(fireUser.photoURL))
It displays the image on the screen but when I quit the app and again open or log in to the app it's not displaying the image but I'm having pic in photoURL.
Is it possible to convert file?
{
"fileCopyUri":"content://com.android.providers.media.documents/document/image%3A33077",
"name":"IMG-20211005-WA0007.jpg",
"size":67094,
"type":"image/jpeg",
"uri":"content://com.android.providers.media.documents/document/image%3A33077"
}
into URL?
What am I doing wrong?
The URL you're passing to updateProfile is a local URL on your Android device, which won't work. To ensure the profile is visible, upload the local file to a public place in the cloud, and then pass the URL for that location to updateProfile.
For example, you can upload the file to Cloud Storage with Firebase, then get the download URL that provides read-only, public access to it, and store that in the user profile.

Android Studio App to send images without permission or buttons

Is it possible to create an App which can receive images without using any permissions or buttons on the receiving device? I would like to show these images instantly on the device (device has no touchscreen so I can't accept any permissions). The device has only WiFi and no Bluetooth.
I was thinking about choosing a image from my smartphone, connect it to the target device, send it via WiFi-Direct(P2P) and display it on the device.
Is something like that possible? All the tutorials to sending/receiving images always have the issue that buttons or permissions are necessary.
Yes you can achieve that simply if you set an ImageView that will load the image from an URL (for example). Could be your website or a share site that has a static link reference.
It could look like that:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = findViewById(R.id.imageView);
Glide.with(this).load("https://your-image.png").into(imageView);
}
Use this implemtation in your build.gradle:
dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}
And in the other build.gradle folder:
repositories {
google()
mavenCentral()
}
Here is a example video written in kotlin.
And also the glide feature explained at github.

Android Creative SnapKit: Photo with attachment Url pop-up opens twice

I am trying to share Image on SnapChat with attached URL generated from Branch IO. For that I have used Creative SnapKit.
When I clicked on the attached link, it gives me two pop-ups.
First pop-up redirects me to Playstore
The second pop-up redirects me to the installed app.
Ideally, if an app is installed then it should only give a single pop-up which redirects to the App.
I am using the following version:
implementation([ 'com.snapchat.kit.sdk:creative:1.6.3', 'com.snapchat.kit.sdk:core:1.6.3' ])
Implementation:
snapCreativeKitApi = SnapCreative.getApi(getActivity());
snapMediaFactory = SnapCreative.getMediaFactory(getActivity());
SnapPhotoFile photoFile;
try {
photoFile = snapMediaFactory.getSnapPhotoFromFile(fileName);
} catch (SnapMediaSizeException e) {
e.printStackTrace();
return;
}
SnapPhotoContent snapPhotoContent = new SnapPhotoContent(photoFile);
snapPhotoContent.setAttachmentUrl(urlToShare);
finish();
snapCreativeKitApi.send(snapPhotoContent);
AndroidManifest.xml
<meta-data android:name="com.snapchat.kit.sdk.clientId" android:value="ClientID" />
We are using same keys for iOS and Android. For iOS, it's working as expected.
Please let me know if I am doing anything wrong here.
Here is the video link for the issue I am facing:
https://www.dropbox.com/s/ivpshfs9o15kivr/20-08-20-10-32-07.mp4?dl=0
Finally, I found the solution & it was because of Branch IO configuration:
I have changed the configuration > DeepView Manager > Branch Default Bridge Template.
I put Canonical Identifier and Canonical URL as mentioned in the documentation.
For more information, read below Branch IO documents:
https://help.branch.io/using-branch/docs/deepviews
https://blog.branch.io/branch-concepts-the-branch-universal-object/

How to add Alphabetical profile pictures in android studio?

I want to add a default profile picture for my logged in user in my Android application. The way android marshmallow and above android version provides default alphabetical contact picture in contacts. There is a similar application "Micopi Pico". I want to use such functionality in my Android application to display the alphabetical profile picture as user's default profile picture. Is there any library or API or any method to do so? please help me.
There are many libraries to do that, here is an example, a library called Text Drawable (Click here to know more)
Import with Gradle:
repositories{
maven {
url 'http://dl.bintray.com/amulyakhare/maven'
}
}
dependencies {
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
}
Usage :
TextDrawable drawable = TextDrawable.builder()
.buildRect("A", Color.RED);
ImageView image = (ImageView) findViewById(R.id.image_view);
image.setImageDrawable(drawable);
You can go through the documentation to know more about the usage.
You should always try searching for a solution to your problem before asking a question in stack overflow.

Auto Play and Stop Youtube video in Listview

I have a listview/Recyclerview. Each rows contain Youtube video panel. I am able to display a list of videos in listview. So now user have to click on play button and stop for pause video.
But i am trying auto play one video at a time when it visible to user and auto stop when user scroll down. I looked at but not having solution .
Automatically Playing video in listview/scrollview similar to facebook
Kinldy help me!
Add this library to your project
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.waynell:VideoListPlayer:1.4'
}
source : https://github.com/waynell/VideoListPlayer

Categories

Resources