share_apps 0.2.3 share_apps: ^0.2.3 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.2.3
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, appId and registered email address in main.dart file.
import 'package:flutter/material.dart';
import 'package:share_apps/share_apps.dart';
void main() {
ShareApps.init(
appId: 'XXXXXXXXXXXXXXXXXXX',//(AppId from)royalty.shareapps.net
secreteKey: 'XXXXXXXXXXXXXX',//(secreteKey from)royalty.shareapps.net
email:'XXX@XXX.com'); //(Email Address which registered in )royalty.shareapps.net (It required for email invitation)
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 (User have to select Country and Language).) #
NOTE: #
- Use valid mobile number must with country code. #
- Use valid email address. #
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: 'XXXX',//User First Name
lastName: 'XXXX',//User LastName
email: 'XXX@XXX.com',//User Email Address
countryCode: 'US',// User Country
language: 'English',//User Language
number:'+1000000000'); //User Mobile Number With Country Code
},
),
),
);
}
}