我已经将我的网站开发为android应用,但不允许通知。
我想允许Android应用程序中的网站通知。我现在该怎么办。
请帮助我。...
public class MainActivity extends AppCompatActivity {
private WebView myWebview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myWebview = (WebView)findViewById(R.id.webview);
WebSettings webSettings = myWebview.getSettings();
webSettings.setJavaScriptEnabled(true);
//insert hare required website link
myWebview.loadUrl("https://www.e-cotage.com");
//for show webpage without browser
myWebview.setWebViewClient(new WebViewClient());
}
//For back functionality in webpage
@Override
public void onBackPressed() {
if(myWebview.canGoBack())
myWebview.goBack();
else
super.onBackPressed();
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.dulal.webapp.MainActivity">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:id="@+id/webview"/>
</RelativeLayout>
<!--required internete permission for app-->
<uses-permission android:name="android.permission.INTERNET" />