Skip to content

anttivuor/react-native-start-activity-for-result

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-start-activity-for-result

React Native implementation for Android's native startActivityForResult() and onActivityResult() methods. This can be used for integrations with other apps that require using the previously mentioned methods.

Usage

import startActivityForResult from 'react-native-start-activity-for-result';

startActivityForResult(returnKey, options);

Example

import startActivityForResult from 'react-native-start-activity-for-result';

export const openExternalAppAndGetToken = async (uri: string, extra: Object) => {
    const token = await startActivityForResult('external_app_token', {uri, extra});
    return token;
};

Parameters

Parameter Type Description
returnKey string The key used for getting data back from the launched app. The launched app has to use putExtra() method when returning data. More information here
options Object Options that can be passed to the lanched intent (below more information)
options.action string The used intent action (default value is Intent.ACTION_VIEW = "android.intent.action.VIEW"). See more information here.
options.uri Uri The data passed for the intent (uses Intent.setData(Uri data)).
options.extra Object All of the extras that are passed for the intent (uses Intent.putExtras(Bundle extras)).

More information about Android intents and their structure here.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published