Android: Firebase Dynamic Links open browser first before opening app - android

I'm having an issue with Firebase Deep Links on Android.
I have 3 Firebase dynamic links, which are for 3 build flavors of one app, they are like this:
https://my_subdomain.page.link?link=https://my_subdomain.page.link/**app1**?param1=aaa&param2=bbb&apn=**app1_package_name**
https://my_subdomain.page.link?link=https://my_subdomain.page.link/**app2**?param1=aaa&param2=bbb&apn=**app2_package_name**
https://my_subdomain.page.link?link=https://my_subdomain.page.link/**app3**?param1=aaa&param2=bbb&apn=**app3_package_name**
Now what I want when I click on those links is: my corresponding apps
will open directly.
But the actual result is: the links redirect me to the browser first,
then after about 1 second, open the app.
Does anybody know what I'm doing wrong? Please help me.

I've found the answer myself.
Create 3 different URL prefixes on Firebase: subdomain1.page.link, subdomain2.page.link, subdomain3.page.link.
Declare a new intent filter in AndroidManifest, which looks like this:
Also remember to declare a variable named "app_subdomain" with respective values (subdomain1, subdomain2, subdomain3) for each app in build.gradle. For example:
manifestPlaceholders["app_subdomain"] = "subdomain1"
Type yourself these 3 links and use the parameters the way you like:
https://subdomain1.page.link?link=https://my_subdomain.page.link?param1=aaa&param2=bbb&apn=app1_package_name
https://subdomain2.page.link?link=https://my_subdomain.page.link?param1=aaa&param2=bbb&apn=app2_package_name
https://subdomain3.page.link?link=https://my_subdomain.page.link/?param1=aaa&param2=bbb&apn=app3_package_name
That should do it!

Related

how to extract parameter value from firebase dynamic link email directly in android activity

I have searched SO a lot but could not find a similar type question. My requirement is simple. I need to get parameter values from Email from my mailbox.My Email look like follows:
https://ejr3J.app.goo.gl/Rerjk?userId=qE721dmnre2dfmd_fdare55EnDB&session=ZwlkEL54_danbreMEdneENfdfm
When i click on this link it opens the desired activity (deep-linked activity) and getting also the deep link url (www.example.com) but cannot retrieve the parameters values (values of userId and session). I've tried to get the value using deeplinkUri.getQueryParameter("userId"), but it returns null value. Please help to accomplish this task. Any help will be appreciated.
I think you wrong in create dynamic link step.
Instead of add parameter to shortlink after it is generated, you must attach parameter in the link url (www.example.com). Like this: www.example.com?userId=qE721dmnre2dfmd_fdare55EnDB&session=ZwlkEL54_danbreMEdneENfdfm; After that, you generate dynamic link.

How to know if an activity is opened from a link in android and fetch the GET parameter from the link?

I have both website and android application for the website.when user clicks on a link of my website it opens that up in my android application. But the problem is there is an important information present in the link which i need to fetch and the activity will make a server request upon that. To be precised the link looks like this: www.example.com/post.php?id=123 I need to get the ID part of the link when the activity is opened so that I can show information about posts bearing the ID. I have added the opening of the link in my app with help of intent filter but I am stuck at getting the GET parameter of the link.How to do that?
Once your activity is opened via the link, you can retrieve that URL from the intent like so:
String url = getIntent().getData().toString();
Then you can use .substring to get the parameters:
String id = url.substring(url.indexOf("id=") + 3)
OR, you can use Airbnb's library to achieve the result in a more elegant way, you can learn about it on their GitHub repo.
myLink = string.substring(string.lastIndexOf('=') + 1);
If the string/url was www.example.com/post.php?id=123 the string will now return 123.

get List of all activites listed in google fit

I need to get list of all activities listed in google fit just like google fit app .so that user can select a particular activity to insert them into the health kit . Is there any intent builder for achieving this . I read the FitnessActivites class Descripition and Fitness Doc too but did't get the solution .. Can anyone help me out .. i'm stuck here
You can actually get it form AndroidManifest file. Even if its compiled.
Therer is list copied from it (used Notepad++):
com.google.android.apps.fitness.FitnessActivity
com.google.android.apps.fitness.preferences.settings.SettingsActivity
com.google.android.apps.fitness.preferences.DebugSettingsActivity
com.google.android.apps.fitness.location.MapActivity
android.support.PARENT_ACTIVITY
com.google.android.apps.fitness.preferences.settings.SettingsEditor
com.google.android.apps.fitness.preferences.settings.activityeditor.ActivityEdior
com.google.android.apps.fitness.preferences.settings.BleDevicesActivity
com.google.android.apps.fitness.preferences.settings.BlePairingActivity

What does this expression mean : "R.string.gcm_registered"?

I am trying to enable push notifications on my application.
I have the client sample code and now i am trying to get some of the code to implement it on my application. For those of you who have already implemented push notifications on your apps i am sure you are familiar with the class GCMIntentService.
So i am copying this class on my project , i configure the Manifest correctly(or i think i do) but i get errors in the file.
The errors are in expressions like R.string."something"
For example I get errors in :
R.string.gcm_registered
R.string.gcm_message
R.string.gcm_deleted
R.string.gcm_error
R.string.gcm_recoverable_error
R.drawable.ic_stat_gcm
The error is always that gcm cannot be resolved or is not a field.
But what exactly is this expression?! Is it a class or something?
Is it something on the Manifest that I haven't configured correctly?
It are strings, probably in the example app you're using, in /res/values/strings.xml
You put strings in there to have a localized place to put your user visible Strings in, so you have
1. One place to find all your strings, if you ever want to change and/or re-use
2. Easy access to translation by putting translations in per example /res/values-de/strings.xml
Look for that file in whatever example you're using, you'll find some XML defined strings. Copy them into your own project, in the same place.
this may helps you ,define all Reuired String in your strings.xml and save
R.string.gcm_registered
R.string.gcm_message
R.string.gcm_deleted
R.string.gcm_error

add item to the settings in android framework

i am working in android frameworks.i want to add an item to the existing settings in the android OS.can u plz tell me how to do this?
First read about PreferenceActivity. These group of classes handle user prefs.
Then depending on your task, do something like this.
In case you want to add a live wallpaper or an input method add android:settingsActivity in your Manifest. (Example : here)
Or follow this tutorial

Categories

Resources