fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
23.9k stars 1.34k forks source link

Native Widgets [Ads, Monetization Libraries, system widgets, etc.] #1844

Open AlbinoGeek opened 3 years ago

AlbinoGeek commented 3 years ago

Is your feature request related to a problem? Please describe:

If I develop an application with fyne, I cannot currently utilize Push Notification libraries, Advertiser/Monetization providers, or any other native widget/component on Desktop (JS/C ads), Mobile (Android: Java ads, iOS: ???)

Is it possible to construct a solution with the existing API?

Probably not.

Describe the solution you'd like to see:

In go mobile or go mobile bind you can place advertisements in your Anrdoid title by simply adding 5 lines of code within the generated GoNativeActivity.java file, and repacking the built apk file, then re-signing it.

The required insertion is something along the following:

popup = new PopupWindow(this);
popup.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

AdView adView = new AdView(this);
popup.setContentView(adView);
popup.showAtLocation(getWindow().getDecorView(), Gravity.BOTTOM, 0, 0);

https://dev.to/ntoooop/integrate-ad-sdk-in-golang-games-198f

AlbinoGeek commented 3 years ago

This alone prevents many businesses from seeing fyne as a framework they could legitimately develop on, as there is currently zero monetization support within the framework, without considerable workarounds which circumvent the workflow put forward:

The current path to monetizing a fyne application is to sell it outright, however, as I could not find a method to obtain the device's Unique ID (or any other device IDs (IMEI, Serial Number, anything) for that matter), there's no way to lock down that license to prevent app cloning.

[^1]: You can sorta get around this by using an App-Link to Google Play, but it feels very hacky, and makes your application behave like malware, (opening Chrome which opens Google Play, v.s. just showing the on-screen purchase modal like you're supposed to.)


Context: I only develop for Android when it comes to phones, I only touch iOS when it's on a Desktop -- so I don't know if my asks are incompatible with the way iOS "Mobile" regulates things, or the Apple App Store. I apologize if any of this ask seems impossible due to the cross-platform nature of fyne.

andydotxyz commented 3 years ago

The current path to monetizing a fyne application is to sell it outright, however, as I could not find a method to obtain the device's Unique ID (or any other device IDs (IMEI, Serial Number, anything) for that matter), there's no way to lock down that license to prevent app cloning.

You can sell through app stores using their standard pay-to-download model...

prologic commented 1 year ago

What about the native integrations point? 🤔 Such as Push Notifications?

andydotxyz commented 1 year ago

I don't really know what response to give here. Adding push notification support would be a good thing. Thankfully separate to showing native widgets, but nonetheless requires some work and I suppose a push provider service as well?

Gys commented 1 year ago

@andydotxyz Push Notifications are an OS thing in both iOS and Android. Upon registering with the OS a unique identifier is released which needs to be send to the app back end. The back end then uses the id with some service provider to send a push notification specifically to that one person's app. Optionally with some payload, sound, etc. Without a payload it becomes a silent notifications which enabled the app to do some silent background processing (but this can be overruled by the OS or user).

An article explaining the registration: https://www.swiftlyrush.com/push-notifications-in-ios/

I have a React Native mobile app that uses push notifications. It uses the free tier of OneSignal (https://onesignal.com/mobile-push). OneSignal provides a local React Native iOS/Android library (among others) integrated with their service. This makes adding Push Notifications very easy.

A push service can also be self hosted, for example with this one written in Golang: https://github.com/appleboy/gorush

Alternatively it might be possible to make a kind of js bridge to use Capacitor: an open source native framework created by Ionic which implements many more native features like camera, motion, geolocation, local notifications and push notifications (https://ionicframework.com/docs/native/push-notifications). Or, just going wild here, maybe it is possible to directly connect to the native code used by Capacitor (https://github.com/ionic-team/capacitor-plugins/tree/main/push-notifications/ios).

andydotxyz commented 1 year ago

Thanks for the information, that is very helpful. I'm sure that we could incorporate that much more easily than anything that requires rendering native UI to the screen :).

andydotxyz commented 1 year ago

Moved push notifications to #3656 separate to this, which is now relating to just OS native widgets.