Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

I.3 Create Dynamic Links

Hadi Tavakoli edited this page Jun 16, 2019 · 3 revisions

Create Dynamic Links

There are four ways you can create Dynamic Links:

  1. Using the Firebase console. This is useful if you're creating one-off links to share on social media.
  2. Using the REST API. This is the preferred way to dynamically create links in your app for user-to-user sharing or in any situation that requires many links. You can track the performance of Dynamic Links created with the REST API in the Firebase console.
  3. Using the built-in link generater method in the ANE. There is a build method in the ANE which you can use to easily create dynamic links supported on iOS/Android with all the other optional parameters required for analytics or social media sharing.
  4. Manually. If you don't need to track click data in the Firebase console and you don't care if the links are long, you can manually construct Dynamic Links using URL parameters, and by doing so, avoid an extra network round trip.

Using the REST API

This is fully explained in Firebase docs. Read here for more information.

Manually constructing a URL

This is fully explained in Firebase docs. Read here for more information.

Using the ANE built-in deeplink generator

You can use this approach to easily build dynamic links on the fly inside your app.

  • Set your deeplink parameters for: Android/iOS/Social Media/Analytics or even create invitation IDs.
  • call the build method.
  • You can shorten your links using the toMakeShort method.

Before you can gerenare a dynamic link using the ANE, you need to set webApiKey. This information can be found inside your Firebase Console.

// init FirebaseCore first by passing true as an argument so the ANE can prepare itself for dynamic links
var isConfigFound:Boolean = Firebase.init(true);

if (isConfigFound)
{
	// Then set the WebApiKey
	Firebase.getConfig().webApiKey = "AIzbSyDvWwo5ATJ3pPl5YG1MHlQsikuodVzdehQ";
}

Now you're ready to call the build method.

// optional: set Android parameters
var androidParams:AndroidParams = new AndroidParams();
androidParams.apn = "air." + NativeApplication.nativeApplication.applicationID;
androidParams.amv = 3;
// other parameters...

// optional: set iOS parameters
var iosParams:IosParams = new IosParams();
iosParams.ibi = NativeApplication.nativeApplication.applicationID;
iosParams.isi = "1234567890";
// other parameters...

// optional: set Social Media parameters
var socialMediaParams:SocialMediaParams = new SocialMediaParams();
socialMediaParams.st = "my Social Media title";
socialMediaParams.sd = "my Social Media description";
// other parameters...
				
// add optional Analytics params: http://myflashlab.github.io/asdoc/com/myflashlab/air/extensions/firebase/dynamicLinks/AnalyticsParams.html
var analyticsParams:AnalyticsParams = new AnalyticsParams();
				
// add optional otherPlatform params: http://myflashlab.github.io/asdoc/com/myflashlab/air/extensions/firebase/dynamicLinks/OtherPlatformParams.html
var otherPlatformParams:OtherPlatformParams = new OtherPlatformParams();
				
// add optional navigation params: http://myflashlab.github.io/asdoc/com/myflashlab/air/extensions/firebase/dynamicLinks/NavigationParams.html
var navigationParams:NavigationParams = new NavigationParams();
				
// first create your URL Prefix from your Firebase Console: https://console.firebase.google.com/project/_/durablelinks/links/
var deepLink:String = DynamicLinks.build(
						"YOUR_URL_PREFIX.page.link",
						"https://www.your_domain.com/deeplinks",
						androidParams,
						iosParams,
						socialMediaParams,
						analyticsParams,
						otherPlatformParams,
						navigationParams,
						"MY_INVITATION_ID");
				
trace(deepLink);


// to make the link look nicer, you can make it short like this:
DynamicLinks.toMakeShort(deepLink, function ($link:String, $raw:String):void
{
	trace("$raw = " + $raw);

	if($link)
	{
		trace("$link = " + $link);
	}
});

Introduction to Firebase ANEs collection for Adobe Air apps


Get Started with Firebase Core in AIR

  1. Prerequisites
  2. Add Firebase to your app
  3. Add the Firebase SDK
  4. Init Firebase Core
  5. Available ANEs
  6. Managing Firebase iid

Get Started with Analytics

  1. Add Analytics ANE
  2. Init Analytics ANE
  3. Log Events
  4. Set User Properties

Get Started with Crashlytics

  1. Add Crashlytics ANE
  2. Test Your Implementation
  3. Customize Crash Reports
  4. Upload .dSYM for iOS apps

Get Started with DynamicLinks

  1. Add DynamicLinks ANE
  2. Init DynamicLinks ANE
  3. Create DynamicLinks
  4. Receive DynamicLinks
  5. View Analytics

Get Started with Authentication

  1. Add Authentication
  2. Init Authentication
  3. Manage Users
  4. Phone Number
  5. Custom Auth
  6. Anonymous Auth
  7. State in Email Actions
  8. Email Link Authentication

Get Started with FCM + OneSignal

  1. Add FCM ANE
  2. Init FCM ANE
  3. Send Your 1st Message
  4. Send Msg to Topics
  5. Understanding FCM Messages
  6. init OneSignal

Get Started with Firestore

  1. Add Firestore
  2. Init Firestore
  3. Add Data
  4. Transactions & Batches
  5. Delete Data
  6. Manage the Console
  7. Get Data
  8. Get Realtime Updates
  9. Simple and Compound
  10. Order and Limit Data
  11. Paginate Data
  12. Manage Indexes
  13. Secure Data
  14. Offline Data
  15. Where to Go From Here

Get Started with Realtime Database

  1. Add Realtime Database
  2. Init Realtime Database
  3. Structure Your Database
  4. Save Data
  5. Retrieve Data
  6. Enable Offline Capabilities

Get Started with Remote Config

  1. Parameters and Conditions
  2. Add Remote Config
  3. Init Remote Config

Get Started with Performance

  1. Add Performance ANE
  2. Init & Start Monitoring

Get Started with Storage

  1. Add Storage ANE
  2. Init Storage ANE
  3. Upload Files to Storage
  4. Download Files to Air
  5. Use File Metadata
  6. Delete Files

Get Started with Functions

  1. Write & Deploy Functions
  2. Add Functions ANE
  3. Init Functions
Clone this wiki locally