精华内容
下载资源
问答
  • Messenger

    2020-06-04 14:39:37
    二、使用Messenger类 public class MainActivity extends AppCompatActivity { boolean bound=false; Intent intent; Messenger messengerSend; Messenger messengerRecv; @Override protected void onCreate...

    使用Messenger类

    客户端

    public class MainActivity extends AppCompatActivity {
    
        boolean bound=false;
        Intent intent;
        Messenger messengerSend;
        Messenger messengerRecv;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            intent = new Intent(this,CustomBindService.class);
            bindService(intent,sc,Context.BIND_AUTO_CREATE);
        }
    
        Handler handler = new Handler(){
    
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                Log.e("androidLog","what="+msg.what);
            }
        };
    
        public void btnClick(View view) {
            switch (view.getId()){
                case R.id.btnStart:
                    Message msg = new Message();
                    msg.what=100;
                    messengerRecv = new Messenger(handler);
                    msg.replyTo=messengerRecv;
                    try {
                        messengerSend.send(msg);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }
                    break;
                case R.id.btnStop:
                    stopService(intent);
                    break;
            }
        }
    
        ServiceConnection sc= new ServiceConnection() {
            @Override
            public void onServiceConnected(ComponentName name, IBinder service) {
                messengerSend = new Messenger(service);
                bound = true;
            }
    
            @Override
            public void onServiceDisconnected(ComponentName name) {
                bound = false;
            }
        };
    }

    服务端

    public class CustomBindService extends Service {
    
        Messenger messengerRev;
        Messenger messengerReply;
    
        public CustomBindService() {
            messengerRev = new Messenger(handler);
        }
    
        Handler handler = new Handler(){
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                Log.e("androidLog","what="+msg.what);
                messengerReply = msg.replyTo;
                Message message = new Message();
                message.what=50;
                try {
                    messengerReply.send(message);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        };
    
        @Override
        public IBinder onBind(Intent intent) {
            return messengerRev.getBinder();
        }
    }

     

    展开全文
  • 信使 一个Messenger应用
  • Messenger客户端

    2018-08-18 14:30:46
    當用戶按下位於Messenger主頁右下角的「探索」圖示後,能依據類別尋找近期瀏覽過的商家商品及特色體驗。「探索」讓用戶更輕易地在Messenger上閱讀新文章、預訂下個旅行目地或是獲得最新的體育焦點。Facebook將同步...
  • Mibew Messenger

    2018-12-13 08:46:43
    Mibew Messenger是一个开源免费的客服在线聊天系统,支持第二次开发,本文档是有环境搭建(Linux+Apache+PHP+Mysql)操作,和Mibew Messenger安装配置步骤。
  • Messenger,在多个平台上聊天 Messenger是用于桌面平台(Windows,Mac OS,Linux)和移动平台(Android)的简单聊天应用程序,它支持基于文本的聊天和基于音频的聊天。 屏幕截图 网络 基本结构 ___________UDP____...
  • 因为Telegram更好,所以可以轻松地将您的Facebook Messenger连接到Telegram,并且可以进行消息传递并提高工作效率。 入门 这些说明将为您提供在本地计算机上运行并运行的项目的副本,以进行开发和测试。 有关如何在...
  • Desktop-Messenger:Web Messenger的主屏幕
  • Messenger support

    2021-01-04 04:09:56
    <div><p>Messenger for desktop is a nodejs wrapper for Facebook messenger https://github.com/Aluxian/Facebook-Messenger-Desktop</p> <p>The icon is mustly hardcoded on the binary file i guess.. </p><p>...
  • Messenger例子

    2016-11-15 18:09:20
    Messenger例子,详情请看http://blog.csdn.net/zxw136511485/article/details/53168501 Android IPC之Messenger浅谈
  • Facebook Messenger机器人 这是一个简单的python模板,使用Flask为Facebook的Messenger Bot API构建了一个Webhook。 在阅读更多内容。 新功能:。 它会逐步指导您将该机器人托管在heroku上,并解锁此回购分支中...
  • Messenger settings

    2020-12-08 19:47:50
    <ol><li>Set Messenger thread settings (Greeting, Get Started button, Persistent menu).</li><li>Set Messenger on boarding hook.</li><li>White list domains for Messenger extensions sdk.</li></ol>该提问...
  • Messenger update

    2020-12-09 09:01:36
    <div><p>Will the graph api update affect the lib?</p><p>该提问来源于开源项目:messenger4j/messenger4j</p></div>
  • Diasbles messenger

    2020-11-22 02:17:01
    <div><p>I have noticed that when the extension is enabled messenger cannot be reached. Through Facebook or its when visiting messenger.com</p><p>该提问来源于开源项目:mozilla/contain-facebook...
  • Messenger This is a Go library for making bots to be used on Facebook messenger. It is built on the . One of the main goals of the project is to implement it in an idiomatic and easy to use fashion. ...
  • Redis Messenger 为Symfony Messenger提供Redis集成。 资源资源 并在
  • AMQP Messenger 为Symfony Messenger提供AMQP集成。 资源资源 并在
  • Android Messenger使用教程

    千次阅读 2019-03-29 16:07:10
    Messenger

    Messenger

    Messenger,信使,作为进程间通信之一,内部原理是AIDL。
    AIDL教程,可以去AIDL传送门了解。

    使用

    使用Messenger让服务端和客户端进行通信

    服务端

    1. 新建服务
      新建MessengerService,继承Service。
    public class MessagerService extends Service {
        public MessagerService() {
        }
    }
    
    1. 新建Handler,来处理客户端发送的消息
    public static final int WHAT_TO_SERVER = 1;
    public static final int WHAT_TO_CLIENT = 2;
    /**
     * 服务端handler,用来处理client发来的message
     */
    private Handler serverHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            if (null == msg) {
                return false;
            }
            switch (msg.what) {
                case WHAT_TO_SERVER:
                    System.out.println("Message to client:" + msg.arg1);
                    Messenger client = msg.replyTo;
                    if (null == client) {
                        System.out.println("client null");
                        return false;
                    }
                    Message toClient = Message.obtain(null, WHAT_TO_CLIENT);
                    toClient.arg1 = 101;
                    try {
                        client.send(toClient);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }
                    break;
                default:
                    break;
            }
            return false;
        }
    });
    

    通过客户端发送过来的消息Message msg,调用msg.replyto获得客户端的信使Messenger client ,通过client.send(toClient)向客户端回复消息。

    1. 新建信使Messenger,上一步创建的Handler实例作为参数。
    /**
     * 服务端维护的Messenger
     */
    private Messenger serverMessenger = new Messenger(serverHandler);
    
    1. 返回Binder
    @Override
    public IBinder onBind(Intent intent) {
        // 返回Messenger的IBinder
        return serverMessenger.getBinder();
    }
    

    onBind(Intent intent)方法中,返回上一步创建的Messenger.getBinder()

    1. 注册 MessagerService
    <service
        android:name=".MessagerService"
        <intent-filter>
            <action android:name="com.jqchen.server.MessagerService"/>
        </intent-filter>
    </service>
    

    在注册文件AndroidManifest.xml文件中注册服务,设置action

    客户端

    1. 创建Handler用来处理服务端发送的消息
    public static final int WHAT_TO_SERVER = 1;
    public static final int WHAT_TO_CLIENT = 2;
    /**
     * 处理client接收的消息
     */
    private Handler clientHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            if (null == msg) {
                return false;
            }
            switch (msg.what) {
                case WHAT_TO_CLIENT:
                    System.out.println("Messager from server:" + msg.arg1);
                    break;
                default:
                    break;
            }
            return false;
        }
    });
    
    1. 创建信使Messenger clientMessager 。
    /**
     * client信使
     */
    private Messenger clientMessager = new Messenger(clientHandler);
    
    1. 连接远程服务MessengerService,新建Messenger serverMessenger,用来向服务端发送消息。
    /**
     * server信使
     */
    private Messenger serverMessenger;
    /**
     * messenger连接
     */
    private ServiceConnection messagerConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            serverMessenger = new Messenger(service);
            System.out.println("Messager Service connect");
        }
        @Override
        public void onServiceDisconnected(ComponentName name) {
            System.out.println("Messager Service disconnect");
        }
    };
    
    /**
     * 绑定远程MessagerService
     */
    private void messagerConnect() {
        try {
            Intent intent = new Intent();
            intent.setAction("com.jqchen.server.MessagerService");
            intent.setPackage("com.jqchen.server");
            bindService(intent, messagerConnection, BIND_AUTO_CREATE);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    1. 向服务端发送消息
    // not connect
    if (null == serverMessenger) {
        System.out.println("未连接");
        return;
    }
    // send messager
    Message toServer = Message.obtain(null, WHAT_TO_SERVER);
    toServer.arg1 = 100;
    toServer.replyTo = clientMessager;
    try {
        serverMessenger.send(toServer);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    

    首先新建消息Message toServer ,将toServer.replyTo = clientMessager,这样,对应于服务端接收到此消息,获取到clientMessager,用此clientMessager向客户端回送消息。

    展开全文
  • R2F-Messenger:QT QML Messenger客户端-服务器
  • Messenger code

    2020-11-28 22:46:56
    <p>Would it be possible to get anyones messenger code? <p>Here is the link to a code but I cannot get it for other pages: https://www.facebook.com/messenger_code/generate/?image_format=image%2Fpng...
  • Facebook Messenger

    2020-11-30 11:04:33
    <div><p>Support to Facebook Messenger through a Python plugin would be very nice.</p><p>该提问来源于开源项目:weechat/weechat</p></div>
  • Messenger Chat

    2020-12-09 02:57:27
    <div><p>Would love the ability to designate what pages Messenger Chat feature are loaded on. I've chosen to uninstall the feature because of the site performance impact the script has on site load...
  • wmwassmannReact信使 简单的React Messenger

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 8,814
精华内容 3,525
关键字:

messenger