App linking not working. How to open app from web browser? - android

I've followed the steps in the android documentation Here to implement linking in my application. I dont really need any fancy parameter passing, all I want is when the user clicks a link on the browser that my app opens. All I did was modify my AndroidManifest. Here is the relevant part
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="u2player" android:host="open.my.app" />
</intent-filter>
</activity>
I am using react-native-navigation and trying to browse from either the chrome browser or the native browser to any of u2player:// u2player://open.my.app u2player://open.my.app/ doesn't work. I have also binded the url event from the Linking module but nothing works. I restarted, uninstalled, etc.
Help appreciated

Try using branch. It solves most of the problem that you are facing and it also has a very clean documentation. Please go through and let me know if you have any issues

Related

How to make the app as launcher and the only open app in Android?

Is there a way to make my app the only running app in a device, what I mean is the only visible and open app? Once the device booted, the app will launch automatically while any tap to settings at status bar, back, home and recent apps button are disabled. Probably a custom Android OS is required or rooting the device will be enough? We plan to have a set of devices where users can only operate with one app. Thanks
You need to be able to remove current launcher app to the system part of the device.
Then it's as simple as:
Adding android:launchMode="singleTask" to activity tag in AndroidManifest.xml
Adding <category android:name="android.intent.category.DEFAULT" /> and
<category android:name="android.intent.category.HOME" /> to your intent filter
The end result should look similar to this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.app.MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>

Setting my app as a sharing target (Xamarin)

I'm looking for a way to enable my users to send images to my app via sharing (On android).
My main goal right now is to get my app on the "share to" tab when pressing the share button in the gallery, and storing the shared picture(or a link to the picture).
To have your project in share list you need to manipulate your menifest file
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MyActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
</application>
& for more information on this you can visit this & this
In those links you might get things in more precise way.
Good luck.
I faced the same problem
After some effort, I found this solution
Remove this from the manifest file
<activity android:name=".MyActivity" >
.....
</activity>
And replace it with this code in the activity you want to run directly
[IntentFilter(new[] { "android.intent.action.SEND" }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "text/plain" })]
my best wishes
I have found my answer using a android studio instead of xamarin, as it was giving me a lot of problems.
If you have the same problem yourself, you should follow Arvindraja answer, please do not that his answer will only make your app appear in the share menu but the data you will share to it will not be saved anywhere, for that you will need additional code.

Why is my main activity being called every time my app is opened, even if not fully closed?

Every time I open my app, I am being routed through my main activity, rather than returning to the last activity that was previously opened. This only started occurring once I started using branch.io for deep-linking functionality. Why might this be happening? I assume that it has something to do with my manifest.. I'll post a snippet:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:name="roof.android.Application"
android:theme="#style/AppThemeNoAnimation"
android:largeHeap="true"
>
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_bpzpbF3KFoq5TlSQFp0TdnaauEf6iBuU" />
<activity
android:name="roof.android.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="https://roof.app.link/RwKeFhqi5v" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
There are several activities which follow this, but I suppose it is not necessary to post them.
Alex from Branch.io here: looks like you have a mistake when defining your URI scheme:
<data android:scheme="https://roof.app.link/RwKeFhqi5v" android:host="open" />
should look more like
<data android:scheme="myscheme" android:host="open" />
(more about this step in our docs here).
You definitely will need to fix that, but I'm not sure if it would be causing the issue you are seeing. Give it a try and if you're still having trouble, I'd suggest submitting a ticket to our Integrations team so they can take a closer look at the code.

App icon not visible when code is run

I have created an android app using android studio. When i run my code on the IDE, its runs as expected on the connected phone. The problem is, it does not leave behind an icon on my phone to use it next time. I will again have to run from android studio to use the app. This was fine initially, i don't realize what made the icon vanish. The app is also present in the settings.
When i go to
Settings->apps
i can very well find my app over there. It is not disabled. I tried uninstalling the app and trying again. It still doesn't give me the icon.
I cleared defaults, forced closed and tried everything possible. Nothing is helping me.
Please help.
My AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".TwitterLogin"
android:label="#string/title_activity_twitter_login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".NextActivity"
android:label="#string/title_activity_next" >
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="b1fe9f0c7d80c3c24879d634b199f2d0e474b4ba" />
<activity
android:name=".WebViewActivity"
android:label="#string/title_activity_web_view" >
</activity>
</application>
</manifest>
You should specify a different for every intent that can launch your app. So one for the BROWSER category with your url data, and one for the LAUNCHER category.
From the App Manifest Guide.
Components advertise their capabilities — the kinds of intents they can respond to — through intent filters. Since the Android system must learn which intents a component can handle before it launches the component, intent filters are specified in the manifest as elements. A component may have any number of filters, each one describing a different capability.
Your code would become something like:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
</intent-filter>

Titanium Android activity not maintaining state

I am trying to set up a mobile website that opens my mobile app when a link is clicked in the Android browser. To accomplish this task, I added an intent filter to AndroidManifest.xml, as seen in the code below:
<activity android:name=".MyAppActivity" android:label="#string/app_name" android:theme="#style/Theme.Titanium" android:configChanges="keyboardHidden|orientation" android:alwaysRetainTaskState="true" android:launchMode="singleInstance">
<intent-filter>
<data android:scheme="myapp" android:host="app"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
The link itself in the browser works great, and I'm easily able to gather parameters when the app is first opened using Ti.Android.currentActivity. The problem comes when the app is already open, but a user clicks the link to open it from within the mobile browser. When my app opens, instead of resuming where I left off before, I simply see the splashscreen. This goes both ways: If I opened the app first from the mobile browser, then tried to resume it later from the Android homescreen or app drawer, I only see the splash screen. Per tips I saw on other places of the internet, I tried adding the code below to AndroidManifest.xml (as seen above):
android:alwaysRetainTaskState="true" android:launchMode="singleInstance"
This however, appears to have no effect on anything, and the same problem persists. What am I missing here? Any help would be greatly appreciated.
The way i have done was like this
<android xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>
<manifest android:installLocation="preferExternal"
android:versionCode="1" android:versionName="1.0">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application android:label="App Name" android:largeHeap="true">
<activity
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:launchMode="singleTop"
android:name=".mainActivity" android:theme="#style/Theme.Titanium">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="schemaname"/>
</intent-filter>
</activity>
</application>
</manifest>
</android>
and its working fine for me . for Android 4.XX

Categories

Resources