How to launch a OneSignal prompt while using ionic? - ionic4

The OneSignal site goes through great detail on launching the prompt for browsers, but I'm either overlooking the option for mobile or that option doesn't exist.
I'm using Ionic 4/Angular 8 with the cordova-onesignal plugin. I've tried OneSignal.showNativePrompt() but that method doesn't exist on OneSignal. I've also tried this.oneSignal just to see what functions are available and read the comments, but there doesn't seem to be anything that triggers the prompt.
Is there some other way using Ionic to trigger the message to allow users to subscribe to notifications?

Never mind!
Guess I overlooked the promptForPushNotificationsWithUserResponse() function. Looks like it is a promise so you can perform your full suite of setup after it resolves.

Related

Is it possible to force Chrome to refresh app notification settings when using Notification delegation

In a previous answer regarding Notification Delegation between Chrome and an Android TWA app it was said that:
"If the TWA has notifications disabled in Android Settings, we disable
them in Chrome instead. There's a little bit of latency with how this
gets propagated, but things should get updated on the next TWA launch
at latest.
How exactly Notification Delegation does work?
On my site I am sending the user to androids app notification settings when I find that notifications are not allowed in the browser.
But upon the users immediate return, the changes are not propagated to Chrome (to be expected from the comment above since the TWA is not launched again).
I wonder if there is anyway I can speed this up? Otherwise the user is forced to exit the page completely and restart the app before the permission is granted, which is not a very good user experience.
It seems the only workaround would be to force restarting the application, which is not a great user experience. I have filed an issue on Chromium bugs to track a fix for this: https://bugs.chromium.org/p/chromium/issues/detail?id=1064300

Using postMessage in a Chrome Custom Tabs CustomTabsSession

I'm getting to grips with the functionality available in Chrome Custom Tabs and I'm curious to know how I might go about communicating between the Custom Tab and the app itself. I can see in CustomTabsSession that there are methods like requestPostMessageChannel, but it returns false every time I try to use it. I also can't find any documentation or examples about this.
Does anyone know how I'd go about successfully establishing a message channel between my native code and my Custom Tabs client? Bonus question: is it possible to postMessage to a service worker?
I just found the following Chromium patch from 2018:
https://chromium.googlesource.com/chromium/src/+/20891520570f780b13ae9725d9aa5a909338d0a9%5E%21/
🤝 Disable PostMessage on Trusted Web Activities.
Moving Trusted Web Activities over to CustomTabActivity gets us
PostMessage for free. Unfortunately we're not ready to launch that, so
disable it for the time being.
It's possible that things have changed since then, but this flag in Chrome 81 suggests it hasn't. So it might just not be possible to do this right now.

Tool to remotely log (debug) React Native production app

Is there some tool available for React Native to remotely debug or send logs from production app to me?
I want to use it to track what errors my test users getting without them need to interact with app.
Have you thought about raygun? This gives you an api to log your errors and then a portal to view them. I use it on a project at work and it's worth looking at https://raygun.com/
There are a few options for you which will be quite easy for you to implement. The first one I would suggest you is react-native-firebase and use it for pushing events to the analytics in firebase.
The second option would be react-native-flurry-sdk offered by yahoo flurry analytics which is also very easy and efficient.
If your app is on google play store already then you can use the build in crash reporting system which reports most of the errors but if you need something specific and in your own control like if you want the app to send you a specific error etc then its best to use react-native-flurry-sdk. you can get it from here:
https://github.com/flurry/react-native-flurry-sdk

IBM Worklight 6.2. Change default behavior for Remote disable in native apps

I'm using worklight application management features from an Android native App.
I want that when in the console the application status is changed to "Access Disabled" the only option for the user will be to quit.
In the Knowledge Center and in Developer works there is documentation about how to do it:
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.appadmin.doc/admin/t_denying_access_to_older_app_versions.html?lang=en
https://www.ibm.com/developerworks/community/blogs/worklight/entry/how_to_create_a_customized_remote_disable_behavior?lang=en
It is explained that you must set a specific value for the initOptions object used in the WL.Client.init() method.
But in the Android native API I have not found the way to set the initOptions. The init method is deprecated and it does not accept initOptions.
Also, in case of Remote Disable the ResponseListener used in the WLClient.connect(aResponseListener) is not invoked, success or failure, no method is executed. Is this working as designed? I would expect a failure or success but not nothing.
Is it possible in a native app to force the application to close in case of Remote Disable?
How could I handle this situation manually in the app?
Unfortunately I do not have an example for you, but this is the general idea.
See if you can work with it (if someone can produce an example - please do...):
You need to create your own Remote Disable challenge handler that will extend the default Worklight Remote Disable challenge handler (RemoteDisableChallengeHandler.java).
class MyRemoteDisableChallengeHandler extends WLRemoteDisableChallengeHandler
Then you need to implement your custom logic in MyRemoteDisableChallengeHandler
WLClient.registerChallengeHander(new MyRemoteDisableChallengeHandler())
This will override the original.
You'll need to create your own dialog with a Quit button.
Some additional documentation.
For handling MaM configurations, this is, when you configure the app as Lost, Stolen, etc, in the Worklight Console -> Devices tab you must install the Fix IF201408281937 (Worklight 6.2) or later.
This events are also handled with the ChallengeHandler registered for the realm "wl_remoteDisableRealm"

How to launch a native OSX app (and pass parameters) from the web?

I'm trying to launch a MacOSX app from a website and pass an authentication token from the web server. I'm trying to do something like myNewURLScheme://myauthtoken (similar to the iTunes itms:// URLs) but this doesn't seem to work. (Admittedly, I'm probably doing it wrong.)
Is this the best way to do it? (If not what is?)
How is this supposed to work? I've tried looking at "Installing a Get URL Handler" in the docs: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html, but it doesn't seem to work.
Thanks!
See here for how to get an application to have its own url scheme. You'll want to follow steps 1 thru 3 of georgebrock's post. I'm not sure how you'll get a website to pass the url to the computer though. The easiest way I can think of is to have Mail.app running on the mac and set up a mail rule. The rule can be set up to run an applescript... the applescript launches the application.
http://www.xmldatabases.org/WK/blog/1154_Handling_URL_schemes_in_Cocoa.item
This is the only one that really worked for me! Flawless.