如何在电脑上使用whatsapp/网页版怎么使用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在电脑上使用whatsapp/网页版怎么使用相关的知识,希望对你有一定的参考价值。

1.安装安卓模拟器点此下载安卓模拟器2.下载whatsapp messenger安卓版点此下载whatsapp messenger安卓版3.然后将whatsapp messenger通过安卓版模拟器在电脑上打开即可whatsapp是什么?whatsapp电脑版安装教程1whatsapp messenger优缺点:优点1. App内速度快2. 支持多工,而且Resume速度快3. 支持多语言输入4. 支持图片、语音片段传送5. 支持地点分享 (Location)6. 支持Push Notification及Live Tile7. 支持组群对话缺点1. 未有支持表情符号功能2. 进入App速度比较慢3. 未有支持打横提示 参考技术A 1.安装安卓模拟器 点此下载安卓模拟器 2.下载whatsapp messenger安卓版 点此下载whatsapp messenger安卓版 3.然后将whatsapp messenger通过安卓版模拟器在电脑上打开即可 whatsapp是什么?whatsapp电脑版安装教程1 whatsapp messenger优缺点

无法从我的 WebView 在 Whatsapp 上分享。无法加载位于 whatsapp://send?text= 的网页,因为 net::ERR_UNKNOWN_URL_SCHEME

【中文标题】无法从我的 WebView 在 Whatsapp 上分享。无法加载位于 whatsapp://send?text= 的网页,因为 net::ERR_UNKNOWN_URL_SCHEME【英文标题】:Unable to share on Whatsapp from my WebView . Getting The webpage at whatsapp://send?text= could not be load because net::ERR_UNKNOWN_URL_SCHEME 【发布时间】:2019-01-25 04:33:11 【问题描述】:

使用我的 Webview 应用在 whatsapp 上分享新闻时出错

**包 com.agraleaks.imgauravanimator;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.view.View;
import android.graphics.Bitmap;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;



import com.agraleaks.imgauravanimator.Common.Config;


public class MainActivity extends AppCompatActivity implements OnRefreshListener 

    private WebView webView;
    private ProgressDialog dialog;
    private BroadcastReceiver mRegistrationBroadcastReceiver;
    private SwipeRefreshLayout swipeLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
        swipeLayout.setOnRefreshListener(this);
        swipeLayout.setColorScheme(android.R.color.holo_blue_bright,
                android.R.color.holo_green_light,
                android.R.color.holo_orange_light,
                android.R.color.holo_red_light);





        //WebView
        webView = (WebView)findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebChromeClient(new WebChromeClient());
        webView.setWebViewClient(new WebViewClient() 

            @Override
            public void onPageFinished(WebView view, String url) 
                //hide loading image
                findViewById(R.id.imageView1).setVisibility(View.GONE);
                findViewById(R.id.progressBar1).setVisibility(View.GONE);
                //show webview
                findViewById(R.id.webView).setVisibility(View.VISIBLE);
            


        );

        webView.loadUrl("http://www.agraleaks.com/");
        webView.setHorizontalScrollBarEnabled(false);
        webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
        webView.setBackgroundColor(128);






        mRegistrationBroadcastReceiver = new BroadcastReceiver() 
            @Override
            public void onReceive(Context context, Intent intent) 
                if (intent.getAction().equals(Config.STR_PUSH))
                
                    String message = intent.getStringExtra(Config.STR_PUSH);
                    showNotification ("Agra Leaks- Fastest News Channel in the City",message);
                
            
        ;

        onNewIntent(getIntent());

    
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) 
        // TODO Auto-generated method stub
        super.onPageStarted(view, url, favicon);
    

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) 
        // TODO Auto-generated method stub



        if(url != null && url.startsWith("whatsapp://"))
        
             Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_TEXT, "Agra Leaks - Digital Newspaper.");
        sendIntent.setType("text/plain");
        sendIntent.setPackage("com.whatsapp");
        startActivity(sendIntent);
            return true;

        else
        
            return false;
        



    
    private void showNotification(String title, String message) 

        Intent intent = new Intent(getBaseContext(),MainActivity.class);
        intent.putExtra(Config.STR_KEY,message);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent contentIntent = PendingIntent.getActivity(getBaseContext(),0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(getBaseContext());
        builder.setAutoCancel(true)
                .setWhen(System.currentTimeMillis())
                .setDefaults(Notification.DEFAULT_ALL)
                .setSmallIcon(R.mipmap.ic_launcher_round)
                .setContentTitle(title)
                .setContentText(message)
                .setContentIntent(contentIntent);
        NotificationManager notificationManager = (NotificationManager)getBaseContext().getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(1,builder.build());
    




    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) 
        if (event.getAction()== KeyEvent.ACTION_DOWN)

            switch (keyCode)

                case KeyEvent.KEYCODE_BACK:
                    if (webView.canGoBack())

                        webView.goBack();
                    
                    else 

                        finish();
                    
                    return true;
            
        
        return super.onKeyDown(keyCode, event);
    

    @Override
    protected void onPause() 
        LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver);
        super.onPause();
    

    @Override
    protected void onResume() 
        super.onResume();
        LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver,new IntentFilter("registrationComplete"));
        LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver,new IntentFilter(Config.STR_PUSH));
    


    @Override
    public void onRefresh() 
        new Handler().postDelayed(new Runnable() 
            @Override public void run() 
               // webView.reload();
               swipeLayout.setRefreshing(false);
                webView.loadUrl( "javascript:window.location.reload( true )" );

            
        , 5000);
    






**

这些是我的代码 无法从我的 WebView 在 Whatsapp 上分享。出现错误 - 无法加载位于 whatsapp://send?text= 的网页,因为 net::ERR_UNKNOWN_URL_SCHEME。

这是我的activity_main

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"

    android:layout_
    android:layout_
    tools:context="com.agraleaks.imgauravanimator.MainActivity">

    <android.support.v4.widget.SwipeRefreshLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/swipe_container"
        android:layout_
        android:layout_>

        <WebView
            android:id="@+id/webView"
            android:layout_
            android:layout_  />





    </android.support.v4.widget.SwipeRefreshLayout>

 <ImageView
        android:id="@+id/imageView1"
        android:layout_
        android:layout_
        android:src="@drawable/splash" />


    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_
        android:layout_
        android:layout_below="@+id/imageView1"
        android:layout_centerHorizontal="true" />


</RelativeLayout>

【问题讨论】:

任何人都可以帮助... 【参考方案1】:

我自己找到了答案,

我只需要输入这些代码

@Override
            public boolean  shouldOverrideUrlLoading(WebView view, String url) 
                if(url != null && url.startsWith("whatsapp://"))
                
                    Intent sendIntent = new Intent();
                    sendIntent.setAction(Intent.ACTION_SEND);
                    sendIntent.putExtra(Intent.EXTRA_TEXT, "Moon TV");
                    sendIntent.setType("text/plain");
                    sendIntent.setPackage("com.whatsapp");
                    startActivity(sendIntent);return true;

            else
            
                return false;
            

【讨论】:

以上是关于如何在电脑上使用whatsapp/网页版怎么使用的主要内容,如果未能解决你的问题,请参考以下文章

web.whatsapp.com 是如何运作的?

如何使用 VB 2019 Selenium Chrome 创建 Whatsapp 自动回复按钮

无法从我的 WebView 在 Whatsapp 上分享。无法加载位于 whatsapp://send?text= 的网页,因为 net::ERR_UNKNOWN_URL_SCHEME

根据屏幕尺寸更改whatsapp url

电脑登不上百度和某些网站 显示http501未执行/不支持http505版本_(qq和某些网页能打开)

如何使用 html 在 whatsapp 上共享产品名称和图像?