Could not use the standard linking in my app - android

I have just updated the new Uber app (January 8, 2018) and the deep linking is not working.
Could you explain more?
Below is my code:
formattedUrl = String.format("uber://action=setPickup&client_id=%s&dropoff[latitude]=%f&dropoff[longitude]=%f",
mClientId, http://to.lat , to.lng);
Uri uri = Uri.parse(formattedUrl);
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(uri);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(i);
With the old version of Uber app, my code works well. It shows the correct the pickup & drop off location but in the new app, it doesn't work.

May be they have updated things on this in their application.
You can generate deep link using this link.

Related

Android firebase dynamic link opens browser before launching the app

I've been using firebase dynamic links for my app and recently encountered the issue where when clicking on the link, instead of opening a choice view for what to use to open the app (where I can just choose my app) it's instead launching the browser first for a split second, then there's a small loading screen and then the app is launched.
This results a very unpleasant jitter that didn't happen before and I'm not sure what might suddenly cause this (I haven't changed the code). The only changes from before this issue and after is updating my phone to android version 12, and updating the gradle to use compileSdkVersion and targetSdkVersion 30.
Just in case, the code where I build the link for sending:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND)
.setType("text/plain")
.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Construct dynamic link
String link = ParametersConventions.PREFIX
+ "&"
+ ParametersConventions.PARAMETER
+ "="
+ DATA
+ ParametersConventions.POSTFIX;
DynamicLink.Builder builder = FirebaseDynamicLinks.getInstance().createDynamicLink();
builder.setLink(Uri.parse(link));
builder.setAndroidParameters(new DynamicLink.AndroidParameters.Builder("com.my.package").build());
builder.setDomainUriPrefix(ParametersConventions.DOMAIN_PREFIX);
DynamicLink.SocialMetaTagParameters.Builder metaTagsBuilder = new DynamicLink.SocialMetaTagParameters.Builder();
metaTagsBuilder.setTitle("title");
metaTagsBuilder.setDescription("descp");
builder.buildShortDynamicLink().addOnSuccessListener(shortDynamicLink -> {
sendIntent.putExtra(Intent.EXTRA_TEXT, shortDynamicLink.getShortLink().toString());
Intent shareIntent = Intent.createChooser(sendIntent, null);
startActivity(shareIntent);
}).addOnFailureListener(e -> {
});
If anyone encountered it \ has an idea how I might fix it I would greatly appreciate the help. Could this be related to the fact the app isn't yet on Google appstore?

How to add an option to share to Instagram Stories?

Background
In my Android App, users can share generated images to other apps. It's working nicely using the ACTION_SEND Intent.
Many users have asked why they can't share to Instagram stories directly.
Initially I thought Instagram doesn't support receiving Intents for stories (correct to some extent). I searched for it today, and according to this documentation, to share to Instagram Stories, a separate intent com.instagram.share.ADD_TO_STORY has to be used. I tried it, and it works fine.
The problem:
How do I keep both the options available?
I thought about it a lot, and came up with the following options:
1) Have two separate buttons. It will work, but it will look/feel bad.
2) Have my app accept ACTION_SEND intent, name it as Share to Instagram Story, and redirect the intent to the com.instagram.share.ADD_TO_STORY intent. In principle, make a proxy intent.
It will work, and look/feel great, but I don't know if its allowed (legal, etc) and can I disable the intent if the user doesn't have Instagram installed.
3) Add the 'com.instagram.share.ADD_TO_STORY' to the app chooser launched by ACTION_SEND. This would be ideal, but I don't know how to do it.
If you want to add multiple actions to Intent and create a chooser look at this example:
Intent viewIntent = new Intent(Intent.ACTION_VIEW);
Intent editIntent = new Intent(Intent.ACTION_EDIT);
viewIntent.setDataAndType(uri, type);
editIntent.setDataAndType(uri, type);
Intent chooserIntent = Intent.createChooser(editIntent, "Open in...");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { viewIntent });
startActivity(chooserIntent);
UPDATE: Here is good solution to your answer. How to make an intent with multiple actions
I tried the same approach as on Facebook's official documentation then tested on Huawai P9 Lite, Huawai P20 Lite and on Samsung S8 - it only worked on Samsung S8 for not known reason (to me). I gave up on it since, obviously, it's not working on most of the phones.
// Define image asset URI
Uri stickerAssetUri = Uri.parse("your-image-asset-uri-goes-here");
String sourceApplication = "com.my.app";
// Instantiate implicit intent with ADD_TO_STORY action,
// sticker asset, and background colors
Intent intent = new Intent("com.instagram.share.ADD_TO_STORY");
intent.putExtra("source_application", sourceApplication);
intent.setType(MEDIA_TYPE_JPEG);
intent.putExtra("interactive_asset_uri", stickerAssetUri);
intent.putExtra("top_background_color", "#33FF33");
intent.putExtra("bottom_background_color", "#FF00FF");
// Instantiate activity and verify it will resolve implicit intent
Activity activity = getActivity();
activity.grantUriPermission("com.instagram.android", stickerAssetUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (activity.getPackageManager().resolveActivity(intent, 0) != null) { activity.startActivityForResult(intent, 0);}

Android : Drive app and Intent.ACTION_GET_CONTENT

I would like to import files from Installed Google Drive App to my app using the Intent.ACTION_GET_CONTENT
and the mimetype of the intent set to "*/*".
I am able to do this with other installed app like Dropbox,Onedrive and box, but not with Google Drive.
Here is my code :
Intent action = new Intent(Intent.ACTION_GET_CONTENT);
action.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(action, "Upload file from..."),Constants.FILE_CHOOSER_REQUEST_CODE );
Thanks.
Very late answer but you need to remove action.putExtra(Intent.EXTRA_LOCAL_ONLY, true); in order to see Google Drive option in the picker.

open specific post, photos album or video from android app

hey every one I wonder how can I open specific post, album or video from android app in facebook app, I used this code to open specific post but it doesn't work
mActivity.getPackageManager().getPackageInfo("com.facebook.katana", 0);
String uri = "fb://post/" + mData.get(position).getmPostID();
Intent viewIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri));
I want to open this post
https://www.facebook.com/Y.Anti.coup.D/posts/707105232705409
Sorry for my bad English and I hope that you understand my problem

Android how to play video using VLC Player?

I have app for play video in android like as
https://play.google.com/store/apps/details?id=com.vlcforandroid.vlcdirectprofree&hl=en
I want to integrate this app in my app. I have Url for video Streaming and i want to open this video in this app(Vlc Direct), Any idea?
I open this app using:
Intent i = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("com.vlcdirect.vlcdirect");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
But how it start with video streaming, Or any other Player for video Streaming?
More like,
Intent i = new Intent(Intent.ACTION_MAIN);
i.setComponent(new ComponentName("com.vlcdirect.vlcdirect", "com.vlcdirect.vlcdirect.URLStreamerActivity"));
i.putExtra("url", url);
startActivity(i);
Which supposes that the component, activity, and payload are as shown, and also that the activity is explicitly or implicitly exported -- I don't know the actual values, or if the activity is exported. vlcdirect doesn't document this, but you can
ask the developer, or
view the log as you stream from a URL within that app, to identify the component and activity; dedex and decompile the .apk, to confirm the payload; duplicate payload classes, if necessary; give up and fume after the developer ignores you, if the activity is not exported.
Ideally you would broadcast a "view the stream from this URL" intent, and vlcdirect or any other suitable app would pick it up, but I don't know if vlcdirect or any other app respond to such.
VLC needs to be explicitly told the type:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setPackage("org.videolan.vlc.betav7neon");
i.setDataAndType(Uri.parse("http://ip:8080"), "video/h264");
startActivity(i);
i.e. just "video/*" wouldn't work for me
Previous answers didn't work me. After a bit of searching I found the official docs here.
Basically, here it is:
int vlcRequestCode = 42; //request code used when finished playing, not necessary if you only use startActivity(vlcIntent)
Uri uri = Uri.parse("file:///storage/emulated/0/Movies/KUNG FURY Official Movie.mp4"); //your file URI
Intent vlcIntent = new Intent(Intent.ACTION_VIEW);
vlcIntent.setPackage("org.videolan.vlc");
vlcIntent.setDataAndTypeAndNormalize(uri, "video/*");
vlcIntent.putExtra("title", "Kung Fury");
vlcIntent.putExtra("from_start", false);
vlcIntent.putExtra("subtitles_location", "/sdcard/Movies/Fifty-Fifty.srt"); //subtitles file
startActivityForResult(vlcIntent, vlcRequestCode);
You can remove unnecessary parts for you.

Categories

Resources