Host URL for private api in a hybrid application


#1

want to use a javascript private API in our hybrid mobile application. The API uses Host name and 10 digit key to verify the account.

Account{
    "host":"sample.example.com",
"key":"1234567890",
}

The problem is, my hybrid mobile application doesnot use any host but runs in the url "file:///android_asset/www/index.html"

Please let me know that is there any workaround to solve this issue?


#2

Maybe Im totally ignorant here but can you not just run the applicaiton through localhost with $ ionic serve


#3

Thanks for your reply.when you use serve command it runs on “localhost” in the browser but in the device it doest not have host url it runns from direct url “file:///android_asset/www/index.html”


#4

Ahhh I did not know that, thanks :slight_smile:


#5

Why are you serving the entire host name predefined? Your app should resolve the path by itself. Since file:///android_asset/www is your main asset folder, using a different path as host (just a slash for instance) would resolve to the path your seeking for. This should work in your browser as well as on mobile.