-
Notifications
You must be signed in to change notification settings - Fork 16
A.6. Managing Firebase iid
From Firebase Core ANE you can have access to the firebase iid API to generate or revoke current instance id. You usually won't need to bother about the iid being used in Firebase because it automatically creates this id for you for example when you are using it in the FCM ANE. However, if you really need it in your app for other purposes, here's how you should do it.
To start playing with the iid API, you must first add the required listeners only after the Firebase is successfully initialized.
Firebase.iid.addEventListener(FirebaseEvents.IID_TOKEN, onIdTokenReceived);
Firebase.iid.addEventListener(FirebaseEvents.IID_ID, onIdReceived);
private function onIdTokenReceived(e:FirebaseEvents):void
{
trace("iidToken = "+e.iidToken);
}
private function onIdReceived(e:FirebaseEvents):void
{
trace("iid id = "+e.iidID);
}
To delete and regenerate the iid again, use the following methods:
/*
this revokes the current iid. It may take a few seconds to be
completed but the SDK is not letting us know when it's job would
be over! As soon as Google changes this behavior, we will also
update the ANE.
*/
Firebase.iid.deleteIID();
/*
this will return the current id of the iid. If it's not available
maybe due to a previous call to deleteIID(), a new id will be generated
and returned.
*/
Firebase.iid.getID();
/*
this will return the current token of the iid. If it's not available
maybe due to a previous call to deleteIID(), a new token will be
generated and returned.
*/
Firebase.iid.getInstanceId();
For more advanced usages of the iid API, refer to the asdoc here.
Enjoy building Air apps – With ♥ from MyFlashLabs Team
Introduction to Firebase ANEs collection for Adobe Air apps
Get Started with Firebase Core in AIR
- Prerequisites
- Add Firebase to your app
- Add the Firebase SDK
- Init Firebase Core
- Available ANEs
- Managing Firebase iid
Get Started with Authentication
- Add Authentication
- Init Authentication
- Manage Users
- Phone Number
- Custom Auth
- Anonymous Auth
- State in Email Actions
- Email Link Authentication
Get Started with FCM + OneSignal
- Add FCM ANE
- Init FCM ANE
- Send Your 1st Message
- Send Msg to Topics
- Understanding FCM Messages
- init OneSignal
- Add Firestore
- Init Firestore
- Add Data
- Transactions & Batches
- Delete Data
- Manage the Console
- Get Data
- Get Realtime Updates
- Simple and Compound
- Order and Limit Data
- Paginate Data
- Manage Indexes
- Secure Data
- Offline Data
- Where to Go From Here
Get Started with Realtime Database
- Add Realtime Database
- Init Realtime Database
- Structure Your Database
- Save Data
- Retrieve Data
- Enable Offline Capabilities
Get Started with Remote Config
- Add Storage ANE
- Init Storage ANE
- Upload Files to Storage
- Download Files to Air
- Use File Metadata
- Delete Files