firebase dynamic links
I have successfully created an url prefix (giftittest.page.link) to which I have added a dynamic link (giftittest.page.link/list).
I followed the procedure to add an associated domain to xcode.
xcode associated domains
From safari I insert in the url 'giftittest.page.ling/list', it offers me to open my app, I press ok, the app opens correctly and I can intercept the dynamic link with the function
dynamicLinks().onLink(dynamicLinks => {
console.log({dynamicLinks})
})
and
dynamicLinks().getInitialLink(getInitialLink => {
console.log({getInitialLink})
})
how can I pass parameters to my app in query string?
Related
I am using the dynamic links plugin to create a link, I want that when user clicks on the link if her or she is not on android then he or she must be sent to a website as I have only an android app, but if on android then he must be sent to the app. How to get the desired result? there is no method in the plugin for fallback links for different os. I am creating a dynamic link through code and not in the firebase console.
according to firebase while constructing dynamic links manually we can give Other platform parameters as ofl:
ofl: The link to open on platforms besides Android and iOS. This is useful to specify a different behavior on a desktop, like displaying a full web page of the app content/payload (as specified by param link) with another dynamic link to install the app.
it also has a ifl, i.e if app is not installed on ios:
ifl: The link to open when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app.
But can't find both ifl and ofl feature in the flutter firebase dynamic links plugin.
You can manually add ofl (or afl, or ifl) to the long Uri string and use it directly, or even build a short URL from it.
This code creates a DynamicLinkParameters variable parameters using the DynamicLinkParameters() constructor inside an async function, then uses it to create a short link that falls back to https://example.com on desktop:
final DynamicLinkParameters parameters = DynamicLinkParameters(
// constructor arguments
);
final Uri longLink = await parameters.buildUrl();
final ShortDynamicLink shortDynamicLink = await DynamicLinkParameters.shortenUrl(Uri.parse(longLink.toString() + "&ofl=https://example.com"));
final Uri dynamicLinkShortUrl = shortDynamicLink.shortUrl;
If i understood your problem correctly, you want to use a link if the user is on android and other if the user is on ios. That can be done importing dart:io and doing something like this:
if (Platform.isAndroid) {
// add the link to the android page
} else if (Platform.isIOS) {
// do something else
}
How to access (read) custom fields from the directoy?
If I create the Directory Model the custom field of the directory are not shown.
Has someone done this before with App Maker?
Best regards
Karl
Directory Model is read only. You can try to create Calculated Datasource and call AdminDirectory advanced service to get user records with custom fields:
Enable 'Google Admin Directory API'
Click Settings gear button on the top right
Select App Settings tab
Scroll to Advanced Services section
Add 'Google Admin Directory API' service
Create Calculated Model with directory fields you need (let's name it CustomDirectory)
In the calculated model's datasource server script you can add code like this to query user record from the Directory:
var email = query.filters.Email._equals;
var user = AdminDirectory.Users.get(email);
var record = app.models.CustomDirectory.newRecord();
record.Email = email;
record.FieldA = user.FieldA;
record.FieldB = user.FieldB;
...
return [record];
Query calculated datasource from the client:
var ds = app.datasources.CustomDirectory;
ds.query.filters.Email._equals = 'bob#example.com';
ds.load(function() {
console.log(ds.item);
});
You can even avoid writing client side code, if you use bindings magic.
Notes:
Since I'm not Directory admin, I had no chance to test if all links of this chain work.
Most likely you'll need to deploy your app as developer to let all your app access Google Admin Directory API.
Further reading:
https://developers.google.com/apps-script/advanced/admin-sdk-directory
https://developers.google.com/appmaker/security/identity
https://developers.google.com/appmaker/models/calculated
i'm making custom meteor account.
referring to this url >> Building a customized accounts ui for Meteor
but i have problem.
if (Accounts._resetPasswordToken) {
Session.set('resetPassword', Accounts._resetPasswordToken);
}
client side called this code is always undifined.(Accounts._resetPasswordToken)
finally i want to call
Accounts.resetPassword(Session.get('resetPassword'), pw, function(err){
I am trying to get the current URL in an AppMaker app. However, the standard JavaScript ways do not work, ScriptApp is not available in AppMaker, and the objects that are in AppMaker do not return the correct URL (that starts with https://script.google.com).
Thanks for any suggestions.
You can run a backend/serverside script and use Apps Script
ScriptApp.getService().getUrl()
See the doc ScriptApp Documentation
To have an app URL on client side, you can load it during app startup. Firstly, let's create server script that returns app URL:
/**
* Get the URL of the published web app.
*/
function getAppUrl() {
return ScriptApp.getService().getUrl();
}
Open your Project settings and put next code to App startup script section:
loader.suspendLoad();
google.script.run.withSuccessHandler(function(url) {
appUrl = url;
loader.resumeLoad();
}).getAppUrl();
Now you are able to use appUrl everywhere in Client Scripts.
Using this approach you can create initial app config on startup that requires specific data from server.
I have an app where users have already signed up. When a user clicks the telescope button in my app, they will be transferred to another server in which I am running my own fork of the telescope app.
Upon going to telescope I want to be able to automatically log the user in with the same account information as in my app. How can this be done? I can adjust the code for both Meteor apps since I am running them myself.
You need to set the Telescope app to use the accounts database of your other application.
You can do this by altering the Accounts.connection to use another Meteor app (your main app)
Add this line into your telescope app somewhere in the /server/lib directory:
var myOtherAppDDP = DDP.connect("http://your-other-app.com");
Accounts.connection = myOtherAppDDP;
This way the DDP connection for your accounts section of your meteor app will use your main apps database.
Next you need to transfer the login-tokens to the other app. For this you need to make a special link with the users current login token:
Template.registerHelper("telescopeUrl", function() {
return "https://your-telescope-app.com/?auto-login?token=" + localStorage.getItem("Meteor.loginToken") + "&userid=" + localStorage.getItem("Meteor.userId");
});
Then you can create a url:
Telescope App
Lastly, you need telescope to intercept these links and log in, you can create a route for this with iron router.
Again, create a file in /client/lib that contains something like this:
somefile.js
Router.map(function() {
this.route("loggin_in", {
onBeforeAction: function() {
var token = this.params("token");
var userId = this.params("userid");
localStorage.setItem("Meteor.loginToken", token);
localStorage.setItem("Meteor.userId", userId);
Tracker.flush();
window.location.href="/";
}
});
});
somefile.html
<template name="logging_in">
<h3>Logging you in</h3>
</template>
I've never tried it personally, but hopefully it is helpful.