last day (15 days later) » 

4:04 PM
0
A: NotificationOptions at DART lang

Günter ZöchbauerIf you use as chrome in the import you have to prefix references to identifiers in this package with chrome. This is not valid Dart syntax NotificationOptions notOptions = { 'message': 'this is a notification message' }; maybe it should be something like import 'dart:html'; import '...

 
The error in DART editor disappeared, but got this error while execution: "Exception: Unsupported operation: 'chrome.notifications' is not available" at DARTIUM, I thought may be this is as I did not packafe the app yet, so packaged it and run it at Chrome after using dart2js, but the notification did not appear!!
 
Did you specify permissions? see developer.chrome.com/extensions/examples/api/notifications/… for an example. Can you please verify what chrome.notifications.getPermissionLevel.then(print); returns.
 
It was missing, I added the below line but nothing changed: "permissions": ["notifications"],
 
What about getPermissionLevel?
 
the chrome.notifications.getPermissionLevel.then(print); gave me an error at .then, telling: the method 'then' is not defined for the class 'Function'
 
4:04 PM
Can you try chrome.notifications.getPermissionLevel().then(print)
Hi Hasan!
 
Hi Gunter
Deeply appreciate your continuous help, ad answering my clarifications
I tried the last command, chrome.notifications.getPermissionLevel().then(print) nothing changed as well,
 
What do you mean by 'nothing changed'. You should at least get a different error message, no? I haven't used it myself yet and have no Chrome app project where I could try it myself.
 
in DARTIUM, I got the same error "Exception: Unsupported operation: 'chrome.notifications' is not available"
in the chrome package, I got nothing
is there something in the Chrome Package like the console!
 
F12 doesn't show you the console with the output?
might need clicking in the opened devtools and press ESC
 
do you mean F12 from the Chrome App, or from the Chrome Page!
 
4:17 PM
Chrome App
you might try to open a tab with `chrome://extensions` and check if there is something like `launch background page` (don't remember how this looked)
 
I found 2 errors, the first one is: Uncaught Some of the required properties are missing: type, iconUrl, title and message.
second one is: XMLHttpRequest cannot load 79c5b52c.ngrok.com/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://dmdgnncplppbhfhfjiigdjpjiojpindn' is therefore not allowed access.
 
that looks good
 
I'll add the missing params and check again, right now
 
this seems something else
the server you access refuses to process the request
 
the server is off now.
I wrote this
chrome.NotificationOptions notOptions = new chrome.NotificationOptions(type: "BASIC", title:'notification title', message: 'this is a notification message');
but it give me error about the "type"
Argument type String can not be assigned to the parameter type 'TemplateType'
 
4:48 PM
This page https://developer.chrome.com/apps/richNotifications says
The notifications.NotificationOptions must include a notifications.TemplateType
for example
`
chrome.NotificationOptions notOptions = new chrome.NotificationOptions(message: 'this is a notification message', type: TemplateType.BASIC);
`
https://github.com/dart-gde/chrome.dart/blob/c28e83146e13a0a95e88e688e1268f6533390aa1/lib/gen/notifications.dart#L208
and
https://github.com/dart-gde/chrome.dart/blob/master/lib/gen/notifications.dart#L137
 
5:36 PM
Finally worked
I wrote it as:
chrome.NotificationOptions notOptions = new chrome.NotificationOptions(type: chrome.TemplateType.BASIC,
    iconUrl:'/fonix-agile.png',title:'notification title', message:  'this is a notification message');
 

last day (15 days later) »