Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice to hide URL scheme from end users

I want to send text messages in the app that are links to open other views inside the same app. Like a notification text message which has links to other views in app. So the best way to go about this is to insert the URL scheme myAppName://someQuery?blablabla=123 and that should in turn fire the openURL command and open that specific view.

What is the best practice to hide the url scheme from the end user. It looks ugly and also don't want to create the possibility where end user can pass in values to the url scheme.

My options:

  1. Use a weblink, open safari, and then come back to the app. This takes time.
  2. Use html tags <a href=myAppName://someQuery?blablabla=123">Test</a>, but this takes a hit on performance as I need to keep assigning attributed text to the textView, and that is super slow, and buggy.

So far, the best option I have it 2. Just wondering if there are other good ideas out there...

Thanks for the help

like image 936
Legolas Avatar asked May 07 '16 01:05

Legolas


People also ask

What are custom URL schemes?

Custom URL schemes provide a way to reference resources inside your app. Users tapping a custom URL in an email, for example, launch your app in a specified context. Other apps can also trigger your app to launch with specific context data; for example, a photo library app might display a specified image.

What is iOS URI scheme?

The URL scheme is an interesting feature provided by the iOS SDK that allows developers to launch system apps and third-party apps through URLs. For example, let's say your app displays a phone number, and you want to make a call whenever a user taps that number.

How do I find the URL scheme of an app?

Go to the Play store, find the app and view its page. Copy the URL from the browser address bar. Make a note of this as the "Android Fallback URL." You'll see a parameter called "id" followed by an equal sign (=).


1 Answers

You can encrypt your parameters string and then send it as a message

Encrypted URL form:

myAppName://encrypted_query

Now when you get a call in your app, you should fetch the encryptedt_data out of the URL and should decrypt it before actually doing anything.

Decrypted URL form:

myAppName://someQuery?blablabla=123

In my believe this is the best and easiest way to get this done. For encryption/decryption best practice check this, AES Encryption for an NSString on the iPhone and this.

As long as you're not concern about the security, you can always use reduced size of encryption string to make a URL smaller. That option is given in Github library.

like image 86
Hemang Avatar answered Sep 28 '22 12:09

Hemang