Android phonegap app: open link from browser into app - android

I'm building a phonegap app which will install on android.
I want to somehow allow sharing features on twitter, etc. So you could create a 'post' in the app and people can share it on twitter probably linking to a domain containing the post.
Is there any way in phonegap to allow this link from say twitter (in a browser), to open in the installed app version?
The installed app follows the same url combinations as the web version.

My tutorial: TMT5P1 lets the user log in to their twitter account from the app. Then they can tweet, see tweets, mentions, etc from the PhoneGap / Android app. Twitter actions are integrated into the app, instead of making the user leave the app to go to twitter website.
Requires child browser plugin for secure login.

Related

Prevent android deep link from redirecting to playstore if app doesn't exist

I am working on a website for a product which also has an android application. I want to redirect the user from mobile web browser to the android application when a particular task is performed. I use a deep link of the format as below -
intent://#Intent;package=<PACKAGE_NAME>;action=android.intent.action.VIEW;category=android.intent.category.BROWSABLE;scheme=https;end
The issue is that this link is redirecting user to playstore if app is not installed. I wanted user to stay on the web browser if app is not installed. How can we achieve that?
As of now, i tried replacing the intent with https to produce link of the format as below -
https://#Intent;package=<PACKAGE_NAME>;action=android.intent.action.VIEW;category=android.intent.category.BROWSABLE;scheme=https;end
But it only works if I add the supported links from the app info, which has to be done manually. I am not sure if the fix for this is to be done in android on is there a way to handle this from the website?

sso in android using microsoft azure sdk -ADAL

The code works properly from dev portal of microsoft. But can anyone please tell me how it should behave in following use case
Consider two apps: App1 and App2
I have developed same code and installed both apps simultaneously
App1 as launched first will ask me credentials for the webview. Thats fine. as I have not cache or already logged in till date.
Once I log in successfully, The apps works properly as auto login
Now when I open App2, it still throws me Login page. Ideally it should take cache of App1 and auto login.
Please note: I have provided same 'shared id' in both apps in manifest
Please let me know about thus as i am stuck with internal Single Sign on issue since long
I see you have tagged the question with ADAL, so I'll assume that's the library you're using. ADAL uses webviews to prompt for sign in. Webviews in Android do not share much state between apps, and are pretty much completely sandboxes (isolated and do not share session cookies, etc).
Now, you most definitely can achieve SSO for Android using ADAL, you have 2 options:
Brokered SSO
Using a broker application, like the Microsoft Authenticator, the end user basically signs in here such that they're able to maintain a session inside the Broker's sandbox. This allows any app that signs in Azure AD users to share state. The article linked above explains how to enable your app to use the broker.
Non-Brokered SSO
You can configure SSO between all of the apps you own. This means an end user will get SSO between App 1, App 2, App N, but not necessarily another App in the Azure AD ecosystem. The article linked above explains how to enable your app to use non-brokered SSO.
Bonus Option: v2 with MSAL
I said earlier ADAL uses webviews for sign in, there's another way to do it that the Microsoft Authentication Library (MSAL) supports using the system's browser. Quite simply, this uses the Chrome or a Chrome custom tab browser on the device rather than the in-app webview. Then, the session cookie is set on the global browser so any app that also uses the browser (or if the end user has used the browser natively to sign in) will get SSO. The stipulation here is MSAL works against the Azure AD v2.0 endpoint which has some limitations, but also supports some sign in with Microsoft Accounts (*.outlook, *.live, etc) out of the box.
If you're interested in trying v2 + MSAL, I recommend trying the Android Guided Walkthrough which walks you through how to build an app that calls the Microsoft Graph.

Branch link to open webpage if app not installed. Open app if app installed

I currently have branch io integration with my application.
When user presses on branch io link, currently, it will open my app if the user has the app installed. And it will open the app store if user doesn't have the app installed.
Now, after some time, I have implemented a web app that does partial functionality as the app itself. So if the user doesn't have the app installed, i would like them to navigate to my website (with the correct parameters)
How should I do that? Is it possible?
Amruta from Branch.io here:
If you wish to redirect users to your webpage when your App is not installed on the mobile device you should add $ios_url and $android_url parameters to your links and set the value to your web page URL (make sure to URI encode your web URL).
For Quick links on the Branch dashboard, you can set the iOS/Android redirect to a web URL.
You can read all the link parameters on your web page by integrating Branch's web SDK. To learn more about the functionality provided by the web SDK and the process of integration, check out the documentation here and also the Github repo for the SDK here.

Facebook manual login flow, open login dialog in app if installed

I'm trying to integrate Facebook Manual Login Flow in an android app. The correct url to open the facebook login dialog as given on the page is:
https://www.facebook.com/dialog/oauth?
client_id={app-id}
&redirect_uri={redirect-uri}
However, this url always opens in the browser even if the facebook app is installed. Would it be possible to open the native app oauth dialog if it is installed without using the sdk? Is there any specific url/intent to open it?
The reason I'm going with the manual flow is because I don't want to include the entire Facebook Sdk just for using oauth2 and also I prefer to open the login dialog in the browser(if the app is not installed) than the webview dialog that is presented using the sdk.
See point 7.2 of Facebook's Platform Policy: https://developers.facebook.com/policy/
"Native iOS and Android apps that implement Facebook Login must use our official SDKs for login."
If you're worried about app size, you can use proguard to strip out functionality that's not needed by your app. The SDK will also handle doing SSO through the native app, and gracefully falling back to a webview if the native app is not installed.

Like button and Phonegap app

I'm trying to integrate Facebook 'Like' button into my Phonegap app (iOS and Android).
The easiest way is to c&p the same code as for simple web site:
<iframe src="http://www.facebook.com/plugins/like.php?..."...>></iframe>
It works perfectly (just like for normal web site) if user already logged in.
But if I log out from FB and then try to tap "Like" button I will be redirected to the FB login page and bad thing is that this page will be opened in new native browser window. So, after login it will not redirect me back to the app.
And also, if there is a way to open login page inside my app I think there still will be a problem with redirecting back to my app from FB (i.e. redirect to the local .html file)...
So, is there ANY way for Phonegap app to integrate with FB 'Like' feature somehow?
I don't think this is possible yet. The PhoneGap Facebook Connect plugin has promise, but at the time of writing this it still has a few niggles that would stop me deploying it - it's only been released for a week or two and it seems to have broken so second and subsequent logins to an app won't work. It seems like it will be really useful soon, but it's more volatile than even the standard volatility level of most Facebook integrations as it stands. Getting it to build against PhoneGap 1.1.0 yesterday also involved digging through issues in github and patching the Facebook SDK... so you'll have fun with that.
As far as I can see it doesn't support dialogs or social plugins yet, though for the base Facebook Connect use case it does solve the problem where Facebook users can be redirected out of your PhoneGap app to login either in the FB app or Safari and then bounced back into your app afterwards. It sounds like the plugin authors are working on more features, so I'll be keeping an eye on the project.
It sounds like you need the PhoneGap Facebook Connect plugin:
https://github.com/davejohnson/phonegap-plugin-facebook-connect
From the README:
"The Facebook Connect plugin for PhoneGap allows you to use the same JavaScript code in your web application as you use in your native PhoneGap application, but your native PhoneGap application will use the Facebook native app to perform single sign on (SSO) for the user."

Categories

Resources