mgks / Android-SmartWebView

A simple use webview integrated w/ native features to help create most advanced hybrid applications.
https://mgks.dev/smart-webview
MIT License
564 stars 278 forks source link

Shared link of my website on whastapp are not opening in smart webview #86

Open RahimSayyed opened 5 years ago

RahimSayyed commented 5 years ago

I want to open shared link or url of my website in smart webview app. Intent popup when clicked on link but after selecting Smart webview app nothing happens further. Please help and sorry for my bad english.

mgks commented 5 years ago

I'm going to assume that you've already added your intended web address in manifest data filter > host.

If the screen goes white, it probably means there is some port or file request issue, like mixture of HTTP and HTTPS requests. If not that, can you look into logs for more details of the issue.

ATSGIT commented 5 years ago

I have the same issue with WhatsApp and Telegram. When I click on my app urls in there applications, nothing happens. Here is my setting: ` <activity android:name="com.site.my.MainActivity" android:screenOrientation="portrait" >

` The only link that application can handle from WhatsApp is "https://my.site.com/". When I click on other URLs such as "https://my.site.com/blah" nothing happens. Note that it tested the problematic URLs with my Samsung SMS app but have no problem. My android is Pie.
mgks commented 5 years ago

Does it opens links inside apps internal browser (chrome tab) or force opens your default browser.

ATSGIT commented 5 years ago

It always tries to open such links (my.site.com) with my app. One hint, in first click on url, it seems that it tries to launch MainActivity but maybe the activity crashes and fails to load.

mgks commented 5 years ago

@ATSGIT do you record any logs? I'd need to look into it.

ATSGIT commented 5 years ago

No, I have no log. I think the problem may relates to how the activity handles the recieved intent.

On Tue, 27 Aug 2019, 12:35 Ghazi Khan, notifications@github.com wrote:

@ATSGIT https://github.com/ATSGIT do you record any logs? I'd need to look into it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mgks/Android-SmartWebView/issues/86?email_source=notifications&email_token=AC7EYOPZIICLJUHIRL77XETQGTN55A5CNFSM4HEF5MC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5G4DUI#issuecomment-525189585, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7EYOJ6VQDLG5SRBE5RAFDQGTN55ANCNFSM4HEF5MCQ .

mgks commented 5 years ago

I don't know what or how to look into this, unless I have some log data. I'm not having problem on my end for the same.

Can you share the log next time you use android studio?

ATSGIT commented 5 years ago

intent filter in my app:
` <activity android:name="com.xmpl.my.MainActivity" android:screenOrientation="portrait" >

    </activity>`

Logcat log on Android 7 when clicking on a link: 08-28 17:41:43.490 1590-1924/system_process I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://my.website.com/dashboard cmp=android/com.android.internal.app.ResolverActivity (has extras)} from uid 10009 on display 0

--------- beginning of main

08-28 17:41:43.490 1590-1664/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client 08-28 17:41:43.505 3059-3059/system:ui D/ResolverActivity: sinceTime=1565788303505 08-28 17:41:43.510 2446-2941/com.android.mms D/Mms: cancelNotification 08-28 17:41:43.515 2446-3137/com.android.mms D/Mms: cancelNotification 08-28 17:41:43.522 2446-2446/com.android.mms D/Mms: cancelNotification 08-28 17:41:43.536 1205-1264/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 7753728 08-28 17:41:43.668 2446-2446/com.android.mms W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection 08-28 17:41:43.669 1205-2127/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 7753728 08-28 17:41:43.702 1590-1620/system_process I/ActivityManager: Displayed android/com.android.internal.app.ResolverActivity: +200ms (total +60s754ms) 08-28 17:41:44.733 1205-1267/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 7753728 08-28 17:41:46.462 1590-1664/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client 08-28 17:41:46.464 1590-1611/system_process I/PackageManager: Setting last chosen activity com.xmpl.my/.MainActivity for user 0: 08-28 17:41:46.464 1590-1611/system_process I/PackageManager: Action: "android.intent.action.VIEW" 08-28 17:41:46.464 1590-1611/system_process I/PackageManager: Category: "android.intent.category.DEFAULT" 08-28 17:41:46.464 1590-1611/system_process I/PackageManager: Scheme: "https" 08-28 17:41:46.464 1590-1611/system_process I/PackageManager: Authority: "my.website.com": -1 08-28 17:41:46.464 1590-1611/system_process I/PackageManager: Path: "PatternMatcher{PREFIX: /}" 08-28 17:41:46.468 1590-1924/system_process I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://my.website.com/dashboard flg=0x3000000 cmp=com.xmpl.my/.MainActivity (has extras)} from uid 10009 on display 0 08-28 17:41:46.971 1590-1615/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{9820d1d u0 android/com.android.internal.app.ResolverActivity t34 f} 08-28 17:41:46.975 2836-2836/com.xmpl.my V/FA: onActivityCreated 08-28 17:41:46.975 2836-2836/com.xmpl.my W/READ_PERM =: android.permission.READ_EXTERNAL_STORAGE 08-28 17:41:46.975 2836-2836/com.xmpl.my W/WRITE_PERM =: android.permission.WRITE_EXTERNAL_STORAGE 08-28 17:41:47.509 2446-2934/com.android.mms D/Mms: cancelNotification 08-28 17:41:47.512 2446-3140/com.android.mms D/Mms: cancelNotification 08-28 17:41:47.521 2446-2931/com.android.mms D/EGL_emulation: eglMakeCurrent: 0xa222b0a0: ver 2 0 08-28 17:41:47.528 3059-3059/system:ui I/Choreographer: Skipped 62 frames! The application may be doing too much work on its main thread. 08-28 17:41:47.569 1590-1931/system_process W/InputMethodManagerService: Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@26a3c5c3 (uid=10009 pid=2446) 08-28 17:41:47.671 2446-2931/com.android.mms D/EGL_emulation: eglMakeCurrent: 0xa222b0a0: ver 2 0 08-28 17:41:47.707 2446-2446/com.android.mms D/Mms: cancelNotification 08-28 17:41:48.014 2446-2942/com.android.mms D/Mms: cancelNotification 08-28 17:41:48.020 2446-3142/com.android.mms D/Mms: cancelNotification 08-28 17:41:48.023 2446-2446/com.android.mms D/Mms: cancelNotification

ATSGIT commented 5 years ago

I don't know what or how to look into this, unless I have some log data. I'm not having problem on my end for the same.

Can you share the log next time you use android studio?

I debugged the app and found that the problem related to the following logic in MainActivity:

        if (!isTaskRoot()) {
            finish();
            return;
        }

isTaskRoot() returns false for all external links except root url "https://www.example.com/". So when clicking on such links, the activity exits.

natsirasrafi commented 3 years ago

I Found Solution

Uri exturi = getIntent().getData(); if(exturi!=null){ String link = exturi.toString(); aswm_view(link, false); }else{ aswm_view(ASWV_URL, false); }