rakutentech / android-miniapp

Mini App SDK for Android Apps
https://rakutentech.github.io/android-miniapp/
MIT License
77 stars 36 forks source link

Server returned no mini app for the provided project ID #550

Open abeshjha opened 1 year ago

abeshjha commented 1 year ago

image

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.

rleojoseph commented 1 year ago

Hi @abeshjha I can help you or give you more details on the same.

Mini Apps are hosted on our Rakuten Platform https://developers.rakuten.com/miniapp/. You can also find more information here -> https://developers.rakuten.com/miniapp/devguide. Once the project is created, you can upload MiniApps. You will get Project ID & Subscription key from the platform. The same will be used in the Demo app.

This repository contains the Demo app and Mini App SDK that interacts with Platform to fetch/download & display mini-apps.

Also, our SDK does allow miniapps to load from any URL, https://github.com/rakutentech/android-miniapp/blob/master/miniapp/src/main/java/com/rakuten/tech/mobile/miniapp/MiniApp.kt#L151. Which means you can test the miniapps in local using our Demo app.

We are improving our documentation to help the users. Sorry for the inconvenience caused.

abeshjha commented 1 year ago

@rleojoseph I appreciate your time and effort to replying my queries. However, I am still confused about few things:

1) You said mini apps are hosted in your platform. But the link to developer portal https://developers.rakuten.net/hc/en-us is not working. Can it be a country issue? 2) If the hosting has to be done in rakuten platform, does that mean I can't host the mini app in my server and can't assign my own project ID and subscription key? But then what is the meaning of "We currently don't provide public api. You have to use your own host for apis" ? 3) You say sdk allows to load from any URL. Then question is again what about the key and ID? How do test mini apps in local if I don't have the key. Can I create one myself for demo or the only way is rakuten platform which it seems I am unable to access.

Please, try answering the questions. I feel the sdk is very good and I can contribute in it too it the documentation section when I am clear about everything. Thank you very much.

rleojoseph commented 1 year ago

Hi @abeshjha ,

Thank you. Please find my answers below.

  1. You said mini apps are hosted in your platform. But the link to developer portal https://developers.rakuten.net/hc/en-us is not working. Can it be a country issue?

Not sure the URL which you are accessing is correct. Please use https://developers.rakuten.com/miniapp/

  1. If the hosting has to be done in rakuten platform, does that mean I can't host the mini app in my server and can't assign my own project ID and subscription key? But then what is the meaning of "We currently don't provide public api. You have to use your own host for apis" ?

That's nothing but the Platform or your own server to host & manage MiniApps. You can host the MiniApps in your own server, but you need to have the Miniapps have similar structure and configs like in the Rakuten Platform -> https://developers.rakuten.com/miniapp/devguide/miniapp-manifest-and-meta-data. I have already discussed with our Product team about extending the Rakuten platform service to the public. We are discussing about this now, will keep you posted.

  1. You say sdk allows to load from any URL. Then question is again what about the key and ID? How do test mini apps in local if I don't have the key. Can I create one myself for demo or the only way is rakuten platform which it seems I am unable to access.

Our SDK allows to load MiniApps from Rakuten Platform. Also, it allows to load the mini-apps from your local server or any hosted websites. You don't need to use ProjectID or Subscriptionkey if you are planning to load the miniapps using URL. Our Native Demo app is having a Feature to showcase how to load the MiniApps using URL feature, you can give it a try. You can also use our JS Sample Mini App for testing purposes.

Please, try answering the questions. I feel the sdk is very good and I can contribute in it too it the documentation section when I am clear about everything. Thank you very much. Thank you @abeshjha . We are already in process of improving the SDK documentation.

Let me know if you have any other questions.

abeshjha commented 1 year ago

Thank you @rleojoseph for clarifying. Yes, I have few other questions. 1) The link https://developers.rakuten.com/miniapp/ is working but the login link to rakuten https://app-studio.miniapps.link.link/ and the RAS portal http://mobile-sdk-portal.public.rakuten-it.com/ is not. 2) I hosted a simple mini app in my own server. I also had the similar structure with manifest.json and simple index.html from the code provided with suggested folder structure and config file. But now how do I call this in my android app? I still don't have mini app project ID or subscription key. 3) Yes, I was able to load the mini app from point 2 directly using URL from my server. But this doesn't allow any manifest fetching, caching functionalities. So can I infer that currently this sdk can only be used to load mini app using url? To load it using mini app ID we need rakuten platform which we don't have access right now? Or am I wrong? Is there a possibility I can create own project ID and subscription key for the mini app hosted in my server and fetch it using the sdk?

abeshjha commented 1 year ago

val permissions = miniapp.getCustomPermissions(miniAppId)

@rleojoseph what should I send as miniAppId parameter when I want to give location/camera , custom permission to mini app but I am loading mini app via url. I don't have an app id. How do I assign permissions? Also please clarify above questions.

rleojoseph commented 1 year ago

I'm extremely sorry. I don't know how I missed to reply your previous thread. You can pretty much find the same flow in our Demo app. Please find my answers below,

  1. The link https://developers.rakuten.com/miniapp/ is working but the login link to rakuten https://app-studio.miniapps.link.link/ and the RAS portal http://mobile-sdk-portal.public.rakuten-it.com/ is not.

I had a long discussion with our Product team. As of now, the platform is not available to the public but we have plans to go public with different subscription plans in the near future. But yeah, as of now you can't use the platform, I'm sorry about that. As far as the SDK (iOS/Android/JS), we can definitely support you on the SDK side

  1. I hosted a simple mini app in my own server. I also had a similar structure with manifest.json and simple index.html from the code provided with the suggested folder structure and config file. But now how do I call this in my android app? I still don't have mini app project ID or subscription key.
  1. We fetch the Miniapps list from the platform with the saved configuration and the platform would return a list of MiniAppInfo.
  2. Upon receiving MiniAppInfo, we retrieve the MiniAppManifest from the platform. We display Terms & Conditions page to the user with this manifest info. We get the user consent before downloading a miniapp for compliance. You can make this step optional for now as you are in initial steps of development
  3. And MiniApp will downloaded and displaying using this class in Demo app
  1. Yes, I was able to load the mini app from point 2 directly using URL from my server. But this doesn't allow any manifest fetching, caching functionalities. So can I infer that currently this sdk can only be used to load mini app using url? To load it using mini app ID we need rakuten platform which we don't have access right now? Or am I wrong? Is there a possibility I can create own project ID and subscription key for the mini app hosted in my server and fetch it using the SDK?

We enable load miniapp using URL feature just to view the MiniApp UI things, but if you want to use all features from our SDK, we recommend using download & load flow.

abeshjha commented 1 year ago

@rleojoseph Thanks for the reply.

I am still confused about the reply to this question. Could you please clarify it. Yes, I was able to load the mini app from point 2 directly using URL from my server. But this doesn't allow any manifest fetching, caching functionalities. So can I infer that currently this sdk can only be used to load mini app using url? To load it using mini app ID we need rakuten platform which we don't have access right now? Or am I wrong? Is there a possibility I can create own project ID and subscription key for the mini app hosted in my server and fetch it using the SDK?

We enable load miniapp using URL feature just to view the MiniApp UI things, but if you want to use all features from our SDK, we recommend using download & load flow.

But then how do I use download and load flow. You said in point 1 that we can't use platform currently. And in point 2 that the mini app list is fetched from the platform. But if I have no access to platform, how can I use the download and load flow and explore all other functionalities of the sdk? Am I not limited to just loading by url or did I infer it wrong?

abeshjha commented 1 year ago

Follow up: I took the sample js mini app application and build it by setting the .env and mini app ID. I hosted this on my server and mini app works fine. I am again able to load this mini app in my host app using load_by_url method. But when I try to load it by providing the base url of server, and mini app ID I used while production build and then downloading in host app, I get the following error: com.rakuten.tech.mobile.miniapp.MiniAppSdkException: Found some problem, Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

I think, it is just not possible to launch our own mini app by providing own mini app ID. The at most we can do we this sdk currently is use load_by_url method and check few functionalities.

@rleojoseph Please respond to this query and clear my confusion.

rleojoseph commented 1 year ago

Follow up: I took the sample js mini app application and build it by setting the .env and mini app ID. I hosted this on my server and mini app works fine. I am again able to load this mini app in my host app using load_by_url method. But when I try to load it by providing the base url of server, and mini app ID I used while production build and then downloading in host app, I get the following error: com.rakuten.tech.mobile.miniapp.MiniAppSdkException: Found some problem, Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

I think, it is just not possible to launch our own mini app by providing own mini app ID. The at most we can do we this sdk currently is use load_by_url method and check few functionalities.

@abeshjha , As I mentioned that we don't have the platform available to public as of now. And as I see that you are setting up your own server to load the Miniapps and I was trying to help you on how the download & display miniapp flow works in the demo app.

I understand that it's really difficult to have a similar structure to what the Mini app platform does, but you can skip a few steps in the SDK, to get started. I see you are able to load a miniapp successfully using a URL. But to download & display a miniapp, SDK goes through a lot of processes to check with the platform before downloading a miniapp.

For a start, you can see the MiniAppDownloader gets the MiniAppInfo from the platform and it is called from createMiniAppView().

You can fork the repo and modify the SDK to skip these checks that we do with the platform and start downloading the miniapp (.zip).