nearby_messages_api 0.0.7 copy "nearby_messages_api: ^0.0.7" to clipboard
nearby_messages_api: ^0.0.7 copied to clipboard

outdated

Google Nearby Messages API for Flutter

Nearby Messages API #

Google Nearby Messages API for Flutter

Installation #

First, add nearby_messages_api as a dependency in your pubspec.yaml file.

iOS #

Coming Soon

Android #

Get and add a google cloud nearby messages API key to your project https://developers.google.com/nearby/messages/android/get-started

Example #

import 'package:nearby_messages_api/nearby_messages_api.dart';

class main {
    /**
    * This method gets the message when an a nearby device sends one
    */
    static void onFound(dynamic arguments) {
      print(arguments);
    }
    
    /**
    * This method gets the message when a nearby device leaves
    */
    static void onLost(dynamic arguments) {
      print(arguments);
    }
    
    NearbyMessagesApi nearbyMessagesApi = NearbyMessagesApi(onFound, onLost);
 
    Future<void> main() async {
      await nearbyMessagesApi.publish();
      await nearbyMessagesApi.backgroundSubscribe();
    
    Future<void> dispose() async {
      await nearbyMessagesApi.unPublish();
      await nearbyMessagesApi.backgroundUnsubscribe();
    }
}
5
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Google Nearby Messages API for Flutter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on nearby_messages_api