URL scheme to open app using link in browser crashes

EmyMa341EmyMa341 ✭✭USMember ✭✭
edited January 2016 in Xamarin.Android

Hello friends,

I want to launch my application using link, I followed URL scheme tutorials which succesfully prompt me to open application but unforunately whenever I open its crashed even without entering into entry activity.

Here is my XML manifest file
This is my intent filtet to make app open from URL

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="1" package="com.planopunkt.myplano" android:versionName="1.0">
    <application android:icon="@drawable/Icon" android:label="myplano">
        <activity android:icon="@drawable/Icon" android:label="myplano" android:name="com.planopunkt.myplano.android.MainActivity">
            <intent-filter>
                <data android:scheme="http" android:host="planoandroid" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:pathPattern=".*" />
            </intent-filter>
        </activity>
        <receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.planopunkt.myplano" />
            </intent-filter>
        </receiver>
    </application>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.planopunkt.myplano.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <permission android:name="com.planopunkt.myplano.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" />
</manifest>

This is what I can see and whenever I launch app using link and tap over just once or always and its crashed, sometimes I see black screen and sometimes crash message "application has stopped working". I have no point to debug, I tried putting breakpoint in entry activity which is MainActivity.

In this line
<activity android:icon="@drawable/Icon" android:label="myplano" android:name="com.planopunkt.myplano.android.MainActivity">
I think while openning link there is something wrong with accessing this entry activity, may be I have mentioned wrong here.

My namespace is "myplano.android"
BI is "com.planopunkt.myplano"
Entry Activity is "MainActivity"

UPDATE
If I specific my entry activity like this, build says success and deployed to android player but it never enters in debugging mode, If I mentioned a different activity it enters into debugging, is this has something to do with root? as this MainActivity is the root activity.

<activity android:icon="@drawable/Icon" android:label="myplano" android:name="myplano.android.MainActivity">

Now my app is opening using link actually it was not entering into debugging so I thought its not deployed but actually it was deployed, Now I have to resolve why its not entering into debugging mode, anyone having the same situation ?

PS : anyone having same problem use namespace.avtivityname. in androidname to mention entry controller

This is my stacktrace

 0x25 in System.Diagnostics.Debugger.Mono_UnhandledException_internal    C#
0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/data/lanes/2512/d3008455/source/mono/mcs/class/corlib/System.Diagnostics/Debugger.cs:122,4 C#
0x6 in Android.Runtime.UncaughtExceptionHandler.UncaughtException at /Users/builder/data/lanes/2512/d3008455/source/monodroid/src/Mono.Android/src/Runtime/UncaughtExceptionHandler.cs:35,4 C#
0x1C in Java.Lang.Thread.IUncaughtExceptionHandlerInvoker.n_UncaughtException_Ljava_lang_Thread_Ljava_lang_Throwable_ at /Users/builder/data/lanes/2512/d3008455/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Java.Lang.Thread.cs:221,5 C#
0x1D in object.64cdfcea-a815-480c-aedd-892ceada8c2f C#

I already wasted 2 days on this, please help me out save my another day. Thanks

Posts

  • FlippyFlippy ✭✭ USMember ✭✭

    Did you ever get this issue resolved? I'm having the same problem.

  • EmyMa341EmyMa341 ✭✭ USMember ✭✭
    edited August 2016

    Yes in android name activity name and namespace was mentioned in a wrong way. You should write like this
    android:name="yournamespace.activityname". And make sure write name space if same activity which you are opening. Also make sure package is correct. Because when deep linking program tries to find activity in this manner "PackageName.Namespace.ActivityName".

    <activity android:name="Namespace.ActivityName" android:label="Blabla" android:theme="@style/CustomActionBarTheme">
                    <intent-filter>
                        <data android:scheme="http" android:host="blabla" />
                        <action android:name="android.intent.action.VIEW" />
                        <category android:name="android.intent.category.DEFAULT" />
                        <category android:name="android.intent.category.BROWSABLE" />
                    </intent-filter>
                </activity>
    
  • SreeeeSreeee ✭✭✭✭✭ INMember ✭✭✭✭✭

    @EmyMa341 said:
    Yes in android name activity name and namespace was mentioned in a wrong way. You should write like this
    android:name="yournamespace.activityname". And make sure write name space if same activity which you are opening. Also make sure package is correct. Because when deep linking program tries to find activity in this manner "PackageName.Namespace.ActivityName".








    I also have the same requirement, need to open my app when tapping a url and need to read a value from that url.
    My code inside application tag in manifest file:

        <activity android:name="com.companyname.appname.MainActivity" android:label="appname">
                <intent-filter>
                    <data android:scheme="https" android:host="appname" />
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <category android:name="android.intent.category.BROWSABLE" />
                </intent-filter>
            </activity>
    

    Also, give nohistory=true in mainactivity. Can you help me to complete this feature?
    Thanks in advance :)

  • SreeeeSreeee ✭✭✭✭✭ INMember ✭✭✭✭✭

    @EmyMa341 said:
    Yes in android name activity name and namespace was mentioned in a wrong way. You should write like this
    android:name="yournamespace.activityname". And make sure write name space if same activity which you are opening. Also make sure package is correct. Because when deep linking program tries to find activity in this manner "PackageName.Namespace.ActivityName".








    I add all the things in manifest and it is correct to my knowledge.

    I don't know the way of testing that I follow is correct or not. Currently, I am testing this feature by tapping a demo url from my phone. But always open google chrome when tapping the demo url. Is it a correct way?

  • SreeeeSreeee ✭✭✭✭✭ INMember ✭✭✭✭✭

    Please go to the following blogs for implementing deeplinking :)
    https://blog.falafel.com/xamarin-android-launch-app-browser/
    https://riccardo-moschetti.org/2014/10/03/opening-a-mobile-app-from-a-link-the-xamarin-way-url-schemas/

    This blogs will help others who are going to implement deeplinking.

  • umpashaumpasha ✭✭ Member ✭✭

    what to do for IOS?

Sign In or Register to comment.