Displaying user profile information on a custom badge

I can see where I can set a custom badge for a user but what I want to do is have a default badge which is displayed when I do not have a user logged in and a custom badge when a user is logged in.

 

I want to take the information from the profile and display on the custom badge and share the badge across all users that may use the device.

 

I have searched the programming guide and looked at the toolkit demos but haven't made connection. How can I retrieve this information and populate the html elements on the custom badge?

 

 

Thanks....

Venkatasubbaiah...
Hello BobWalkerAre you using

Hello BobWalker

Are you using login app to set custom badge?

If yes

If you have configured login app you may be calling a asl.auth() function to set custom badge. .

Ex:

asl.auth(true, {

  title : 'Bob Walker',

  apps : '/UserDrive/config/apps.json',

  name : 'Floor Manager',

  pin : '',

  idleTimeout : 60,

  locale : 'en-US'

  });

You can set logout url and in that page set asl.auth(null) to remove the badge

If user logged in this User badge will be displayed.

If No and using a app in app launcher and setting asl.badge(url) in your app the custom badge will be displayed.with this url. Once loggedout you can set asl.badge(null)

If you want to get current logged in user data use asl.getUserData() this function will return the uder information.

Hope this helps.

thanks

Chenna

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bob Walker
I use:  asl.auth(true, {     

I use:

  asl.auth(true, {

       name:m_employee.getFirstName,

       titl: m_employee.getRole,

       pin: '',

      apps: "http://127.0.0.1:83/UserDrive/config/apps.json",

       idleTimeout: 0,

      badge: "http://127.0.0.1:83/UserDrive/apps/auth/userBadge.html"

});


To set the user.  This works because the badge displayed is now userBadge.html and not defaultBadge.html.


When I attempt to access the user data using asl.getUserData it doesn't appear to be returning any user information. The user object indicates null.


I have my login app configured to 'canOverwriteBadge'.


Do I need to set the profile as well?  I seem to recall reading somewhere that asl.auth sets the profile for you.


Thanks....


Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Venkatasubbaiah...
Hello BobAs per your code you

Hello Bob

As per your code you are setting custom badge and that got displayed.

You are right asl.getUserData does not return the user data.


If you got to Home --> Profile screen you can see the user data and title in that screen which was set in asl.auth()

Once you set the custom badge that will be displayed. If you want to get default badge you need to set asl.badge(null) in your app when you are logout.

thanks

Chenna

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Bob Walker
Thank you Chenna, you've been

Thank you Chenna, you've been very helpful.

I still have a disconnect as to how I get the profile information, name and title, to display on the page.

I can see that the profile has been updated from my asl.auth call.

Is that information appended to and passed on the url?

Thanks....

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Venkatasubbaiah...
Hello Bob WalkerIt looks like

Hello Bob Walker

It looks like i could not understand your problem clearly.

If login app or any other application set a custom badge that will take priority and will be displayed and does not display the profile user information. If you want to get profile data to be displayed you need to set asl.badge(null).

I am assuming that you are using OS 31. There is no way you can get profile user data from your app.

Please send me your apps.json and config.js to my motorola mail id i will try to find a workaround and provide you a solution.If is it possible your app also.

I am a lead engineer from SB1 Shell team development and i invite more queries like this to improve our product and if some of the requirements are not met that will be incorporated in next versions.

thanks

Chenna

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bob Walker
There does need to be an

There does need to be an easier way to access the user data stored on the device.

Also an update to the programmers guide would be greatly appreciated and would benefit other users getting into SB development.

I did find a work-around which I will share with you.

When I set the URL to the new badge I am passing the user's name and title in a query string appended to the url.

This allows me to extract those components of the users detail and display them on the custom badge.  I could pass other information in this fashion as well such as photo url.

Next step for me is to get the force login to work.

Thanks for all your help!  I will mark this as answered.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Venkatasubbaiah...
Thanks for your inputsWe have

Thanks for your inputs

We have fixed the issue with asl.getUserData() API and now we can get user data in any page.. In next release you will get the user name and title from asl.getUserData() API.

And i will add in programmers guide as well.

thanks

Chenna

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Evgeny Malevich
The feature is still not

The feature is still not fixed in recent OS 36.3 update, isn't it? I still receive undefined value.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kachin Agarwal
Hi Evgeny,Can you try


Hi Evgeny,

Can you try accessing this value asl.prv.user on the load event of asl.

Thanks,

Kachin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Evgeny Malevich
Hi, unfortunatelly the same

Hi, unfortunatelly the same effect.

asl.events.subscribe(asl.events.types.loaded, function () {

     alert(asl.prv.user);

});


Shows "undifined" as well as alert(asl.getUserData()).

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Ricardo Gonzalez
Has this been solved? I'm

Has this been solved? I'm using local Storage but seems to work quite wieird .. .. I'd like to use ASL but is not giving me current profile information. Can anyone please give me on which version is this being solved?

Thanks!!

Ricardo

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Ricardo Gonzalez
Guys! THIS WORKS:<script type

Guys! THIS WORKS:

<script type="text/javascript">

asl.events.subscribe(asl.events.types.loaded, function(){ PopulateBadge();});

function PopulateBadge()

{

var userNameControl = document.getElementById('divName');

var userTitleControl = document.getElementById('divTitle');

userNameControl.innerText =  asl.prv.user.name;

userTitleControl.innerText = asl.prv.user.title;

}

...

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Log in to post comments