Android : Not able to sync data between applications above Oreo + devices











up vote
1
down vote

favorite
2












I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.



I have googled on it and I found some ways.



I have read this document



https://developer.android.com/about/versions/oreo/background




  • We have published differently signed APKs so not able to provide same signature permission in receiver.


Already went through this links



Broadcast receiver not working in oreo



Oreo: Broadcast receiver Not working



Broadcast receiver registered in manifest not getting called in Android Oreo



Receiver stopped receiving in Oreo



Thought to implement this ways but..



1) Create foreground service and register receiver into it.
- As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.



2) Scheduled job:
- I can't use it as I need to run service all time in background.



What I have tried so far:



1) Register receiver in Application class : This is not working after application is killed because context has been killed.



2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.



Code:



Registering receiver in Application class



ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
IntentFilter filterAction = new IntentFilter();
filterAction.addAction("com.sample.example.receiver.operation");
registerReceiver(mASampleActionReceiver, filterAction);


In Manifest



<receiver android:name=".receiver.ASampleActionReceiver">
<intent-filter>
<action android:name="com.sample.example.receiver.operation" />
</intent-filter>
</receiver>


Intent service will start by receiver



<service
android:name="com.sample.example.services.SampleOperationService"
android:enabled="true"
android:exported="false" />


And a Receiver ASampleActionReceiver.java



    public class ASampleActionReceiver extends BroadcastReceiver {

Context mContext;

@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));

Intent mIntent = new Intent(mContext, SampleOperationService.class);
mIntent.putExtras(intent);
mContext.startService(mIntent);
}
}


can some one please suggest better solution?










share|improve this question




























    up vote
    1
    down vote

    favorite
    2












    I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.



    I have googled on it and I found some ways.



    I have read this document



    https://developer.android.com/about/versions/oreo/background




    • We have published differently signed APKs so not able to provide same signature permission in receiver.


    Already went through this links



    Broadcast receiver not working in oreo



    Oreo: Broadcast receiver Not working



    Broadcast receiver registered in manifest not getting called in Android Oreo



    Receiver stopped receiving in Oreo



    Thought to implement this ways but..



    1) Create foreground service and register receiver into it.
    - As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.



    2) Scheduled job:
    - I can't use it as I need to run service all time in background.



    What I have tried so far:



    1) Register receiver in Application class : This is not working after application is killed because context has been killed.



    2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.



    Code:



    Registering receiver in Application class



    ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
    IntentFilter filterAction = new IntentFilter();
    filterAction.addAction("com.sample.example.receiver.operation");
    registerReceiver(mASampleActionReceiver, filterAction);


    In Manifest



    <receiver android:name=".receiver.ASampleActionReceiver">
    <intent-filter>
    <action android:name="com.sample.example.receiver.operation" />
    </intent-filter>
    </receiver>


    Intent service will start by receiver



    <service
    android:name="com.sample.example.services.SampleOperationService"
    android:enabled="true"
    android:exported="false" />


    And a Receiver ASampleActionReceiver.java



        public class ASampleActionReceiver extends BroadcastReceiver {

    Context mContext;

    @Override
    public void onReceive(Context context, Intent intent) {
    mContext = context;
    AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));

    Intent mIntent = new Intent(mContext, SampleOperationService.class);
    mIntent.putExtras(intent);
    mContext.startService(mIntent);
    }
    }


    can some one please suggest better solution?










    share|improve this question


























      up vote
      1
      down vote

      favorite
      2









      up vote
      1
      down vote

      favorite
      2






      2





      I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.



      I have googled on it and I found some ways.



      I have read this document



      https://developer.android.com/about/versions/oreo/background




      • We have published differently signed APKs so not able to provide same signature permission in receiver.


      Already went through this links



      Broadcast receiver not working in oreo



      Oreo: Broadcast receiver Not working



      Broadcast receiver registered in manifest not getting called in Android Oreo



      Receiver stopped receiving in Oreo



      Thought to implement this ways but..



      1) Create foreground service and register receiver into it.
      - As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.



      2) Scheduled job:
      - I can't use it as I need to run service all time in background.



      What I have tried so far:



      1) Register receiver in Application class : This is not working after application is killed because context has been killed.



      2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.



      Code:



      Registering receiver in Application class



      ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
      IntentFilter filterAction = new IntentFilter();
      filterAction.addAction("com.sample.example.receiver.operation");
      registerReceiver(mASampleActionReceiver, filterAction);


      In Manifest



      <receiver android:name=".receiver.ASampleActionReceiver">
      <intent-filter>
      <action android:name="com.sample.example.receiver.operation" />
      </intent-filter>
      </receiver>


      Intent service will start by receiver



      <service
      android:name="com.sample.example.services.SampleOperationService"
      android:enabled="true"
      android:exported="false" />


      And a Receiver ASampleActionReceiver.java



          public class ASampleActionReceiver extends BroadcastReceiver {

      Context mContext;

      @Override
      public void onReceive(Context context, Intent intent) {
      mContext = context;
      AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));

      Intent mIntent = new Intent(mContext, SampleOperationService.class);
      mIntent.putExtras(intent);
      mContext.startService(mIntent);
      }
      }


      can some one please suggest better solution?










      share|improve this question















      I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send broadcast to other app where it will do rest of work.



      I have googled on it and I found some ways.



      I have read this document



      https://developer.android.com/about/versions/oreo/background




      • We have published differently signed APKs so not able to provide same signature permission in receiver.


      Already went through this links



      Broadcast receiver not working in oreo



      Oreo: Broadcast receiver Not working



      Broadcast receiver registered in manifest not getting called in Android Oreo



      Receiver stopped receiving in Oreo



      Thought to implement this ways but..



      1) Create foreground service and register receiver into it.
      - As this way, I need one notification which is required to run foreground service. and I can't do that.I can't show unnecessary notification.



      2) Scheduled job:
      - I can't use it as I need to run service all time in background.



      What I have tried so far:



      1) Register receiver in Application class : This is not working after application is killed because context has been killed.



      2) Registering receiver in FireBase Notification service, but it's only initialize when notification arrives.



      Code:



      Registering receiver in Application class



      ASampleActionReceiver mASampleActionReceiver = new ASampleActionReceiver();
      IntentFilter filterAction = new IntentFilter();
      filterAction.addAction("com.sample.example.receiver.operation");
      registerReceiver(mASampleActionReceiver, filterAction);


      In Manifest



      <receiver android:name=".receiver.ASampleActionReceiver">
      <intent-filter>
      <action android:name="com.sample.example.receiver.operation" />
      </intent-filter>
      </receiver>


      Intent service will start by receiver



      <service
      android:name="com.sample.example.services.SampleOperationService"
      android:enabled="true"
      android:exported="false" />


      And a Receiver ASampleActionReceiver.java



          public class ASampleActionReceiver extends BroadcastReceiver {

      Context mContext;

      @Override
      public void onReceive(Context context, Intent intent) {
      mContext = context;
      AdoddleLog.d("LOG", intent.getExtras().getString("loginData"));

      Intent mIntent = new Intent(mContext, SampleOperationService.class);
      mIntent.putExtras(intent);
      mContext.startService(mIntent);
      }
      }


      can some one please suggest better solution?







      android broadcastreceiver android-service android-8.0-oreo android-intentservice






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 13 hours ago

























      asked 16 hours ago









      Mayur Raval

      1,96052553




      1,96052553





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370019%2fandroid-not-able-to-sync-data-between-applications-above-oreo-devices%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370019%2fandroid-not-able-to-sync-data-between-applications-above-oreo-devices%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          To store a contact into the json file from server.js file using a class in NodeJS

          Redirect URL with Chrome Remote Debugging Android Devices

          Dieringhausen