rakutentech / android-miniapp Goto Github PK
View Code? Open in Web Editor NEWMini App SDK for Android Apps
Home Page: https://rakutentech.github.io/android-miniapp/
License: MIT License
Mini App SDK for Android Apps
Home Page: https://rakutentech.github.io/android-miniapp/
License: MIT License
I keep getting this error
java.lang.RuntimeException: Unable to get provider com.rakuten.tech.mobile.miniapp.MiniappSdkInitializer: java.lang.NumberFormatException: For input string: ""
However, I am written nothing in my code. My manifest file is
To Reproduce
I am confused how should I provide app id and subscription key. Is the mistake while assigning them? Lets say I have a mini app on a server, how can I call it in this app. I think the documentation can be more clear.
Is your feature request related to a problem? Please describe.
In the documentation, it is written that we need to provide our own base URL for the app, but I didn't find any resources as to how to implement the backend for the base URL, which serves the mini apps and their info.
I couldn't find a list of end points and what they are supposed to return and expect(payload). As of now to implement the backend for base URL, I'm checking each link the app hits when I call a function implementing it on the go. Is there a better easier way to implement it? Where can I find more resources about the base_url's backend.
Similarly, the MiniAppConfigSdk takes subscriptionKey along with the rasProjectId. How and where is the subscription key used?
Describe the solution you'd like
Add details regarding the backend (endpoints, payload and what needs to be returned) to the Documentation.
An example app with a miniapp deployed and an example backend will help a lot.
Additional information on how to load and open external urls.
hello
what kind of miniapp package(wechat/tencent/buido) can render by rakutentech sdk?
how i can develop sdk to support specific miniapp package?
thanks a lot
Describe the bug
I am not able to open my website
To Reproduce
Steps to reproduce the behavior:
I'm following the sample code on your website
But I keep getting this error
com.rakuten.tech.mobile.miniapp.MiniAppNotFoundException: Not Found: Server returned no mini app for the provided project ID.
at com.rakuten.tech.mobile.miniapp.api.RetrofitRequestExecutor.exceptionForHttpError(ApiClient.kt:194)
at com.rakuten.tech.mobile.miniapp.api.RetrofitRequestExecutor.executeRequest(ApiClient.kt:145)
at com.rakuten.tech.mobile.miniapp.api.ApiClient.fetchInfo(ApiClient.kt:73)
at com.rakuten.tech.mobile.miniapp.MiniAppDownloader.getMiniApp(MiniAppDownloader.kt:51)
at com.rakuten.tech.mobile.miniapp.RealMiniApp.create(RealMiniApp.kt:69)
at com.rakuten.tech.mobile.miniapp.MiniApp.create$default(MiniApp.kt:74)
Expected behavior
I expected to open my website
Smartphone (please complete the following information):
Additional context
Could the problem be the subscription key? Where do I get the key from?
I got this error when I hosted the mini app on my own server and provided the base URL. Can someone just confirm me if the project id and subscription key can be own or this should be given by rakuten? Can I have my own app , own server , own mini app and fetch that using this sdk or we have to develop mini app with rakuten and then fetch it? CAN SOMEONE PLEASE ANSWER THIS SIMPLE QUESTION?? I need to run this for my project and I am stuck because of this question.
Hi,
I was trying to use the library with my own node js backend, which means during the development phase I'll be having a local address(IPv4 Address), because of URL validation which mandates the usage of https://
and the application doesn't work at all.
I tried exposing the port using ngrok
and it fixed the issue, but is there any other way or a reason why it only uses https://
Could you please shed some light on how to have a way around that and how to use the sdk with our own backend?
If possible, could you please add the support for http://
urls
Describe the bug
The miniapps are loading successfully in few mobile devices like Pixel 3 XL emulator with Android 10.0 but it is not loading in most of the devices after the recent Android WebView update.
I also tried running the superapp in the 94.0.xx and 95.0.xx WebView versions but it isn't loading the miniapps and I'm getting the errors(please refer the logs).
I also tested the app with older WebView versions like 83.0.4103.101 and it was able to load the miniapps successfully.
This is probably due to compatibility issues with the recent updates of Android WebView.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The SDK should load the miniapps as expected.
Screenshots/Logs
2021-11-17 13:23:15.312 11812-11812/com.example.app D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.example.app activity: com.example.app.ui.MainActivity@271e56e
2021-11-17 13:23:15.327 11812-11812/com.example.app D/EgretLoader: EgretLoader(Context context)
2021-11-17 13:23:15.328 11812-11812/com.example.app D/EgretLoader: The context is not activity
2021-11-17 13:23:15.332 11812-11812/com.example.app W/chromium: [WARNING:navigation_controller_impl.cc(288)] Refusing to load for invalid virtual URL: https://mscheme.<appId>/miniapp/index.html
2021-11-17 13:23:15.334 11812-11812/com.example.app W/ContentCatcher: Failed to notify a WebView
Smartphone (please complete the following information):
Additional context
N/A
./gradlew assemble
> Configure project :admob-latest
WARNING: The option setting 'android.jetifier.blacklist=bcprov' is experimental.
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
> Configure project :miniapp
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
Documentation not published for snapshot version.
> Configure project :testapp
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
WARNING: BuildType(staging): resValue 'sslPublicKey' value is being replaced: ->
WARNING: BuildType(staging): resValue 'sslPublicKeyBackup' value is being replaced: ->
WARNING: BuildType(staging): resValue 'stagingBaseUrl' value is being replaced: https://www.example.com/ -> https://www.example.com/
WARNING: BuildType(staging): resValue 'stagingProjectId' value is being replaced: test-host-project-id -> test-host-project-id
WARNING: BuildType(staging): resValue 'stagingSubscriptionKey' value is being replaced: test-subs-key -> test-subs-key
WARNING: BuildType(staging): resValue 'prodBaseUrl' value is being replaced: https://www.example.com/ -> https://www.example.com/
WARNING: BuildType(staging): resValue 'prodProjectId' value is being replaced: test-host-project-id -> test-host-project-id
WARNING: BuildType(staging): resValue 'prodSubscriptionKey' value is being replaced: test-subs-key -> test-subs-key
WARNING: BuildType(staging): buildConfigField 'ENABLE_APPCENTER_CRASHLYTICS' value is being replaced: true -> true
WARNING: BuildType(rc): resValue 'sslPublicKey' value is being replaced: ->
WARNING: BuildType(rc): resValue 'sslPublicKeyBackup' value is being replaced: ->
WARNING: BuildType(rc): resValue 'stagingBaseUrl' value is being replaced: https://www.example.com/ -> https://www.example.com/
WARNING: BuildType(rc): resValue 'stagingProjectId' value is being replaced: test-host-project-id -> test-host-project-id
WARNING: BuildType(rc): resValue 'stagingSubscriptionKey' value is being replaced: test-subs-key -> test-subs-key
WARNING: BuildType(rc): resValue 'prodBaseUrl' value is being replaced: https://www.example.com/ -> https://www.example.com/
WARNING: BuildType(rc): resValue 'prodProjectId' value is being replaced: test-host-project-id -> test-host-project-id
WARNING: BuildType(rc): resValue 'prodSubscriptionKey' value is being replaced: test-subs-key -> test-subs-key
WARNING: BuildType(rc): buildConfigField 'ENABLE_APPCENTER_CRASHLYTICS' value is being replaced: true -> true
testapp: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.github.bumptech.glide:compiler:4.12.0'.
> Task :analytics:compileDebugKotlin
w: /Users/xyz/git/android-miniapp/analytics/src/main/java/com/rakuten/tech/mobile/analytics/Tracker.kt: (4, 13): Parameter 'name' is never used
w: /Users/xyz/git/android-miniapp/analytics/src/main/java/com/rakuten/tech/mobile/analytics/Tracker.kt: (4, 27): Parameter 'parameters' is never used
> Task :miniapp:processDebugManifest
/Users/xyz/git/android-miniapp/miniapp/src/main/AndroidManifest.xml:17:9-22:49 Warning:
provider#com.rakuten.tech.mobile.sdkutils.SdkUtilsInitProvider@android:initOrder was tagged at AndroidManifest.xml:17 to replace other declarations but no other declaration present
> Task :analytics:compileReleaseKotlin
w: /Users/xyz/git/android-miniapp/analytics/src/main/java/com/rakuten/tech/mobile/analytics/Tracker.kt: (4, 13): Parameter 'name' is never used
w: /Users/xyz/git/android-miniapp/analytics/src/main/java/com/rakuten/tech/mobile/analytics/Tracker.kt: (4, 27): Parameter 'parameters' is never used
> Task :miniapp:processReleaseManifest
/Users/xyz/git/android-miniapp/miniapp/src/main/AndroidManifest.xml:17:9-22:49 Warning:
provider#com.rakuten.tech.mobile.sdkutils.SdkUtilsInitProvider@android:initOrder was tagged at AndroidManifest.xml:17 to replace other declarations but no other declaration present
> Task :miniapp:kaptReleaseKotlin FAILED
> Task :miniapp:kaptDebugKotlin FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':miniapp:kaptReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':miniapp:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 27s
148 actionable tasks: 148 executed
I have been trying to share data between the host app and the miniapp, then process the data and then navigate back to the miniapp.
If possible data sharing should be done based on the events which can be trigger either from the host app or the miniapp, mostly from miniapp.
The json data can be shared using various ways, like
index.html
but the payment_verification.html
is opened after the data is processed.The alternative solution that I have used so far is using the MiniAppNavigator
val miniAppNavigator = object : MiniAppNavigator {
override fun openExternalUrl(
url: String,
externalResultHandler: ExternalResultHandler
) {
// Load external URL with own webView.
Log.i(javaClass.name, "url: $url")
val amount = splitQuery(URL(url))?.get("totalamount")
Log.i(javaClass.name, , "total amount: $amount")
// open fragment/activity and get the result from there
// Based on the result emit the event to open the corresponding page in the miniapp
Handler(Looper.getMainLooper()).postDelayed({
val url = "https://mscheme.0/payment_verification.html" // payment_verification.html is opened in the miniapp
Log.d(javaClass.name, "Handler callback called, url: $url")
externalResultHandler.emitResult(url)
}, 5000L)
}
}
There is a button in the miniapp which triggers an event to open the URL passed to it.
<button type="button" onclick="onButtonClicked()">Click Me!!</button>
const onButtonClicked = () => {
console.log('button clicked');
callExternalUrl(123456);
};
const callExternalUrl = (totalAmount) => {
// I want to send this data to the host app from mini app
const data = {
field1: "data1"
};
console.log('callExternalUrl called with amount: ' + totalAmount);
const url = 'https://www.test.com?totalamount=' + totalAmount;
// window.open('https://www.xyz.com/?' + JSON.stringify(data));
window.open(url);
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.