I am using below piece of code for getting target_url to my App.. every thing works fine but I want to pass json data from the target site to my app.. I have refered to Applinks.org documentation but there is no precise documentation on what i want.
<head>
<meta property="al:android:url" content="example://applinks" />
<meta property="al:android:package" content="com.example" />
<meta property="al:android:app_name" content="Example App" />
<!-- Other headers -->
</head>
On using below piece of code in my SplashActivity it throws NullPointer exception on bundle.getString("al_applink_data")..Am i refering to wrong bundle or my key/pair is wrong ???
Bundle bundle=AppLinks.getAppLinkData(getIntent());
Log.d("json i want",""+targetUrl+bundle.getString("al_applink_data"));
Please help!!!!
The Bundle
that is returned by the AppLinks.getAppLinkData(Intent)
call already contains the contents of the "al_applink_data"
data.
Hence, you don't need to fetch the data under the "al_applink_data"
key by calling .getString("al_applink_data")
on that bundle. Instead, you can directly fetch the information that is nested inside the "al_applink_data"
section of the data.
For a complete example, check out the AppLinks/Bolts docs page on github:
Bundle applinkData = AppLinks.getAppLinkData(getIntent());
String id = applinkData.getString("id");