Android: Add Custome URL Scheme for Launching Nextcloud App from Another apps

Created on 12 Aug 2020  路  9Comments  路  Source: nextcloud/android

Is your feature request related to a problem? Please describe.

It is trying to call the Nextcloud application directly from another application, but it cannot call it directly like nextcloud://, because the URL custom scheme is not set. It's only set up for http and https.

Describe the solution you'd like

https://github.com/nextcloud/android/blob/master/src/main/AndroidManifest.xml
How about adding an intent-filter to Manifest.xml above so that it can be called with nextcloud:// ?

I think that the Nextcloud application should only be launched and there is no need to open the Nextcloud application with Deep link.

enhancement

Most helpful comment

Android is using the nc:// only and yes, like @rullzer mentioned we use it for logins. via QR codes and also directly. Android allows to specifiy URLs the application can process. The Android client defined 2 URLs schemas it can process:

  • nc://* for logins
  • http(s)://**f** like for file deep links

So we do not support any other url schemas linked to any kind of action or to open the app. While opening the app should be possible just by launching the right intent.

So yes we should settle on a common one. And then use that.

Sounds good 馃憤
I'd vote for nc:// since the the Android client and the server use it

All 9 comments

The Nextcloud iOS app seems to be set up so that the app is launched with nextcloud://.

ios/iOSClient.plist at bf632c8afa3396d9df1555c71cfb2bcb2859356c 路 nextcloud/ios
https://github.com/nextcloud/ios/blob/bf632c8afa3396d9df1555c71cfb2bcb2859356c/iOSClient/Brand/iOSClient.plist#L61

atm we only have https://github.com/nextcloud/android/blob/master/src/main/res/values/setup.xml#L107 which is nc:// which triggers the log-in screen.

cc @tobiasKaminsky @jancborchardt @marinofaggiana @nextcloud/ios @nextcloud/server-triage

We should decide on a common protocol name ios=nextcloud:// and android=nc:// while I can't say what iOS is using it for (seem for simply launching the app) while we use it for login-URLs (with credentials).

while we use it for login-URLs (with credentials).

That's also the case in iOS.

Nice to know while it seems the clients use different protocol names (nextcloud Vs. nc) for this?

Nice to know while it seems the clients use different protocol names (nextcloud Vs. nc) for this?

The default one on server side is nc://, but an OAuth2 client can specify it's own redirect URL and I guess Android does this?!? 馃

https://github.com/nextcloud/server/blob/543fabe27919df81e79a16644fe4eedf9eceb07c/core/Controller/ClientFlowLoginController.php#L360

Maybe @rullzer knows a bit more here.

The nc:// is used in the login flow for clients. So both android and ios us that as far as I know. However this is not a general thing. It is just the webview that is registering that nc:// link.

What android is using it for is to scan QR codes etc I think. Or have links you can press.

So yes we should settle on a common one. And then use that.

Android is using the nc:// only and yes, like @rullzer mentioned we use it for logins. via QR codes and also directly. Android allows to specifiy URLs the application can process. The Android client defined 2 URLs schemas it can process:

  • nc://* for logins
  • http(s)://**f** like for file deep links

So we do not support any other url schemas linked to any kind of action or to open the app. While opening the app should be possible just by launching the right intent.

So yes we should settle on a common one. And then use that.

Sounds good 馃憤
I'd vote for nc:// since the the Android client and the server use it

@ynott why don't you jsut use something like:

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.id");
if (launchIntent != null) { 
    startActivity(launchIntent);//null pointer check in case package name was not found
}

I am not sure about the package value but you can give "com.nextcloud.client" and "com.owncloud.android" a try

@AndyScherzinger
Thank you for all the details and the kind advice.

I didn't know how to launch it using the com.nextcloud.client package ID.
I think this is a very smart way to do it. I should have looked into it more.
I will try this approach.

BTW, Being able to launch client apps on both Android and iOS with nc:// would be a great thing, and I agree with you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ezaquarii picture ezaquarii  路  3Comments

ikke-t picture ikke-t  路  3Comments

JSoko picture JSoko  路  3Comments

Shagequi picture Shagequi  路  3Comments

tobiasKaminsky picture tobiasKaminsky  路  3Comments