Run function in android app when a button on a web page is pressed

Asked

Viewed 80 times

3

I have an app (developed in android studio) that gets data from the accelerometer. Now I need to make a web page with a button, when the button of the web page is clicked, the data of the accelerometer I already have in a variable, will be displayed on the web page. I need tips on how to implement the web part and the listening part of the android app. Thanks in advance!

  • I only know one method using Javascript Interface, but this interface only communicates with webView, if you would like to have a look at the link to google https://developer.android.com/guide/webapps/webview#java

  • Bruno, thanks for the answer. I think I expressed myself wrong. The part of the Web will not run inside the android app.

  • Look I guess you’ll have to create an api.

  • You will have to create an api yes, with json will be easier to adapt the language of the app, more because you did not make a hybrid app? it would be easier to deal with these things and you could go on the "lite apps and go apps" wave. If you want an alternative suggestion to api, use a pwa on the web and link it in the application with webview, I can’t test here, because my pc can’t handle visual studio and android studio together, so I won’t show you how to do it, anyone else should know how to do it. *pwa will allow things to work without internet so use pwa and not a simple web page,

1 answer

0

When you want to integrate web and app. Use an api. To build api in php has Laravel, slim framework and has many other framework you can use.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.