share_apps 0.1.7 share_apps: ^0.1.7 copied to clipboard
Put your app in front of everyone through their peers. Peer-to-peer invitations in a very subtle and simple way.
share_apps #
Put your app in front of everyone through their peers. Peer-to-peer invitations in a very subtle and simple way.
Getting Started #
This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.
For help getting started with Share app, view our online documentation, which offers tutorials, samples, guidance on SDK integration, and a full API reference.
Installation #
dependencies:
...
share_apps: ^0.1.7
Permissions #
Android #
Add the following permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
iOS #
Set the NSContactsUsageDescription
in your Info.plist
file
<key>NSContactsUsageDescription</key>
<string>This app requires contacts access to function properly.</string>
How to use. #
import share_apps.dar
import 'package:share_apps/share_apps.dart';
Example #
STEP: 1 #
Initialize ShareApps with your secretKey and appId in main.dart file.
import 'package:flutter/material.dart';
import 'package:share_apps/share_apps.dart';
void main() {
ShareApps.init(appId: 'XXXXXXXXXX', secreteKey: 'XXXXXXXXXXXX');
runApp(MyApp());
}
STEP: 2 #
There are two methods for send invitation #
1.sendInvitation() (This method will use when need to ask details from user) #
2.sendInvitationInBackground() (This method will use when you have user details and pass it in background without user interface.) #
For more details please take look example. #
sendInvitation() #
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Share App Demo'),
),
body: Center(
child: RaisedButton(
child: Text('Invite Friends'),
onPressed: () {
ShareApps.sendInvitation(context: context);
},
),
),
);
}
}
sendInvitationInBackground() #
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Share App Demo'),
),
body: Center(
child: RaisedButton(
child: Text('Invite Friends in Background'),
onPressed: () {
ShareApps.sendInvitationInBackground(
context: context,
firstName: 'ABC',
lastName: 'XYZ',
countryName: 'United States',
email: 'xyz@gmail.com',
language: 'ENGLISH',
number: '444123456'
);
},
),
),
);
}
}