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

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/

Related

Send Parameter View Modal to App-Delegate File (Xamarain)

I am a Xamarin developer I implement app switching in my project and it's done for the android version but I don't have an idea how to do it for the IOs version
When I use the open URL function in my view controller it's working
~if(Device.RuntimePlatform == Device.iOS)
{
try{
var param = new NSDictionary();
UIApplication.SharedApplication.OpenUrl(new NSUrl("URL that want to pass"), param, (completed) =>
{});
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString(), "123456");
}
}
}~
but when the app-center built APK for the android it's failed and getting me an error cause of the UIKit library
So I want to pass the parameter(Deeplink URL) from my view modal to App-Delegate File but I am not to much aware about the xamarin so I am not able to do this
Take a look at Xamarin.Essentials: Launcher.
You can use Launcher class directly in Forms project to open a URI, this is often used when deep linking into another application's custom URI schemes.
Sample
var supportsUri = await Launcher.CanOpenAsync("lyft://");
if (supportsUri)
await Launcher.OpenAsync("lyft://ridetype?id=lyft_line");
In iOS 9 and greater, Apple enforces what schemes an application can query for. To specify which schemes you would like to use, you must specify LSApplicationQueriesSchemes in your Info.plist file.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>lyft</string>
<string>fb</string>
</array>

Android and custom URL scheme

I'm working on an app with a custom url scheme.
It is opening some webpage for authentication in a chrome tab. This is done in xamarin forms like this:
Browser.OpenAsync(apiUrl + "mobile", new BrowserLaunchOptions
{
LaunchMode = BrowserLaunchMode.SystemPreferred,
TitleMode = BrowserTitleMode.Hide,
});
everything work as expected if I return a webpage with a link and click the the link manually:
Click here to go the app
But if i return a 302 redirect to the same url it will not close the chrome tab and dont focus the app again.
If i add a javascript in the response, it will not automatically open the url (close the chrome tab and focus the app)
I've tried things like this:
window.location = url;
window.open(url,'_self');
setTimeout(()=>window.open(url,'_self'),10);
(url is a valid variable, even tried alert(url) after changing the location and it show the correct url.
Why does it only work when I click the link manually?
In order to maintain the user's security and experience, the browser prohibits the direct use of window.open(URL) in JS to open new links.
Try to change like below:
setTimeout(()=>window.open(url,'_self'),500); //The delay time must not be too short or you will be intercepted

Facebook Module dialog error picture is not formatted properly

How do you include a picture in Titanium's Facebook Module dialog? In Titanium's example, the picture property in the dialog is a link of a picture from a website:
var data =
{
link : "http://www.appcelerator.com",
name : "Appcelerator Titanium Mobile",
message : "Checkout this cool open source project for creating mobile apps",
caption : "Appcelerator Titanium Mobile",
picture : "http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png",
description : "You've got the ideas, now you've got the power. Titanium translates " +
"your hard won web skills into native applications..."
};
fb.dialog("feed", data, function(e)
{
if(e.success && e.result)
{
alert("Success! New Post ID: " + e.result);
}
else
{
if(e.error)
{
alert(e.error);
}
else
{
alert("User canceled dialog.");
}
}
});
But what if you want to use a picture that's local and NOT via a link of a website like this?
var data =
{
link: "http://play.google.com/",
name: "Android app's name",
picture: "file:///data/data/com.appid/app_appdata/directory/name-of-image.jpg"
};
I get the picture property formatting error if I use the code above. See this image for visual reference: http://postimg.org/image/wjefdlalb/
I've tried using the FileSystem like this:
function getFile()
{
var imageFileToPost;
var imageFile = Ti.Filesystem.getFile("file:///data/data/com.appid/app_appdata/directory/name-of-image.jpg");
if (imageFile.exists())
{
console.log("exists");
imageFileToPost = imageFile.read();
}
return imageFileToPost;
}
var data =
{
link: "http://play.google.com/",
name: "Android app's name",
picture: getFile()
};
And the post is successful, there are no errors BUT the picture was NOT published on Facebook.
Note: I would use the graph but I need to use permissions like 'publish_actions' which means I have to to have Facebook review the app but they don't like prefill messages even when the user can edit message anyways. So is this really just a formatting issue with Facebook Module's dialog or it only takes URLs of a picture? If it's a formatting issue, can anyone tell me how to format this correctly because I really need to use the picture that's local and not from a website?
The answer is maybe a bit late, but I had the same issue recently.
It does not seem to be possible with the current version of the Facebook module to create a dialog to share local images.
Because I also needed this functionality for one of my apps, I forked the module (https://github.com/dthulke/ti.facebook) and added a method presentPhotoShareDialog which takes an image blob as argument. Unfortunately it only works if the native Facebook app is installed.
Example:
if (fb.getCanPresentShareDialog()) {
fb.presentPhotoShareDialog({
imageBlob : view.toImage()
});
}

Codename one launch native apps

I need to launch an andoird app via codename one.
We have already built an app in android.
The second app needs to be built in CN1.
I need to launch the first app using a button in the second app.
I did stumble across NativeInterface, however, did not find any examples to achieve the above.
Also, I need to create a pdf file using CN1. How do I achieve that ?
Any help would be appreciated.
Thanks,
Sanket
Regarding launching an app from a CodenameOne project you can do the following:
1)Use Display.getInstance().extecute(intentUri);
where the intent uri need to comply with the android intent convention it should look something like this: intent:#Intent;action=...
2)Create a NativeInterface then in the android implementation create your intent and execute it.
Regarding pdf generate, there isn't such api in codenameone, personally I would recommend on sending the data to the server and do the generation on the server side.
I can't find the intentUri in Android. How look the intentUri? I would execute Skype if i clilck on a Button but Skype can't be executed.
My Code:
#Override
protected void onKomm_Button2Action(Component c, ActionEvent event) {
try {
Display.getInstance().execute("com.skype.raider");
} catch (Exception e) {
Dialog.show("Error!", "Failed to start. Skype installed?", "OK", null);
e.printStackTrace();
}
}
How should like look my Code?
Thanks.

Downloading just the icon of an application from Google Play (Market)

Is there a way to download just the icons that are stored in a particular application from Google Play/Market without downloading the entire APK and installing it?
You can do this but it would require downloading he page source and then parsing it.
What you could do is first download the webpage, i like JSoup. Like
Document d = null;
try {
d = Jsoup.connect("https://play.google.com/store/apps/details?id=" + packageName).get();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Then you should parse that document for the following tag ""
Elements div = d.getElementsByAttributeValueContaining("class", "doc-banner-icon");
String path = div.get(0).attr("src");
This path variable should be the path for the image to download. I have not tested this.
Nope
There is no official API for market content. Be it to retrieve icons or anything else.
If you are just interested in getting the image files you can download them manually via the web front end to the Market. But I wouldn't write code to do this, as it is very likely that they will make a change to the web front end that will result in your code breaking. p.s. I am no lawyer, but also I don't think there is very much that you would be "allowed" to do with these images even if you did download them (without permission from each developer of course)
The answer by Jug6ernaut will no longer work. This works as of November 2016:
#WorkerThread public static String scrapeGooglePlayIcon(#NonNull String packageName) throws IOException {
return Jsoup.connect("https://play.google.com/store/apps/details?id=" + packageName).get()
.select("div[class=details-info] > div[class=cover-container] > img[class=cover-image]")
.attr("abs:src");
}
I created a small library that web scrapes the Google Play store. If this stops working in the future, please comment or create an issue on the GitHub project: https://github.com/jaredrummler/GooglePlayScraper
You could create a Yahoo Pipes like this http://kcy.me/hylg it will parse the page for you and extract a JSON in wich you could read the sinlge image URL.
http://kcy.me/hylj
You can parameterize the pipe in order to receive the link to the app you want to extract the image.
The simple solution is that just right click on the icon of the app from Chrom browser and save image as, this will save the icon with webp extension, now use this Conver webp to png
to convert the icon to PNG.

Categories

Resources