反应本地背景操作意图应用程序

发布于 2025-02-05 08:00:50 字数 515 浏览 2 评论 0原文

我正在使用React本地背景操作,但是当我单击通知时,我会收到通知。默认情况下,我将在应用程序中打开画廊。我想打开我的应用。无法在单击通知时获得如何打开应用程序。

const options = {
    taskName: 'Downloading',
    taskTitle: 'ExampleTask title',
    taskDesc: 'ExampleTask description',
    taskIcon: {
      name: 'ic_launcher',
      type: 'mipmap',
    },
    color: '#ff00ff',
    linkingURI: 'yourSchemeHere://chat/jane', // See Deep Linking for more info
    parameters: {
      delay: 15000,
    },
  };

没有获得如何使用链接来打开我的应用程序,而不是使用Intent Filter或其他其他内容。

I am using react native background actions but as i am getting a notification when i click on the notification. I is opening gallery in the app by default. I want to open my app. Not able to get how can i open app on click on the notification.

const options = {
    taskName: 'Downloading',
    taskTitle: 'ExampleTask title',
    taskDesc: 'ExampleTask description',
    taskIcon: {
      name: 'ic_launcher',
      type: 'mipmap',
    },
    color: '#ff00ff',
    linkingURI: 'yourSchemeHere://chat/jane', // See Deep Linking for more info
    parameters: {
      delay: 15000,
    },
  };

Not getting how to use linking to open my app instead of the gallery using intent filter or something else.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

-黛色若梦 2025-02-12 08:00:53

为了打开相应的应用程序,当用户单击“ React Antive Andive背景操作服务”通知时。

采取这两个步骤 -

  1. 在Android/app/src/main上的AndroidManifest.xml上添加意图过滤器。在应用程序活动标签下。

另外,请验证此行“ Android:lainingmode =“ singletask”“应该是
在活动标签中。如果没有,请添加

 < intent-filter android:label =“ filter_react_native”> 
    < action android:name =“ android.intent.action.view” />
    <类别Android:name =“ android.intent.category.default” />
    <类别Android:name =“ android.intent.category.browsable” />
    < data android:scheme =“ technomizeems” /> //您的自定义方案名称然后在第二步中,我们将在linkinguri上添加它
</intent-filter>
 
  1. 在开始方法的“配置”选项中添加linkinguri。 (Linkinguri的重要收获是添加与Intent-Filter上添加的相同名称
    在数据标签Android中:AndroidManifest.xml中的方案,也附加://)
  const Options = {
          任务名称:“任务名称”,
          TaskTitle:“任务标题”,
          taskDESC:“任务描述”,
          Taskicon:{
            名称:'ic_launcher',
            类型:“ mipmap”,
          },,
          颜色:'#ff00ff',
          // Linkinguri的重要收获是添加与Intent-Filter上添加的相同名称
          //在数据标签Android中:AndroidManifest.xml中的方案,也附加://
          Linkinguri:“ Technomizeems://',//有关更多信息,请参见Deep Linking
          参数: {
            延迟:1000,
          },,
};
等待背景服务。
 

有关更多详细信息,您可以在此处参考

https://github.com/rapsssito /反应 - 本地 - 背景#深链接

希望它能帮助您或其他人。谢谢!

快乐的编码:-)

In order to open the respective app when the user clicks on the notification of react native background action service.

Take these two steps -

  1. Add intent filter on AndroidManifest.xml located at android/app/src/main. Under application activity tag.

Also, verify this line "android:launchMode="singleTask"" should be
there in activity tag. if not then please add it

<intent-filter android:label="filter_react_native"> 
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="technomizeEMS" /> // Your custom scheme name then in second step we'll add this on linkingURI
</intent-filter>
  1. Add linkingUri in the configuration option of the start method. (The important takeaway for linkingURI is to add the same name as added on intent-filter
    in data tag android:scheme in AndroidManifest.xml and also append :// )
const options = {
          taskName: 'Task Name',
          taskTitle: 'Task Title',
          taskDesc: 'Task Description',
          taskIcon: {
            name: 'ic_launcher',
            type: 'mipmap',
          },
          color: '#ff00ff',
          // The important take away for linkingURI is to add same name as added on intent-filter
          // in data tag android:scheme in AndroidManifest.xml and also append ://
          linkingURI: 'technomizeEMS://', // See Deep Linking for more info
          parameters: {
            delay: 1000,
          },
};
await BackgroundService.start(this.veryIntensiveTask, options);

For more detail you can refer here

https://github.com/Rapsssito/react-native-background-actions#deep-linking

Hope it will help you or somebody else. Thanks!

Happy Coding :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文